Class: Twitter::Place

Inherits:
Identity show all
Defined in:
lib/twitter/place.rb

Instance Attribute Summary collapse

Attributes inherited from Identity

#id

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

#[], attr_reader, define_attribute_method, define_predicate_method, define_uri_method, deprecate_attribute_method, display_uri_attr_reader, object_attr_reader, predicate_attr_reader, uri_attr_reader

Methods included from Utils

flat_pmap, pmap

Constructor Details

#initialize(attrs = {}) ⇒ Twitter::Place

Initializes a new place

Raises:

  • (ArgumentError)

    Error raised when supplied argument is missing a :woeid key.



22
23
24
25
# File 'lib/twitter/place.rb', line 22

def initialize(attrs = {})
  attrs[:id] ||= attrs.fetch(:woeid)
  super
end

Instance Attribute Details

#attributesHash (readonly)



7
8
9
# File 'lib/twitter/place.rb', line 7

def attributes
  @attributes
end

#countryString (readonly)



9
10
11
# File 'lib/twitter/place.rb', line 9

def country
  @country
end

#full_nameString (readonly)



9
10
11
# File 'lib/twitter/place.rb', line 9

def full_name
  @full_name
end

#nameString (readonly)



9
10
11
# File 'lib/twitter/place.rb', line 9

def name
  @name
end

Instance Method Details

#country_codeString



28
29
30
# File 'lib/twitter/place.rb', line 28

def country_code
  @attrs[:country_code] || @attrs[:countryCode] # rubocop:disable SymbolName
end

#parent_idInteger



34
35
36
# File 'lib/twitter/place.rb', line 34

def parent_id
  @attrs[:parentid]
end

#place_typeString



40
41
42
# File 'lib/twitter/place.rb', line 40

def place_type
  @attrs[:place_type] || @attrs[:placeType] && @attrs[:placeType][:name] # rubocop:disable SymbolName
end