Class: Twitter::Place
- Includes:
- Memoizable
- Defined in:
- lib/twitter/place.rb
Overview
Represents a Twitter place
Instance Attribute Summary collapse
-
#attributes ⇒ Hash
readonly
The place attributes hash.
-
#country ⇒ String
readonly
The place name.
-
#full_name ⇒ String
readonly
The place name.
-
#name ⇒ String
readonly
The place name.
Attributes inherited from Identity
Attributes inherited from Base
Instance Method Summary collapse
-
#country_code ⇒ String
Returns the country code.
-
#initialize(attrs = {}) ⇒ Twitter::Place
constructor
Initializes a new place.
-
#parent_id ⇒ Integer
Returns the parent place ID.
-
#place_type ⇒ String
Returns the place type.
Methods inherited from Base
#[], attr_reader, define_attribute_method, define_predicate_method, define_uri_method, display_uri_attr_reader, object_attr_reader, predicate_attr_reader, uri_attr_reader
Methods included from Utils
Constructor Details
#initialize(attrs = {}) ⇒ Twitter::Place
Initializes a new place
77 78 79 80 |
# File 'lib/twitter/place.rb', line 77 def initialize(attrs = {}) attrs[:id] ||= attrs.fetch(:woeid) super end |
Instance Attribute Details
#attributes ⇒ Hash (readonly)
The place attributes hash
15 16 17 |
# File 'lib/twitter/place.rb', line 15 def attributes @attributes end |
#country ⇒ String (readonly)
The place name
37 38 39 |
# File 'lib/twitter/place.rb', line 37 def country @country end |
#full_name ⇒ String (readonly)
The place name
37 38 39 |
# File 'lib/twitter/place.rb', line 37 def full_name @full_name end |
#name ⇒ String (readonly)
The place name
37 38 39 |
# File 'lib/twitter/place.rb', line 37 def name @name end |
Instance Method Details
#country_code ⇒ String
Returns the country code
88 89 90 |
# File 'lib/twitter/place.rb', line 88 def country_code @attrs[:country_code] || @attrs[:countryCode] end |
#parent_id ⇒ Integer
Returns the parent place ID
99 100 101 |
# File 'lib/twitter/place.rb', line 99 def parent_id @attrs[:parentid] end |
#place_type ⇒ String
Returns the place type
110 111 112 |
# File 'lib/twitter/place.rb', line 110 def place_type @attrs[:place_type] || (@attrs[:placeType] && @attrs[:placeType][:name]) end |