Class: ThisData::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/this_data/event.rb

Class Method Summary collapse

Class Method Details

.all(options = {}) ⇒ Object

Fetch an array of Events from the ThisData API Available options can be found at

http://help.thisdata.com/docs/v1getevents

Returns: Array of OpenStruct Event objects



11
12
13
14
15
16
17
18
# File 'lib/this_data/event.rb', line 11

def self.all(options={})
  response = ThisData::Client.new.get(ThisData::EVENTS_ENDPOINT, query: options)
  # Use NestedStruct to turn this Array of deep Hashes into an array of
  # OpenStructs
  response.parsed_response["results"].collect do |event_hash|
    NestedStruct.new(event_hash)
  end
end