Class: EasyPost::Services::Insurance

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

Constant Summary collapse

MODEL_CLASS =
EasyPost::Models::Insurance

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 Insurance objects



18
19
20
# File 'lib/easypost/services/insurance.rb', line 18

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

#create(params = {}) ⇒ Object

Create an Insurance object



7
8
9
10
# File 'lib/easypost/services/insurance.rb', line 7

def create(params = {})
  wrapped_params = { insurance: params }
  @client.make_request(:post, 'insurances', MODEL_CLASS, wrapped_params)
end

#get_next_page(collection, page_size = nil) ⇒ Object

Get the next page of insurances.



23
24
25
# File 'lib/easypost/services/insurance.rb', line 23

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

#retrieve(id) ⇒ Object

Retrieve an Insurance object



13
14
15
# File 'lib/easypost/services/insurance.rb', line 13

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