class ShipStation::Client

Attributes

auth[RW]
client[RW]
namespace[RW]

Public Class Methods

new(api_host, username, password, namespace = "SS") click to toggle source

require “shipstation” client = ShipStation::Client.new(APICONFIG[:ship_station_api], APICONFIG, APICONFIG)

# File lib/shipstation/client.rb, line 7
def initialize(api_host, username, password, namespace = "SS")
  raise ArgumentError unless username && password && api_host
  @auth = {:username => username, :password => password, :namespace => namespace}
  @client = OData::Service.new(api_host, @auth)
  @namespace = namespace
end

Public Instance Methods

inspect() click to toggle source
# File lib/shipstation/client.rb, line 26
def inspect
  "#<ShipStation::Client:#{object_id}>"
end
method_missing(method, *args, &block) click to toggle source

client.orders.all client.ShippingProviders.all client.stores.all client.orders.create(OrderNumber: “Test0001”, OrderStatusID; 2) client.orders.where(“CreateDate ge datetime’2014-06-17’”)

# File lib/shipstation/client.rb, line 19
def method_missing(method, *args, &block)
  method = method.to_s
  options = args.last.is_a?(Hash) ? args.pop : {}
  klass = method.pluralize.camelize
  ShipStation::Collection.new(@client, klass, @namespace)
end