Class: Twitter::GeoResults

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Utils
Defined in:
lib/twitter/geo_results.rb

Overview

Represents a collection of geo search results

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

flat_pmap, pmap

Methods included from Enumerable

#each

Constructor Details

#initialize(attrs = nil) ⇒ Twitter::GeoResults

Initializes a new GeoResults object

Examples:

Twitter::GeoResults.new(result: {places: []})

Parameters:

  • attrs (Hash) (defaults to: nil)

    The attributes hash from the API response



41
42
43
44
45
46
47
48
# File 'lib/twitter/geo_results.rb', line 41

def initialize(attrs = nil)
  @attrs = attrs || {}
  empty_hash = {} # : Hash[Symbol, untyped]
  empty_array = [] # : Array[untyped]
  @collection = @attrs.fetch(:result, empty_hash).fetch(:places, empty_array).collect do |place| # steep:ignore ArgumentTypeMismatch
    Place.new(place)
  end
end

Instance Attribute Details

#attrsHash (readonly) Also known as: to_h

The raw attributes hash

Examples:

results.attrs

Returns:

  • (Hash)


16
17
18
# File 'lib/twitter/geo_results.rb', line 16

def attrs
  @attrs
end

Instance Method Details

#tokenString

Returns the token for pagination

Examples:

results.token

Returns:

  • (String)


56
57
58
# File 'lib/twitter/geo_results.rb', line 56

def token
  @attrs[:token]
end