class Postmen::ShipperAccount
Shipper account object (brief information for rate and manifest responses) @see docs.postmen.com/api.html#shipper-account-information API Documentation
Public Class Methods
Returns all ShipperAccounts
@see ShipperAccountCollection#all @return [ShipperAccountCollection] Collection of ShipperAccounts
# File lib/postmen/shipper_account.rb, line 20 def self.all(options = {}) ShipperAccountCollection.all(options) end
Creates an instance of ShipperAccount
@see ShipperAccountCollection#create @return [ShipperAccount]
# File lib/postmen/shipper_account.rb, line 36 def self.create(params) ShipperAccountCollection.create(params) end
Fetches single ShipperAccount
@see ShipperAccountCollection#find @return [ShipperAccount]
# File lib/postmen/shipper_account.rb, line 28 def self.find(id) ShipperAccountCollection.find(id) end
Public Instance Methods
Deletes given ShipperAccount
@see docs.postmen.com/api.html#shipper-accounts-delete-a-shipper-account API Documentation
# File lib/postmen/shipper_account.rb, line 43 def destroy Connection.new.delete("/shipper-accounts/#{@id}") end
Update a shipper account information
@see docs.postmen.com/api.html#shipper-accounts-update-a-shipper-account-information API Documentation @example
.update(description: "Your new description") .update(address: {})
@return [ShipperAccount] Updated ShipperAccount
resource @return [Hash] a Hash with detailed information about what went wrong
# File lib/postmen/shipper_account.rb, line 101 def update(params = {}) update!(params) rescue RequestError => error error.meta end
Update a shipper account information
@see docs.postmen.com/api.html#shipper-accounts-update-a-shipper-account-information API Documentation @example
.update(description: "Your new description") .update(address: {})
@return [ShipperAccount] Updated ShipperAccount
resource @raise [RequestError]
# File lib/postmen/shipper_account.rb, line 82 def update!(params = {}) response = Connection.new.put( "/shipper-accounts/#{@id}/info", ShipperAccountUpdateQuery.new(params.merge(subject: self)).to_query ) raise RequestError, response unless response.success? ShipperAccount.new(response.data) end
Update a ShipperAccount
credentials
@see docs.postmen.com/api.html#shipper-accounts-update-a-shipper-account-credentials @return [ShipperAccount] Updated ShipperAccount
resource @return [Hash] a Hash with detailed information about what went wrong
# File lib/postmen/shipper_account.rb, line 68 def update_credentials(params = {}) update_credentials!(params) rescue RequestError => error error.meta end
Update a ShipperAccount
credentials
@see docs.postmen.com/api.html#shipper-accounts-update-a-shipper-account-credentials @return [ShipperAccount] Updated ShipperAccount
resource @raise [RequestError]
# File lib/postmen/shipper_account.rb, line 52 def update_credentials!(params = {}) response = Connection.new.put( "/shipper-accounts/#{@id}/credentials", ShipperAccountUpdateCredentialsQuery.new(params).to_query ) raise RequestError, response unless response.success? ShipperAccount.new(response.data) end