class EasyPost::Services::CarrierAccount
Constants
- CARRIER_ACCOUNT_CREATE_ENDPOINT_TYPES
Public Instance Methods
Source
# File lib/easypost/services/carrier_account.rb, line 45 def all(params = {}) get_all_helper('carrier_accounts', MODEL_CLASS, params) end
Retrieve all carrier accounts
Source
# File lib/easypost/services/carrier_account.rb, line 27 def create(params = {}) carrier_account_type = params[:type] create_url = select_carrier_account_creation_endpoint(carrier_account_type) wrapped_params = { select_top_layer_key(create_url).to_sym => params } response = @client.make_request(:post, create_url, wrapped_params) EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS) end
Create a carrier account
Source
# File lib/easypost/services/carrier_account.rb, line 59 def delete(id) @client.make_request(:delete, "carrier_accounts/#{id}") # Return true if succeeds, an error will be thrown if it fails true end
Delete a carrier account
Source
# File lib/easypost/services/carrier_account.rb, line 38 def retrieve(id) response = @client.make_request(:get, "carrier_accounts/#{id}") EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS) end
Retrieve a carrier account
Source
# File lib/easypost/services/carrier_account.rb, line 50 def update(id, params = {}) carrier_account = retrieve(id) wrapped_params = { select_top_layer_key(carrier_account[:type]).to_sym => params } response = @client.make_request(:put, "carrier_accounts/#{id}", wrapped_params) EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS) end
Update a carrier account