Class: Blastramp::OrderUpload
- Inherits:
-
Object
- Object
- Blastramp::OrderUpload
- Defined in:
- lib/blastramp/order_upload.rb
Instance Attribute Summary collapse
-
#orders ⇒ Object
readonly
Returns the value of attribute orders.
-
#session ⇒ Object
readonly
Associations.
Instance Method Summary collapse
-
#initialize(session, orders) ⇒ OrderUpload
constructor
A new instance of OrderUpload.
- #submit ⇒ Object
Constructor Details
#initialize(session, orders) ⇒ OrderUpload
Returns a new instance of OrderUpload.
7 8 9 10 |
# File 'lib/blastramp/order_upload.rb', line 7 def initialize(session, orders) @session = session @orders = orders end |
Instance Attribute Details
#orders ⇒ Object (readonly)
Returns the value of attribute orders.
5 6 7 |
# File 'lib/blastramp/order_upload.rb', line 5 def orders @orders end |
#session ⇒ Object (readonly)
Associations
4 5 6 |
# File 'lib/blastramp/order_upload.rb', line 4 def session @session end |
Instance Method Details
#submit ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/blastramp/order_upload.rb', line 12 def submit # Submit order upload to Blastramp endpoint = "http://www.ioperate.net/ws/order/orderws.asmx?wsdl" response = session.request endpoint, 'OrderUpload' do http.headers["SOAPAction"] = "http://chrome52/webservices/OrderUpload" soap.body = { 'VendorCode' => session.vendor_code, 'VendorAccessKey' => session.vendor_access_key, 'Batch' => Blastramp::OrderBatch.new(orders).soap_data } end if (response.to_hash[:result] == 'SUCCESS' && response.to_hash[:orderids]) response.to_hash[:orderids][:string] elsif (response.to_hash[:error] == 'Failed to Authenticate.') raise(AuthenticationFailure.new) else raise "Blastramp: An unknown error occured" end end |