samanage 1.8.6 → 1.8.7

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: 8eb0f2b3c57cf1e5b9b79b22c49f0d8e413c9c36
4
- data.tar.gz: fd23d7f431814e09ca1f354e25fffeca6d1d124b
3
+ metadata.gz: e1dc65a5a8e92d420166469ca9959c5555e1538f
4
+ data.tar.gz: c15598bf31ea9488ba0d7f8897484bd0c0ad7756
5
5
  SHA512:
6
- metadata.gz: f7fd9bcaf93c48131728a25c93f038489e993c5f26e53981592e8dfb1483f4baff11755349c9ad309f2309af12d29b502740a75b54c575545ec03a6d0f46a3d5
7
- data.tar.gz: 9d26eec84dc84809c951f26787cc9781751c70c8f83def1148aa8a3dfef7662b2b3cadff653f056a43325ebc7efbab666e856dad2402f2515a3b2f93585d5821
6
+ metadata.gz: db8cc22baef9596bcbb263be8c51efda54e5c99656fcc2b2825e98033c8342a69bf1795e1621f50a39b6159dcfeb46f6066cc4c32d095cc18a511d48cb9814ab
7
+ data.tar.gz: 33d2093ce8704852315ca18edcc9b40433da36f16c9453de3637bb737ca9663cdf79aeef2044484ab7ca0862349668378eb6c8278d203bcd06c51b8900c64066
data/changelog.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 1.8.7
2
+ - Fixing retry bug
3
+
1
4
  # 1.8.6
2
5
  - Removing layout=long verbosity
3
6
 
data/lib/samanage/api.rb CHANGED
@@ -16,12 +16,12 @@ module Samanage
16
16
  user: 'users.json',
17
17
  }
18
18
  ssl_ca_file "#{File.expand_path('..')}/data/cacert.pem"
19
- attr_accessor :datacenter, :content_type, :base_url, :token, :custom_forms, :authorized, :admins, :retries
19
+ attr_accessor :datacenter, :content_type, :base_url, :token, :custom_forms, :authorized, :admins, :max_retries
20
20
 
21
21
  # Development mode forzes authorization & prepopulates custom forms/fields and admins
22
22
  # datacenter should equal 'eu' or blank
23
23
  def initialize(token: nil, datacenter: nil, development_mode: false, max_retries: MAX_RETRIES)
24
- self.retries = 0
24
+ self.max_retries = max_retries
25
25
  self.token = token if token
26
26
  if !datacenter.nil? && datacenter.to_s.downcase != 'eu'
27
27
  datacenter = nil
@@ -78,6 +78,7 @@ module Samanage
78
78
  payload: payload
79
79
  }
80
80
  full_path = self.base_url + path
81
+ retries = 0
81
82
  begin
82
83
  case http_method.to_s.downcase
83
84
  when 'get'
@@ -89,9 +90,9 @@ module Samanage
89
90
  end
90
91
  rescue Errno::ECONNREFUSED, Net::OpenTimeout => e
91
92
  puts "#{e} - #{e.class}"
92
- puts "Retry: #{self.retries}/#{self.max_retries}"
93
- self.retries += 1
94
- retry if self.retries < self.max_retries
93
+ puts "Retry: #{retries}/#{self.max_retries}"
94
+ retries += 1
95
+ retry if retries < self.max_retries
95
96
  error = e
96
97
  response = e.class
97
98
  raise Samanage::InvalidRequest.new(error: error, response: response)
@@ -1,3 +1,3 @@
1
1
  module Samanage
2
- VERSION = '1.8.6'
2
+ VERSION = '1.8.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samanage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.6
4
+ version: 1.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Walls
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-26 00:00:00.000000000 Z
11
+ date: 2017-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty