Class: EasyPost::Services::Event

Inherits:
Service
  • Object
show all
Defined in:
lib/easypost/services/event.rb

Constant Summary collapse

MODEL_CLASS =
EasyPost::Models::Event

Instance Method Summary collapse

Methods inherited from Service

#initialize

Constructor Details

This class inherits a constructor from EasyPost::Services::Service

Instance Method Details

#all(params = {}) ⇒ Object

Retrieve all Event objects



14
15
16
# File 'lib/easypost/services/event.rb', line 14

def all(params = {})
  @client.make_request(:get, 'events', MODEL_CLASS, params)
end

#get_next_page(collection, page_size = nil) ⇒ Object

Get the next page of events.



29
30
31
# File 'lib/easypost/services/event.rb', line 29

def get_next_page(collection, page_size = nil)
  get_next_page_helper(collection, collection.events, 'events', MODEL_CLASS, page_size)
end

#retrieve(id) ⇒ Object

Retrieve an Event object



9
10
11
# File 'lib/easypost/services/event.rb', line 9

def retrieve(id)
  @client.make_request(:get, "events/#{id}", MODEL_CLASS)
end

#retrieve_all_payloads(event_id) ⇒ Object

Retrieve all payloads for an event.



19
20
21
# File 'lib/easypost/services/event.rb', line 19

def retrieve_all_payloads(event_id)
  @client.make_request(:get, "events/#{event_id}/payloads", EasyPost::Models::Payload)
end

#retrieve_payload(event_id, payload_id) ⇒ Object

Retrieve a specific payload for an event.



24
25
26
# File 'lib/easypost/services/event.rb', line 24

def retrieve_payload(event_id, payload_id)
  @client.make_request(:get, "events/#{event_id}/payloads/#{payload_id}", EasyPost::Models::Payload)
end