brightpearl_api 1.1.2 → 1.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc49333f113280e9c492770321071a334209d89b
4
- data.tar.gz: 8b5293b8eae47fb0169ce6948233b4fd5ba8d75f
3
+ metadata.gz: 05318d3f58505b899345915e37119892862ee4dc
4
+ data.tar.gz: af54d96f2e95b9b9b811d82e75b64666f6172980
5
5
  SHA512:
6
- metadata.gz: 21fccfd93935b6d4cfa2e88fe64662d37494383e32d36d65decb4720eb42270a9ec8c0a07392770b72a0a8c45eb84963b04c8b82f6b9ad7ba232891582ce4786
7
- data.tar.gz: 3f184aac24b9dd2c597bdae0c9fedf06eff76c2269e3752a4cda5a1d5639029f1eb244050827643c3059a3cc64a6131e642bcc7a342fb9fc5b6540b0b67c42c4
6
+ metadata.gz: 15c7db320e50b962cd6629ed2dd59e0aeb6cc0d11365e6773053494d3d1778b0597fbf966bcae5b7f091e2fae2603ac8aa0ba34f1f2ca6ce70f256ed6b7bf0ad
7
+ data.tar.gz: fc17d5cbf591ff2f78f066e40985ccbf708074f816e45569445f044cd8ec0e9a2c18600f0c345c8cbd66b9fd52f61d2ef80f2ad876eb217966a8598c097438a6
@@ -68,15 +68,24 @@ module BrightpearlApi
68
68
  def search_resource(service, resource)
69
69
  body = {}
70
70
  yield(body)
71
+ body[:pageSize] = 500
72
+ body[:firstResult] = 1
71
73
  result_hash = []
72
- response = call(:get, "/#{service}/#{resource}-search?#{body.to_query}")
73
- properties = response['metaData']['columns'].map { |x| x['name'] }
74
- response['results'].each do |result|
75
- hash = {}
76
- properties.each_with_index do |item, index|
77
- hash[item] = result[index]
74
+ results_returned = 0
75
+ results_available = 1
76
+ while results_returned < results_available
77
+ response = call(:get, "/#{service}/#{resource}-search?#{body.to_query}")
78
+ results_returned += response['metaData']['resultsReturned']
79
+ results_available = response['metaData']['resultsAvailable']
80
+ body[:firstResult] = results_returned + 1
81
+ properties = response['metaData']['columns'].map { |x| x['name'] }
82
+ response['results'].each do |result|
83
+ hash = {}
84
+ properties.each_with_index do |item, index|
85
+ hash[item] = result[index]
86
+ end
87
+ result_hash << hash
78
88
  end
79
- result_hash << hash
80
89
  end
81
90
  result_hash
82
91
  end
@@ -1,3 +1,3 @@
1
1
  module BrightpearlApi
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightpearl_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kunwar Aditya Raghuwanshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-29 00:00:00.000000000 Z
11
+ date: 2014-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler