ship_compliant 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -4
- data/Rakefile +1 -1
- data/features/search_more_sales_orders.feature +12 -0
- data/features/step_definitions/search_more_orders_steps.rb +24 -0
- data/features/support/env.rb +1 -0
- data/fixtures/vcr_cassettes/sales_order_more.yml +1141 -0
- data/fixtures/vcr_cassettes/search_more_orders_invalid_cookie.yml +1034 -0
- data/lib/ship_compliant/search_more_sales_orders.rb +38 -0
- data/lib/ship_compliant/version.rb +1 -1
- data/lib/ship_compliant.rb +2 -0
- data/ship_compliant.gemspec +1 -0
- data/spec/lib/ship_compliant/search_more_sales_orders_spec.rb +29 -0
- data/spec/spec_helper.rb +1 -0
- metadata +25 -2
@@ -0,0 +1,38 @@
|
|
1
|
+
module ShipCompliant
|
2
|
+
# == ShipCompliant::SearchMoreSalesOrders
|
3
|
+
#
|
4
|
+
# This method is used in conjunction with SearchSalesOrders to get more
|
5
|
+
# results from the search that was performed using SearchSalesOrders. This
|
6
|
+
# method will return 100 results each time.
|
7
|
+
#
|
8
|
+
# Only use this method in conjunction with SearchSalesOrders. When there are
|
9
|
+
# more results available from the search, call this method with the token
|
10
|
+
# returned from the SearchSalesOrders results or returned from a subsequent
|
11
|
+
# call of SearchMoreSalesOrders to see the next page of results.
|
12
|
+
#
|
13
|
+
# orders = ShipCompliant::SearchMoreSalesOrders.paging_cookie('paging-cookie')
|
14
|
+
#
|
15
|
+
# puts "#{orders.remaining_orders_length} orders left"
|
16
|
+
#
|
17
|
+
# orders.summaries.each do |summary|
|
18
|
+
# puts summary.purchase_date #=> DateTime
|
19
|
+
# end
|
20
|
+
class SearchMoreSalesOrders
|
21
|
+
|
22
|
+
# Finds the next 100 orders by a paging cookie. You can get the paging
|
23
|
+
# cookie from ShipCompliant::SearchSalesOrders#paging_cookie.
|
24
|
+
#
|
25
|
+
# Returns an instance of ShipCompliant::SearchSalesOrdersResult.
|
26
|
+
#
|
27
|
+
# orders = ShipCompliant::SearchMoreSalesOrders.paging_cookie('paging-cookie')
|
28
|
+
# puts orders.length #=> 100
|
29
|
+
def self.paging_cookie(cookie)
|
30
|
+
sales = ShipCompliant.client.call(:search_more_sales_orders, {
|
31
|
+
'PagingCookie' => cookie
|
32
|
+
})
|
33
|
+
|
34
|
+
r = SearchSalesOrdersResult.new(sales)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
data/lib/ship_compliant.rb
CHANGED
@@ -20,6 +20,8 @@ require "ship_compliant/search_sales_orders"
|
|
20
20
|
require "ship_compliant/search_sales_orders_result"
|
21
21
|
require "ship_compliant/search_sales_order_summary"
|
22
22
|
|
23
|
+
require "ship_compliant/search_more_sales_orders"
|
24
|
+
|
23
25
|
require "ship_compliant/get_sales_order_extended"
|
24
26
|
require "ship_compliant/get_sales_order_extended_result"
|
25
27
|
|
data/ship_compliant.gemspec
CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_development_dependency "bundler", "~> 1.5"
|
27
27
|
s.add_development_dependency "rake", "~> 10.0"
|
28
28
|
s.add_development_dependency "sdoc", "~> 0.4"
|
29
|
+
s.add_development_dependency "pry", "~> 0.9"
|
29
30
|
|
30
31
|
# TESTING
|
31
32
|
s.add_development_dependency "rspec", "~> 2.13"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module ShipCompliant
|
4
|
+
describe SearchMoreSalesOrders do
|
5
|
+
|
6
|
+
before { savon.mock! }
|
7
|
+
after { savon.unmock! }
|
8
|
+
|
9
|
+
let(:message) do
|
10
|
+
{
|
11
|
+
'Request' => {
|
12
|
+
'Security' => ShipCompliant.configuration.credentials,
|
13
|
+
'PagingCookie' => 'paging-cookie'
|
14
|
+
}
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
context "paging_cookie" do
|
19
|
+
it "finds orders by paging cookie" do
|
20
|
+
savon.expects(:search_more_sales_orders)
|
21
|
+
.with(message: message)
|
22
|
+
.returns(File.read('spec/fixtures/search_sales_orders.xml'))
|
23
|
+
|
24
|
+
SearchMoreSalesOrders.paging_cookie('paging-cookie')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ship_compliant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Baylor Rae'
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -86,6 +86,20 @@ dependencies:
|
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0.4'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: pry
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0.9'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0.9'
|
89
103
|
- !ruby/object:Gem::Dependency
|
90
104
|
name: rspec
|
91
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,6 +177,7 @@ files:
|
|
163
177
|
- features/commit_sales_order.feature
|
164
178
|
- features/get_inventory_details.feature
|
165
179
|
- features/get_sales_order_extended.feature
|
180
|
+
- features/search_more_sales_orders.feature
|
166
181
|
- features/search_sales_orders.feature
|
167
182
|
- features/step_definitions/brand_steps.rb
|
168
183
|
- features/step_definitions/commit_sales_order/all_shipments.rb
|
@@ -173,6 +188,7 @@ files:
|
|
173
188
|
- features/step_definitions/inventory_steps.rb
|
174
189
|
- features/step_definitions/product_steps.rb
|
175
190
|
- features/step_definitions/sales_order_extended_steps.rb
|
191
|
+
- features/step_definitions/search_more_orders_steps.rb
|
176
192
|
- features/step_definitions/search_order_steps.rb
|
177
193
|
- features/step_definitions/void_order_steps.rb
|
178
194
|
- features/support/env.rb
|
@@ -193,6 +209,8 @@ files:
|
|
193
209
|
- fixtures/vcr_cassettes/product_valid_brand.yml
|
194
210
|
- fixtures/vcr_cassettes/sales_order_extended.yml
|
195
211
|
- fixtures/vcr_cassettes/sales_order_missing.yml
|
212
|
+
- fixtures/vcr_cassettes/sales_order_more.yml
|
213
|
+
- fixtures/vcr_cassettes/search_more_orders_invalid_cookie.yml
|
196
214
|
- fixtures/vcr_cassettes/search_sales_orders.yml
|
197
215
|
- fixtures/vcr_cassettes/update_product.yml
|
198
216
|
- fixtures/vcr_cassettes/void_order.yml
|
@@ -225,6 +243,7 @@ files:
|
|
225
243
|
- lib/ship_compliant/product_attributes.rb
|
226
244
|
- lib/ship_compliant/product_sales_tax_rate.rb
|
227
245
|
- lib/ship_compliant/sales_tax_rate.rb
|
246
|
+
- lib/ship_compliant/search_more_sales_orders.rb
|
228
247
|
- lib/ship_compliant/search_sales_order_summary.rb
|
229
248
|
- lib/ship_compliant/search_sales_orders.rb
|
230
249
|
- lib/ship_compliant/search_sales_orders_result.rb
|
@@ -268,6 +287,7 @@ files:
|
|
268
287
|
- spec/lib/ship_compliant/product_attributes_spec.rb
|
269
288
|
- spec/lib/ship_compliant/product_sales_tax_rate_spec.rb
|
270
289
|
- spec/lib/ship_compliant/sales_tax_rate_spec.rb
|
290
|
+
- spec/lib/ship_compliant/search_more_sales_orders_spec.rb
|
271
291
|
- spec/lib/ship_compliant/search_sales_order_summary_spec.rb
|
272
292
|
- spec/lib/ship_compliant/search_sales_orders_result_spec.rb
|
273
293
|
- spec/lib/ship_compliant/search_sales_orders_spec.rb
|
@@ -308,6 +328,7 @@ test_files:
|
|
308
328
|
- features/commit_sales_order.feature
|
309
329
|
- features/get_inventory_details.feature
|
310
330
|
- features/get_sales_order_extended.feature
|
331
|
+
- features/search_more_sales_orders.feature
|
311
332
|
- features/search_sales_orders.feature
|
312
333
|
- features/step_definitions/brand_steps.rb
|
313
334
|
- features/step_definitions/commit_sales_order/all_shipments.rb
|
@@ -318,6 +339,7 @@ test_files:
|
|
318
339
|
- features/step_definitions/inventory_steps.rb
|
319
340
|
- features/step_definitions/product_steps.rb
|
320
341
|
- features/step_definitions/sales_order_extended_steps.rb
|
342
|
+
- features/step_definitions/search_more_orders_steps.rb
|
321
343
|
- features/step_definitions/search_order_steps.rb
|
322
344
|
- features/step_definitions/void_order_steps.rb
|
323
345
|
- features/support/env.rb
|
@@ -355,6 +377,7 @@ test_files:
|
|
355
377
|
- spec/lib/ship_compliant/product_attributes_spec.rb
|
356
378
|
- spec/lib/ship_compliant/product_sales_tax_rate_spec.rb
|
357
379
|
- spec/lib/ship_compliant/sales_tax_rate_spec.rb
|
380
|
+
- spec/lib/ship_compliant/search_more_sales_orders_spec.rb
|
358
381
|
- spec/lib/ship_compliant/search_sales_order_summary_spec.rb
|
359
382
|
- spec/lib/ship_compliant/search_sales_orders_result_spec.rb
|
360
383
|
- spec/lib/ship_compliant/search_sales_orders_spec.rb
|