brightpearl_api 1.3.0 → 1.3.1

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: 777e62205ed178da61ef94d8f7a685f4b2f09eb3
4
- data.tar.gz: aa7833c9467efcf7cb430a1cdaa1e0e402c4b7af
3
+ metadata.gz: b1f41a5dc70a62f5e425374b3583af15ca850ed0
4
+ data.tar.gz: 5be578c8a9d7ca90a8df8e1cdfd9c9d6c21beafd
5
5
  SHA512:
6
- metadata.gz: 89975aa35d479d1b83414b0f5fb644651c1a9be540e884bb9771b38a2acd28c01b02b6da3bcfcb11bf5e6b2568e5345cf08e45cf21378f8eab008ab32bdf555f
7
- data.tar.gz: 73f3ab5e1a14c466f2c4dd974d1e81c64ba21c3f941581ba5a8062c999a827bd7c1687484e53667a3c58693976401764f538d17565ee0c8d54891413760d6841
6
+ metadata.gz: 1fd12c22e777a5070a5882fa08c058a6a7355c117d3647ec36bb9b246c69c41db0bffdd489f9ca9fc7e8c638466ca4c459a4bce7e6736aa71e565c4737daa459
7
+ data.tar.gz: 07894fd31d3ddbb8ca99e7d54bd55d41b00e5d433653497f421fb97d1ca131734afa40123425f7802750b25469662c9ab223824191d28689921a183437afc036
@@ -21,6 +21,9 @@ module BrightpearlApi
21
21
  sleep(60.seconds)
22
22
  reset_token
23
23
  api_call(type, path, data)
24
+ rescue DatabaseException => e
25
+ sleep(1.seconds)
26
+ api_call(type, path, data)
24
27
  end
25
28
 
26
29
  def api_call(type, path, data = {})
@@ -85,6 +88,11 @@ module BrightpearlApi
85
88
  def check_response(response)
86
89
  if(!response['errors'].blank?)
87
90
  reset_token
91
+ if response['errors'].is_a? Array
92
+ if response['errors'][0].fetch('message', '').include? 'Could not create connection to database server'
93
+ raise DatabaseException, "#{response.to_json}"
94
+ end
95
+ end
88
96
  raise BrightpearlException, "#{response.to_json}"
89
97
  end
90
98
  if (response['response'].is_a? String) && (response['response'].include? 'Not authenticated')
@@ -1,3 +1,3 @@
1
1
  module BrightpearlApi
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
@@ -12,6 +12,7 @@ module BrightpearlApi
12
12
  class AuthException < StandardError; end
13
13
  class BrightpearlException < StandardError; end
14
14
  class ThrottleException < StandardError; end
15
+ class DatabaseException < StandardError; end
15
16
 
16
17
  def self.configure
17
18
  Configuration.instance.init
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.3.0
4
+ version: 1.3.1
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-11-19 00:00:00.000000000 Z
11
+ date: 2015-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler