Class: EasyPost::CarrierAccount
- Inherits:
-
Resource
- Object
- EasyPostObject
- Resource
- EasyPost::CarrierAccount
- Defined in:
- lib/easypost/carrier_account.rb
Overview
A CarrierAccount encapsulates your credentials with the carrier.
Constant Summary collapse
- CUSTOM_WORKFLOW_CARRIER_TYPES =
%w[UpsAccount FedexAccount].freeze
Instance Attribute Summary
Attributes inherited from EasyPostObject
#api_key, #name, #parent, #unsaved_values
Class Method Summary collapse
- .create(params = {}, api_key = nil) ⇒ Object
-
.types ⇒ Object
Retrieve a list of available CarrierAccount types for the authenticated User.
Methods inherited from Resource
all, class_name, #delete, each, #refresh, retrieve, #save, url, #url
Methods inherited from EasyPostObject
#[], #[]=, #as_json, construct_from, #deconstruct_keys, #each, #id, #id=, #initialize, #inspect, #keys, #refresh_from, #to_hash, #to_json, #to_s, #values
Constructor Details
This class inherits a constructor from EasyPost::EasyPostObject
Class Method Details
.create(params = {}, api_key = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/easypost/carrier_account.rb', line 12 def self.create(params = {}, api_key = nil) wrapped_params = {} wrapped_params[class_name.to_sym] = params # For Ups and Fedex the endpoint is different create_url = if CUSTOM_WORKFLOW_CARRIER_TYPES.include?(params[:type]) "#{url}/register" else url end response = EasyPost.make_request(:post, create_url, api_key, wrapped_params) EasyPost::Util.convert_to_easypost_object(response, api_key) end |
.types ⇒ Object
Retrieve a list of available CarrierAccount types for the authenticated User.
8 9 10 |
# File 'lib/easypost/carrier_account.rb', line 8 def self.types EasyPost::CarrierType.all end |