Class: ActiveMerchant::Fulfillment::WebgistixService

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

Constant Summary collapse

SERVICE_URLS =
{
  :fulfillment => 'https://www.webgistix.com/XML/CreateOrder.asp',
  :inventory => 'https://www.webgistix.com/XML/GetInventory.asp',
  :tracking  => 'https://www.webgistix.com/XML/GetTracking.asp'
}
TEST_URLS =
SERVICE_URLS.merge({
  :fulfillment => 'https://www.webgistix.com/XML/CreateOrderTest.asp'
})
SUCCESS_MESSAGE =
'Successfully submitted the order'
FAILURE_MESSAGE =
'Failed to submit the order'
DUPLICATE_MESSAGE =
'This order has already been successfully submitted'
INVALID_LOGIN =
'Invalid Credentials'
NOT_SHIPPED =
'Not Shipped'

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Service

#test?

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Methods included from RequiresParameters

#requires!

Constructor Details

#initialize(options = {}) ⇒ WebgistixService

Pass in the login and password for the shipwire account. Optionally pass in the :test => true to force test mode



67
68
69
70
# File 'lib/active_fulfillment/fulfillment/services/webgistix.rb', line 67

def initialize(options = {})
  requires!(options, :login, :password)
  super
end

Class Method Details

.shipping_methodsObject

The first is the label, and the last is the code



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/active_fulfillment/fulfillment/services/webgistix.rb', line 28

def self.shipping_methods
  [ 
    ["UPS Ground Shipping", "Ground"],
    ["UPS Standard Shipping (Canada Only)", "Standard"],
    ["UPS 3-Business Day", "3-Day Select"],
    ["UPS 2-Business Day", "2nd Day Air"],
    ["UPS 2-Business Day AM", "2nd Day Air AM"],
    ["UPS Next Day", "Next Day Air"],
    ["UPS Next Day Saver", "Next Day Air Saver"],
    ["UPS Next Day Early AM", "Next Day Air Early AM"],
    ["UPS Worldwide Express (Next Day)", "Worldwide Express"],
    ["UPS Worldwide Expedited (2nd Day)", "Worldwide Expedited"],
    ["UPS Worldwide Express Saver", "Worldwide Express Saver"],
    ["FedEx Priority Overnight", "FedEx Priority Overnight"],
    ["FedEx Standard Overnight", "FedEx Standard Overnight"],
    ["FedEx First Overnight", "FedEx First Overnight"],
    ["FedEx 2nd Day", "FedEx 2nd Day"],
    ["FedEx Express Saver", "FedEx Express Saver"],
    ["FedEx International Priority", "FedEx International Priority"],
    ["FedEx International Economy", "FedEx International Economy"],
    ["FedEx International First", "FedEx International First"],
    ["FedEx Ground", "FedEx Ground"],
    ["USPS Priority Mail", "Priority Mail"],
    ["USPS Priority Mail International", "Priority Mail International"],
    ["USPS Priority Mail Small Flat Rate Box", "Priority Mail Small Flat Rate Box"],
    ["USPS Priority Mail Medium Flat Rate Box", "Priority Mail Medium Flat Rate Box"],
    ["USPS Priority Mail Large Flat Rate Box", "Priority Mail Large Flat Rate Box"],
    ["USPS Priority Mail Flat Rate Envelope", "Priority Mail Flat Rate Envelope"],
    ["USPS First Class Mail", "First Class"],
    ["USPS First Class International", "First Class International"],
    ["USPS Express Mail", "Express"],
    ["USPS Express Mail International", "Express Mail International"],
    ["USPS Parcel Post", "Parcel"],
    ["USPS Media Mail", "Media Mail"]
  ].inject(ActiveSupport::OrderedHash.new){|h, (k,v)| h[k] = v; h}
end

Instance Method Details

#fetch_stock_levels(options = {}) ⇒ Object



77
78
79
# File 'lib/active_fulfillment/fulfillment/services/webgistix.rb', line 77

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

#fetch_tracking_numbers(order_ids, options = {}) ⇒ Object



81
82
83
# File 'lib/active_fulfillment/fulfillment/services/webgistix.rb', line 81

def fetch_tracking_numbers(order_ids, options = {})
  commit :tracking, build_tracking_request(order_ids, options)
end

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



72
73
74
75
# File 'lib/active_fulfillment/fulfillment/services/webgistix.rb', line 72

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

#test_mode?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/active_fulfillment/fulfillment/services/webgistix.rb', line 90

def test_mode?
  true
end

#valid_credentials?Boolean

Returns:

  • (Boolean)


85
86
87
88
# File 'lib/active_fulfillment/fulfillment/services/webgistix.rb', line 85

def valid_credentials?
  response = fulfill('', {}, [], :shipping_method => '')
  response.message != INVALID_LOGIN
end