Sha256: 985b65c65c591c9eee3af710751ba8f6a970058b33d975f17cd7fa85038f2919

Contents?: true

Size: 775 Bytes

Versions: 4

Compression:

Stored size: 775 Bytes

Contents

require 'twitter/enumerable'

module Twitter
  class GeoResults
    include Twitter::Enumerable
    attr_reader :attrs
    alias to_h attrs
    alias to_hash attrs
    alias to_hsh attrs

    class << self

      # Construct a new GeoResults object from a response hash
      #
      # @param response [Hash]
      # @return [Twitter::Base]
      def from_response(response={})
        new(response[:body])
      end

    end

    # Initializes a new GeoResults object
    #
    # @param attrs [Hash]
    # @return [Twitter::GeoResults]
    def initialize(attrs={})
      @attrs = attrs
      @collection = Array(@attrs[:result][:places]).map do |place|
        Place.new(place)
      end
    end

    # @return [String]
    def token
      @attrs[:token]
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twitter-5.1.1 lib/twitter/geo_results.rb
twitter-5.1.0 lib/twitter/geo_results.rb
twitter-5.0.1 lib/twitter/geo_results.rb
twitter-5.0.0 lib/twitter/geo_results.rb