Class: Twitter::Place

Inherits:
Identity show all
Includes:
Memoizable
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, 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

Parameters:

  • attrs (Hash) (defaults to: {})

Raises:

  • (ArgumentError)

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



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

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

Instance Attribute Details

#attributesHash (readonly)

Returns:

  • (Hash)


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

def attributes
  @attributes
end

#countryString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/twitter/place.rb', line 11

def country
  @country
end

#full_nameString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/twitter/place.rb', line 11

def full_name
  @full_name
end

#nameString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/twitter/place.rb', line 11

def name
  @name
end

Instance Method Details

#country_codeString

Returns:

  • (String)


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

def country_code
  @attrs[:country_code] || @attrs[:countryCode]
end

#parent_idInteger

Returns:

  • (Integer)


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

def parent_id
  @attrs[:parentid]
end

#place_typeString

Returns:

  • (String)


42
43
44
# File 'lib/twitter/place.rb', line 42

def place_type
  @attrs[:place_type] || (@attrs[:placeType] && @attrs[:placeType][:name])
end