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 EmailAddress, valid email is required/
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Service
#test?
Methods included from PostsData
included, #ssl_get, #ssl_post
#requires!
Constructor Details
Pass in the login and password for the shipwire account. Optionally pass in the :test => true to force test mode
43
44
45
46
47
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 43
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
32
33
34
35
36
37
38
39
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 32
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
53
54
55
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 53
def fetch_stock_levels(options = {})
commit :inventory, build_inventory_request(options)
end
|
#fetch_tracking_numbers(options = {}) ⇒ Object
57
58
59
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 57
def fetch_tracking_numbers(options = {})
commit :tracking, build_tracking_request(options)
end
|
#fulfill(order_id, shipping_address, line_items, options = {}) ⇒ Object
49
50
51
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 49
def fulfill(order_id, shipping_address, line_items, options = {})
commit :fulfillment, build_fulfillment_request(order_id, shipping_address, line_items, options)
end
|
#test_mode? ⇒ Boolean
66
67
68
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 66
def test_mode?
true
end
|
#valid_credentials? ⇒ Boolean
61
62
63
64
|
# File 'lib/active_fulfillment/fulfillment/services/shipwire.rb', line 61
def valid_credentials?
response = fetch_tracking_numbers
response.message !~ INVALID_LOGIN
end
|