Class: ActiveFulfillment::JamesAndJamesService

Inherits:
Service
  • Object
show all
Defined in:
lib/active_fulfillment/services/james_and_james.rb

Constant Summary collapse

SERVICE_URLS =
{
  fulfillment: 'https://%{subdomain}.sixworks.co.uk/api/1/',
  inventory: 'https://%{subdomain}.sixworks.co.uk/api/1/stock'
}.freeze

Instance Method Summary collapse

Methods inherited from Service

#fetch_tracking_data, #fetch_tracking_numbers, #test?, #valid_credentials?

Constructor Details

#initialize(options = {}) ⇒ JamesAndJamesService

Returns a new instance of JamesAndJamesService.



11
12
13
14
# File 'lib/active_fulfillment/services/james_and_james.rb', line 11

def initialize(options = {})
  requires!(options, :subdomain, :key)
  super
end

Instance Method Details

#fetch_stock_levels(options = {}) ⇒ Object



21
22
23
# File 'lib/active_fulfillment/services/james_and_james.rb', line 21

def fetch_stock_levels(options = {})
  get :inventory, build_inventory_request(options)
end

#fulfill(order_id, shipping_address, line_items, options = {}) ⇒ Object



16
17
18
19
# File 'lib/active_fulfillment/services/james_and_james.rb', line 16

def fulfill(order_id, shipping_address, line_items, options = {})
  requires!(options, :billing_address)
  commit :fulfillment, build_fulfillment_request(order_id, shipping_address, line_items, options)
end

#test_mode?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/active_fulfillment/services/james_and_james.rb', line 25

def test_mode?
  true
end