blastramp 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +11 -11
- data/blastramp.gemspec +1 -1
- data/lib/blastramp.rb +1 -0
- data/lib/blastramp/order_batch.rb +22 -0
- data/lib/blastramp/order_upload.rb +1 -1
- data/lib/blastramp/version.rb +1 -1
- data/spec/blastramp/inventory_count_query_spec.rb +0 -8
- data/spec/blastramp/order_upload_spec.rb +0 -9
- metadata +6 -7
data/Gemfile.lock
CHANGED
@@ -1,23 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
blastramp (0.0.
|
4
|
+
blastramp (0.0.11)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
9
|
activesupport (3.0.8)
|
10
10
|
builder (3.0.0)
|
11
|
-
crack (0.1.8)
|
12
11
|
diff-lcs (1.1.2)
|
13
12
|
gyoku (0.4.4)
|
14
13
|
builder (>= 2.1.2)
|
15
|
-
httpi (0.9.
|
16
|
-
pyu-ntlm-http (>= 0.1.3.1)
|
14
|
+
httpi (0.9.5)
|
17
15
|
rack
|
18
16
|
mocha (0.9.12)
|
19
|
-
|
20
|
-
|
17
|
+
nokogiri (1.5.0)
|
18
|
+
nori (1.0.2)
|
19
|
+
rack (1.3.1)
|
21
20
|
rspec (2.3.0)
|
22
21
|
rspec-core (~> 2.3.0)
|
23
22
|
rspec-expectations (~> 2.3.0)
|
@@ -26,11 +25,12 @@ GEM
|
|
26
25
|
rspec-expectations (2.3.0)
|
27
26
|
diff-lcs (~> 1.1.2)
|
28
27
|
rspec-mocks (2.3.0)
|
29
|
-
savon (0.
|
28
|
+
savon (0.9.3)
|
30
29
|
builder (>= 2.1.2)
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
gyoku (>= 0.4.0)
|
31
|
+
httpi (~> 0.9)
|
32
|
+
nokogiri (>= 1.4.0)
|
33
|
+
nori (~> 1.0)
|
34
34
|
savon_spec (0.1.6)
|
35
35
|
mocha (>= 0.9.8)
|
36
36
|
rspec (>= 2.0.0)
|
@@ -44,5 +44,5 @@ DEPENDENCIES
|
|
44
44
|
blastramp!
|
45
45
|
mocha (~> 0.9.8)
|
46
46
|
rspec (~> 2.3.0)
|
47
|
-
savon (
|
47
|
+
savon (= 0.9.3)
|
48
48
|
savon_spec (~> 0.1.6)
|
data/blastramp.gemspec
CHANGED
@@ -22,6 +22,6 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency "activesupport", "~> 3.0.3"
|
23
23
|
s.add_development_dependency "rspec", "~> 2.3.0"
|
24
24
|
s.add_development_dependency "mocha", "~> 0.9.8"
|
25
|
-
s.add_development_dependency "savon", "
|
25
|
+
s.add_development_dependency "savon", "= 0.9.3"
|
26
26
|
s.add_development_dependency "savon_spec", "~> 0.1.6"
|
27
27
|
end
|
data/lib/blastramp.rb
CHANGED
@@ -8,6 +8,7 @@ require 'blastramp/address'
|
|
8
8
|
require 'blastramp/inventory_count'
|
9
9
|
require 'blastramp/inventory_count_query'
|
10
10
|
require 'blastramp/order'
|
11
|
+
require 'blastramp/order_batch'
|
11
12
|
require 'blastramp/order_item'
|
12
13
|
require 'blastramp/order_upload'
|
13
14
|
require 'blastramp/session'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Blastramp
|
2
|
+
class OrderBatch
|
3
|
+
# Associations
|
4
|
+
attr_accessor :orders
|
5
|
+
|
6
|
+
def initialize(orders)
|
7
|
+
@orders = orders
|
8
|
+
end
|
9
|
+
|
10
|
+
# Returns OrderedHash with the properties in the correct order, camelcased and ready
|
11
|
+
# to be sent via SOAP
|
12
|
+
def soap_data
|
13
|
+
data = ActiveSupport::OrderedHash.new
|
14
|
+
data[:order] = []
|
15
|
+
orders.each do |o|
|
16
|
+
data[:order] << o.soap_data
|
17
|
+
end
|
18
|
+
data
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -18,7 +18,7 @@ module Blastramp
|
|
18
18
|
soap.body = {
|
19
19
|
'VendorCode' => session.vendor_code,
|
20
20
|
'VendorAccessKey' => session.vendor_access_key,
|
21
|
-
'Batch' =>
|
21
|
+
'Batch' => Blastramp::OrderBatch.new(orders).soap_data
|
22
22
|
}
|
23
23
|
end
|
24
24
|
if (response.to_hash[:result] == 'SUCCESS' && response.to_hash[:orderids])
|
data/lib/blastramp/version.rb
CHANGED
@@ -11,14 +11,6 @@ describe Blastramp::InventoryCountQuery do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
describe "inventory_count_query" do
|
14
|
-
it "uses InventoryCountQuery on API" do
|
15
|
-
savon.expects('InventoryCountQuery').with(
|
16
|
-
'VendorCode' => 'ABC',
|
17
|
-
'VendorAccessKey' => 'TWX45IX2R9G35394',
|
18
|
-
'Sku' => 'AAA-01-XX').returns(:many)
|
19
|
-
subject.find('AAA-01-XX')
|
20
|
-
end
|
21
|
-
|
22
14
|
context "when many InventoryCounts exist" do
|
23
15
|
before :each do
|
24
16
|
savon.stubs('InventoryCountQuery').returns(:many)
|
@@ -12,15 +12,6 @@ describe Blastramp::OrderUpload do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "order_upload" do
|
15
|
-
|
16
|
-
it "uses OrderUpload on API" do
|
17
|
-
savon.expects('OrderUpload').with(
|
18
|
-
'VendorCode' => 'ABC',
|
19
|
-
'VendorAccessKey' => 'TWX45IX2R9G35394',
|
20
|
-
'Batch' => {'Order' => order.soap_data}).returns(:success)
|
21
|
-
subject.submit
|
22
|
-
end
|
23
|
-
|
24
15
|
context "when Failed to Authenticate" do
|
25
16
|
before :each do
|
26
17
|
savon.stubs('OrderUpload').returns(:failed_to_authenticate)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 12
|
9
|
+
version: 0.0.12
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- cnantais
|
@@ -68,15 +68,13 @@ dependencies:
|
|
68
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
69
69
|
none: false
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - "="
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
segments:
|
74
74
|
- 0
|
75
|
-
-
|
76
|
-
- 0
|
77
|
-
- beta
|
75
|
+
- 9
|
78
76
|
- 3
|
79
|
-
version: 0.
|
77
|
+
version: 0.9.3
|
80
78
|
type: :development
|
81
79
|
version_requirements: *id004
|
82
80
|
- !ruby/object:Gem::Dependency
|
@@ -118,6 +116,7 @@ files:
|
|
118
116
|
- lib/blastramp/inventory_count.rb
|
119
117
|
- lib/blastramp/inventory_count_query.rb
|
120
118
|
- lib/blastramp/order.rb
|
119
|
+
- lib/blastramp/order_batch.rb
|
121
120
|
- lib/blastramp/order_item.rb
|
122
121
|
- lib/blastramp/order_upload.rb
|
123
122
|
- lib/blastramp/session.rb
|