Sha256: 2e2a5d1b5f1dfdcf4e31d8852793ad4b23de118709e5d834a05bd4942abd491e

Contents?: true

Size: 865 Bytes

Versions: 1

Compression:

Stored size: 865 Bytes

Contents

require 'twitter/enumerable'
require 'twitter/utils'

module Twitter
  class GeoResults
    include Twitter::Enumerable
    include Twitter::Utils
    attr_reader :attrs
    alias_method :to_h, :attrs
    deprecate_alias :to_hash, :to_h
    deprecate_alias :to_hsh, :to_h

    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]).collect do |place|
        Place.new(place)
      end
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter-5.6.0 lib/twitter/geo_results.rb