class Postmen::ShipperAccountCollection
This class wraps the array of ShipperAccount
models
Public Class Methods
all(options = {})
click to toggle source
Fetch all shipper accounts.
@param options [Hash] Options for the query. @see docs.postmen.com/api.html#shipper-accounts-list-all-shipper-accounts API documentation @example
.all # Returns all shipper accounts, default query. .all(slug: :aramex) # Returns only Shipper accounts from Aramex
# File lib/postmen/shipper_account_collection.rb, line 16 def self.all(options = {}) new(Connection.new.get('/shipper-accounts', ShipperAccountQuery.new(options).to_query).parsed_response) end
create(params)
click to toggle source
Creates a ShipperAccount
@param params [Hash] ShipperAccount
params @see docs.postmen.com/api.html#shipper-accounts-create-a-shipper-account API documentation @return [ShipperAccount]
# File lib/postmen/shipper_account_collection.rb, line 35 def self.create(params) ShipperAccount.new( Connection.new.post( '/shipper-accounts', CreateShipperAccountQuery.new(params).to_query ).parsed_response[:data] ) end
find(id)
click to toggle source
Fetch single ShipperAccount
@param id [UUID] ShipperAccount
UUID @see docs.postmen.com/api.html#shipper-accounts-retrieve-a-shipper-account API documentation @return [ShipperAccount] @raise ResourceNotFound if ShipperAccount
with given id was not found
# File lib/postmen/shipper_account_collection.rb, line 26 def self.find(id) get(Connection.new.get("/shipper-accounts/#{id}").parsed_response) end