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

- (Twitter::Place) initialize(attrs = {})

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

- (Hash) attributes (readonly)



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

def attributes
  @attributes
end

- (String) country (readonly)



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

def country
  @country
end

- (String) full_name (readonly)



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

def full_name
  @full_name
end

- (String) name (readonly)



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

def name
  @name
end

Instance Method Details

- (String) country_code



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

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

- (Integer) parent_id



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

def parent_id
  @attrs[:parentid]
end

- (String) place_type



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