Sha256: d843e3be57e4e3410ac90fdc311bc70602e06a8e23a1f50c69eb4ab0f3adf41a

Contents?: true

Size: 734 Bytes

Versions: 11

Compression:

Stored size: 734 Bytes

Contents

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

11 entries across 11 versions & 1 rubygems

Version Path
twitter-4.8.1 lib/twitter/place.rb
twitter-4.8.0 lib/twitter/place.rb
twitter-4.7.0 lib/twitter/place.rb
twitter-4.6.2 lib/twitter/place.rb
twitter-4.6.1 lib/twitter/place.rb
twitter-4.6.0 lib/twitter/place.rb
twitter-4.5.0 lib/twitter/place.rb
twitter-4.4.4 lib/twitter/place.rb
twitter-4.4.3 lib/twitter/place.rb
twitter-4.4.2 lib/twitter/place.rb
twitter-4.4.1 lib/twitter/place.rb