Class: EasyPost::Services::EndShipper
- Defined in:
- lib/easypost/services/end_shipper.rb
Constant Summary collapse
- MODEL_CLASS =
EasyPost::Models::EndShipper
Instance Method Summary collapse
-
#all(params = {}) ⇒ Object
Retrieve all EndShipper objects.
-
#create(params = {}) ⇒ Object
Create an EndShipper object.
-
#retrieve(id) ⇒ Object
Retrieve an EndShipper object.
-
#update(id, params) ⇒ Object
Updates an EndShipper object.
Methods inherited from Service
Constructor Details
This class inherits a constructor from EasyPost::Services::Service
Instance Method Details
#all(params = {}) ⇒ Object
Retrieve all EndShipper objects.
22 23 24 25 26 |
# File 'lib/easypost/services/end_shipper.rb', line 22 def all(params = {}) response = @client.make_request(:get, 'end_shippers', params) EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS) end |
#create(params = {}) ⇒ Object
Create an EndShipper object.
7 8 9 10 11 12 |
# File 'lib/easypost/services/end_shipper.rb', line 7 def create(params = {}) wrapped_params = { address: params } response = @client.make_request(:post, 'end_shippers', wrapped_params) EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS) end |
#retrieve(id) ⇒ Object
Retrieve an EndShipper object.
15 16 17 18 19 |
# File 'lib/easypost/services/end_shipper.rb', line 15 def retrieve(id) response = @client.make_request(:get, "end_shippers/#{id}") EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS) end |
#update(id, params) ⇒ Object
Updates an EndShipper object. This requires all parameters to be set.
29 30 31 32 33 34 |
# File 'lib/easypost/services/end_shipper.rb', line 29 def update(id, params) wrapped_params = { address: params } response = @client.make_request(:put, "end_shippers/#{id}", wrapped_params) EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS) end |