Sha256: 5c95147f3f6a1d835e3da795473c966fd59ba4947b016fd2f7d3cf031caa20d5

Contents?: true

Size: 764 Bytes

Versions: 7

Compression:

Stored size: 764 Bytes

Contents

require 'twitter/geo_factory'
require 'twitter/identity'

module Twitter
  class Place < Twitter::Identity
    attr_reader :attributes, :country, :full_name, :name, :url, :woeid
    alias woe_id woeid

    # @return [Twitter::Geo]
    def bounding_box
      @bounding_box ||= Twitter::GeoFactory.fetch_or_new(@attrs[:bounding_box])
    end

    # @return [String]
    def country_code
      @country_code ||= @attrs[:country_code] || @attrs[:countryCode]
    end

    # @return [Integer]
    def parent_id
      @parent_id ||= @attrs[:parentid]
    end

    # @return [String]
    def place_type
      @place_type ||= @attrs[:place_type] || @attrs[:placeType] && @attrs[:placeType][:name]
    end

    def id
      @attrs[:id] || @attrs[:woeid]
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
twitter-4.4.0 lib/twitter/place.rb
twitter-4.3.0 lib/twitter/place.rb
twitter-4.2.0 lib/twitter/place.rb
twitter-4.1.2 lib/twitter/place.rb
twitter-4.1.1 lib/twitter/place.rb
twitter-4.1.0 lib/twitter/place.rb
twitter-4.0.0 lib/twitter/place.rb