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.



19
20
21
22
# File 'lib/twitter/place.rb', line 19

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

Instance Attribute Details

- (Object) attributes (readonly)

Returns the value of attribute attributes



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

def attributes
  @attributes
end

- (Object) country (readonly)

Returns the value of attribute country



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

def country
  @country
end

- (Object) full_name (readonly)

Returns the value of attribute full_name



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

def full_name
  @full_name
end

- (Object) name (readonly)

Returns the value of attribute name



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

def name
  @name
end

Instance Method Details

- (String) country_code



25
26
27
# File 'lib/twitter/place.rb', line 25

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

- (Integer) parent_id



31
32
33
# File 'lib/twitter/place.rb', line 31

def parent_id
  @attrs[:parentid]
end

- (String) place_type



37
38
39
# File 'lib/twitter/place.rb', line 37

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