Class: ActiveMerchant::Fulfillment::ShipwireService
- Inherits:
-
Service
- Object
- Service
- ActiveMerchant::Fulfillment::ShipwireService
show all
- Defined in:
- lib/active_fulfillment/fulfillment/services/shipwire.rb
Constant Summary
collapse
- SERVICE_URLS =
{ :fulfillment => 'https://api.shipwire.com/exec/FulfillmentServices.php',
:inventory => 'https://api.shipwire.com/exec/InventoryServices.php',
:tracking => 'https://api.shipwire.com/exec/TrackingServices.php'
}
- SCHEMA_URLS =
{ :fulfillment => 'http://www.shipwire.com/exec/download/OrderList.dtd',
:inventory => 'http://www.shipwire.com/exec/download/InventoryUpdate.dtd',
:tracking => 'http://www.shipwire.com/exec/download/TrackingUpdate.dtd'
}
- POST_VARS =
{ :fulfillment => 'OrderListXML',
:inventory => 'InventoryUpdateXML',
:tracking => 'TrackingUpdateXML'
}
- WAREHOUSES =
{ 'CHI' => 'Chicago',
'LAX' => 'Los Angeles',
'REN' => 'Reno',
'VAN' => 'Vancouver',
'TOR' => 'Toronto',
'UK' => 'United Kingdom'
}
- INVALID_LOGIN =
/(Error with Valid Username\/EmailAddress and Password Required)|(Could not verify Username\/EmailAddress and Password combination)/
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Service
#fetch_tracking_numbers, #test?
Constructor Details
Pass in the login and password for the shipwire account. Optionally pass in the :test => true to force test mode
46
47
48
49
50
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 46
def initialize(options = {})
requires!(options, :login, :password)
super
end
|
Class Method Details
.shipping_methods ⇒ Object
The first is the label, and the last is the code
35
36
37
38
39
40
41
42
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 35
def self.shipping_methods
[ ['1 Day Service', '1D'],
['2 Day Service', '2D'],
['Ground Service', 'GD'],
['Freight Service', 'FT'],
['International', 'INTL']
].inject(ActiveSupport::OrderedHash.new){|h, (k,v)| h[k] = v; h}
end
|
Instance Method Details
#fetch_stock_levels(options = {}) ⇒ Object
56
57
58
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 56
def fetch_stock_levels(options = {})
commit :inventory, build_inventory_request(options)
end
|
#fetch_tracking_data(order_ids, options = {}) ⇒ Object
60
61
62
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 60
def fetch_tracking_data(order_ids, options = {})
commit :tracking, build_tracking_request(order_ids)
end
|
#fulfill(order_id, shipping_address, line_items, options = {}) ⇒ Object
52
53
54
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 52
def fulfill(order_id, shipping_address, line_items, options = {})
commit :fulfillment, build_fulfillment_request(order_id, shipping_address, line_items, options)
end
|
#include_empty_stock? ⇒ Boolean
77
78
79
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 77
def include_empty_stock?
@options[:include_empty_stock]
end
|
#include_pending_stock? ⇒ Boolean
73
74
75
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 73
def include_pending_stock?
@options[:include_pending_stock]
end
|
#test_mode? ⇒ Boolean
69
70
71
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 69
def test_mode?
true
end
|
#valid_credentials? ⇒ Boolean
64
65
66
67
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 64
def valid_credentials?
response = fetch_tracking_numbers([])
response.message !~ INVALID_LOGIN
end
|