Class: EasyPost::Services::Pickup
- Defined in:
- lib/easypost/services/pickup.rb
Constant Summary collapse
Instance Method Summary collapse
-
#all(params = {}) ⇒ Object
Retrieve all Pickup objects.
-
#buy(id, params = {}) ⇒ Object
Buy a Pickup.
-
#cancel(id, params = {}) ⇒ Object
Cancel a Pickup.
-
#create(params = {}) ⇒ Object
Create a Pickup object.
-
#get_next_page(collection, page_size = nil) ⇒ Object
Get next page of Pickups.
-
#retrieve(id) ⇒ Object
Retrieve a Pickup object.
Methods inherited from Service
Constructor Details
This class inherits a constructor from EasyPost::Services::Service
Instance Method Details
#all(params = {}) ⇒ Object
Retrieve all Pickup objects
18 19 20 |
# File 'lib/easypost/services/pickup.rb', line 18 def all(params = {}) @client.make_request(:get, 'pickups', MODEL_CLASS, params) end |
#buy(id, params = {}) ⇒ Object
Buy a Pickup
23 24 25 26 27 28 29 |
# File 'lib/easypost/services/pickup.rb', line 23 def buy(id, params = {}) if params.instance_of?(EasyPost::Models::PickupRate) params = { carrier: params[:carrier], service: params[:service] } end @client.make_request(:post, "pickups/#{id}/buy", MODEL_CLASS, params) end |
#cancel(id, params = {}) ⇒ Object
Cancel a Pickup
32 33 34 |
# File 'lib/easypost/services/pickup.rb', line 32 def cancel(id, params = {}) @client.make_request(:post, "pickups/#{id}/cancel", MODEL_CLASS, params) end |
#create(params = {}) ⇒ Object
Create a Pickup object
7 8 9 10 |
# File 'lib/easypost/services/pickup.rb', line 7 def create(params = {}) wrapped_params = { pickup: params } @client.make_request(:post, 'pickups', MODEL_CLASS, wrapped_params) end |
#get_next_page(collection, page_size = nil) ⇒ Object
Get next page of Pickups
37 38 39 |
# File 'lib/easypost/services/pickup.rb', line 37 def get_next_page(collection, page_size = nil) get_next_page_helper(collection, collection.pickups, 'pickups', MODEL_CLASS, page_size) end |
#retrieve(id) ⇒ Object
Retrieve a Pickup object
13 14 15 |
# File 'lib/easypost/services/pickup.rb', line 13 def retrieve(id) @client.make_request(:get, "pickups/#{id}", MODEL_CLASS) end |