Class: X::Place
Overview
A place tagged in a post
The API offers no lookup of places, so a place is read from the response of the post that expanded it, and the class answers no finder. from_id builds one from its identifier, which a place the response did not expand is built as too, and which compares equal to the place it identifies, but hydrate and refresh raise UnsupportedOperation for one that is not hydrated, since there is nothing to look it up with.
Constant Summary collapse
- FIELDS =
Every public place field
A minor release may add to it the fields the API adds, so that a lookup asks for them too; see Resource#hydrated? for what that means for a resource looked up with a list of fields of its own.
%w[contained_within country country_code full_name geo id name place_type].freeze
Instance Attribute Summary collapse
-
#contained_within ⇒ Array<String>
readonly
The identifiers of the places containing this place.
-
#country ⇒ String?
readonly
The country name.
-
#country_code ⇒ String?
readonly
The ISO 3166-1 alpha-2 country code.
-
#full_name ⇒ String?
readonly
The full name.
-
#geo ⇒ Hash?
readonly
The GeoJSON bounding box.
-
#name ⇒ String?
readonly
The short name.
-
#place_type ⇒ String?
readonly
The place type, such as city or poi.
Class Method Summary collapse
-
.default_params ⇒ Hash{String => Array<String>}
The default query parameters, which request every field.
Constructor Details
This class inherits a constructor from X::Resource
Instance Attribute Details
#contained_within ⇒ Array<String> (readonly)
The identifiers of the places containing this place
97 |
# File 'x-objects/lib/x/objects/place.rb', line 97 attribute :contained_within, :list |
#country ⇒ String? (readonly)
The country name
73 |
# File 'x-objects/lib/x/objects/place.rb', line 73 attribute :country |
#country_code ⇒ String? (readonly)
The ISO 3166-1 alpha-2 country code
81 |
# File 'x-objects/lib/x/objects/place.rb', line 81 attribute :country_code |
#full_name ⇒ String? (readonly)
The full name
65 |
# File 'x-objects/lib/x/objects/place.rb', line 65 attribute :full_name |
#geo ⇒ Hash? (readonly)
The GeoJSON bounding box
105 |
# File 'x-objects/lib/x/objects/place.rb', line 105 attribute :geo, :object |
#name ⇒ String? (readonly)
The short name
57 |
# File 'x-objects/lib/x/objects/place.rb', line 57 attribute :name |
#place_type ⇒ String? (readonly)
The place type, such as city or poi
89 |
# File 'x-objects/lib/x/objects/place.rb', line 89 attribute :place_type |
Class Method Details
.default_params ⇒ Hash{String => Array<String>}
The default query parameters, which request every field
The API offers no lookup of places, so they are requested by the posts that expand them, which ask for these fields, and a place a response included with all of them is hydrated.
38 |
# File 'x-objects/lib/x/objects/place.rb', line 38 def self.default_params = {"place.fields" => FIELDS} |