brightpearl_api 1.1.7 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b2fe15d31e50c7d2177e11bf22c8b2ab69bc2d7
4
- data.tar.gz: 03e2a18ef1eabad414ab5149262e9c4ac87b1dd0
3
+ metadata.gz: 90631aeb062267b987fdc8842250d00d829bec64
4
+ data.tar.gz: bfae106f4a7c2aa4284189f3065532dad06faf52
5
5
  SHA512:
6
- metadata.gz: d2bfde84b5e059a10dc136a85e01769a16d5f0da3bacdd2ca11c7ccff22cb5647c3061030f7e65cd88d9e91efbc42d048235ece4b6a2667b7a0628f29950c3b3
7
- data.tar.gz: 4629fc03c164e7a43dbdecb3b397b4d343ca85b56dd5c3798a884c51d1fd7e90d91bb3bd0d28f178a09456b30555303daec215b0b1e1f83087952df19e0db238
6
+ metadata.gz: e46e0420354388667e0014015285c729f82c87ac5f8a2ba1ae26bf5f24ed05590ede62a5cacb702bf32670a36cb0e1b9458ccd67ee74a38ed73a58ccb93d3914
7
+ data.tar.gz: 7f417474574d02a9afe4213953cd80e37689dcd17dd842872877af45e2b7c4c1c5958a609258a8e82d3520f1e02254392d7ba2c20366a8d2a5044319ae7e938f
@@ -11,6 +11,7 @@ module BrightpearlApi
11
11
 
12
12
  class AuthException < StandardError; end
13
13
  class BrightpearlException < StandardError; end
14
+ class ThrottleException < StandardError; end
14
15
 
15
16
  def self.configure
16
17
  Configuration.instance.init
@@ -17,6 +17,10 @@ module BrightpearlApi
17
17
  rescue AuthException => e
18
18
  reset_token
19
19
  api_call(type, path, data)
20
+ rescue ThrottleException => e
21
+ sleep(5.seconds)
22
+ reset_token
23
+ api_call(type, path, data)
20
24
  end
21
25
 
22
26
  def api_call(type, path, data = {})
@@ -86,6 +90,9 @@ module BrightpearlApi
86
90
  if (response['response'].is_a? String) && (response['response'].include? 'Not authenticated')
87
91
  raise AuthException, "#{response.to_json}"
88
92
  end
93
+ if (response['response'].is_a? String) && (response['response'].include? 'Please wait before sending another request')
94
+ raise ThrottleException, "#{response.to_json}"
95
+ end
89
96
  end
90
97
  end
91
98
  end
@@ -1,3 +1,3 @@
1
1
  module BrightpearlApi
2
- VERSION = "1.1.7"
2
+ VERSION = "1.2.0"
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.7
4
+ version: 1.2.0
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-09-12 00:00:00.000000000 Z
11
+ date: 2014-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler