Sha256: 4b94dc1017ab9331f0f4fe5ae1362c01eb15bc50c54c67eee2143c6e03bd2ab1

Contents?: true

Size: 806 Bytes

Versions: 7

Compression:

Stored size: 806 Bytes

Contents

require 'twitter/enumerable'

module Twitter
  class GeoResults
    include Twitter::Enumerable
    attr_reader :attrs
    alias_method :to_h, :attrs
    alias_method :to_hash, :attrs
    alias_method :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

7 entries across 7 versions & 1 rubygems

Version Path
twitter-5.5.1 lib/twitter/geo_results.rb
twitter-5.5.0 lib/twitter/geo_results.rb
twitter-5.4.1 lib/twitter/geo_results.rb
twitter-5.4.0 lib/twitter/geo_results.rb
twitter-5.3.1 lib/twitter/geo_results.rb
twitter-5.3.0 lib/twitter/geo_results.rb
twitter-5.2.0 lib/twitter/geo_results.rb