zuora_connect 1.4.57 → 1.4.58
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/zuora_connect/app_instance_base.rb +31 -17
- data/lib/zuora_connect/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3fdf964f66f49e9a0a9a3307c7c945381acc0ef
|
4
|
+
data.tar.gz: de26b3ef267bc0d4ef5341a1cb2dfe6ee73450a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1bfba26eca8b56f4370496103364f33a7a4734d5bb80324e02e1d30e083b787cf3309779a50faa71eaced1aab525ae49c8eb6fcd413471099f67c3f4f299350
|
7
|
+
data.tar.gz: 008d296b0ef62b246ec8111e17c3fa725d6fd1c3775bad0736ce117c2ae6ca19f42215bb3d548a7a6fd627949f09f7b66cf281464d6f6f81b1e59d62691c6103
|
@@ -302,7 +302,7 @@ module ZuoraConnect
|
|
302
302
|
end
|
303
303
|
|
304
304
|
def new_session(session: self.data_lookup, username: self.access_token, password: self.refresh_token)
|
305
|
-
@api_version =
|
305
|
+
@api_version = "v2"
|
306
306
|
@username = username
|
307
307
|
@password = password
|
308
308
|
@last_refresh = session["#{self.id}::last_refresh"]
|
@@ -360,11 +360,7 @@ module ZuoraConnect
|
|
360
360
|
|
361
361
|
def updateOption(optionId, value)
|
362
362
|
if self.access_token && self.refresh_token
|
363
|
-
|
364
|
-
return HTTParty.get(ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/application_options/#{optionId}/edit?value=#{value}",:basic_auth => auth = {:username => self.username, :password => self.password})
|
365
|
-
else
|
366
|
-
return HTTParty.get(ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/application_options/#{optionId}/edit?value=#{value}",:body => {:access_token => self.username})
|
367
|
-
end
|
363
|
+
return HTTParty.get(ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/application_options/#{optionId}/edit?value=#{value}",:body => {:access_token => self.username})
|
368
364
|
else
|
369
365
|
return false
|
370
366
|
end
|
@@ -377,14 +373,21 @@ module ZuoraConnect
|
|
377
373
|
#This can change to another existing login
|
378
374
|
def update_logins(options)
|
379
375
|
count ||= 0
|
380
|
-
response = HTTParty.post(ZuoraConnect.configuration.url + "/api/
|
376
|
+
response = HTTParty.post(ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/tasks/#{self.id}/logins",:body => {:access_token => self.username}.merge(options))
|
381
377
|
if response.code == 200
|
382
378
|
return JSON.parse(response.body)
|
383
379
|
else
|
384
380
|
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Communicating with Connect", response.body, response.code)
|
385
381
|
end
|
386
|
-
rescue
|
387
|
-
if count < 2
|
382
|
+
rescue Net::ReadTimeout, Net::OpenTimeout, Errno::ECONNRESET, Errno::ECONNREFUSED, SocketError
|
383
|
+
if count < 2
|
384
|
+
count += 1
|
385
|
+
retry
|
386
|
+
else
|
387
|
+
raise
|
388
|
+
end
|
389
|
+
rescue ZuoraConnect::Exceptions::ConnectCommunicationError => ex
|
390
|
+
if count < 2 && ex.code == 401
|
388
391
|
self.refresh_oauth
|
389
392
|
count += 1
|
390
393
|
retry
|
@@ -396,11 +399,7 @@ module ZuoraConnect
|
|
396
399
|
def refresh(session = nil)
|
397
400
|
count ||= 0
|
398
401
|
start = Time.now
|
399
|
-
|
400
|
-
response = HTTParty.get(ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/tasks/#{self.id}.json",:basic_auth => auth = {:username => self.username, :password => self.password})
|
401
|
-
else
|
402
|
-
response = HTTParty.get(ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/tasks/#{self.id}.json",:body => {:access_token => self.access_token})
|
403
|
-
end
|
402
|
+
response = HTTParty.get(ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/tasks/#{self.id}.json",:body => {:access_token => self.access_token})
|
404
403
|
response_time = Time.now - start
|
405
404
|
|
406
405
|
Rails.logger.info("[#{self.id}] REFRESHING - Connect Request Time #{response_time.round(2).to_s}")
|
@@ -410,8 +409,15 @@ module ZuoraConnect
|
|
410
409
|
else
|
411
410
|
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Communicating with Connect", response.body, response.code)
|
412
411
|
end
|
413
|
-
rescue
|
414
|
-
if
|
412
|
+
rescue Net::ReadTimeout, Net::OpenTimeout, Errno::ECONNRESET, Errno::ECONNREFUSED, SocketError
|
413
|
+
if count < 2
|
414
|
+
count += 1
|
415
|
+
retry
|
416
|
+
else
|
417
|
+
raise
|
418
|
+
end
|
419
|
+
rescue ZuoraConnect::Exceptions::ConnectCommunicationError => ex
|
420
|
+
if count < 2 && ex.code == 401
|
415
421
|
self.refresh_oauth
|
416
422
|
count += 1
|
417
423
|
retry
|
@@ -501,7 +507,15 @@ module ZuoraConnect
|
|
501
507
|
Rails.logger.fatal("REFRESHING - OAuth Failed - Code #{response.code}")
|
502
508
|
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Refreshing Access Token", response.body, response.code)
|
503
509
|
end
|
504
|
-
|
510
|
+
|
511
|
+
rescue Net::ReadTimeout, Net::OpenTimeout, Errno::ECONNRESET, Errno::ECONNREFUSED, SocketError => ex
|
512
|
+
if count < 2
|
513
|
+
count += 1
|
514
|
+
retry
|
515
|
+
else
|
516
|
+
raise
|
517
|
+
end
|
518
|
+
rescue ZuoraConnect::Exceptions::ConnectCommunicationError => ex
|
505
519
|
if count < 3
|
506
520
|
Rails.logger.info("REFRESHING - OAuth Failed - Retrying(#{count})")
|
507
521
|
self.reload
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.58
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-session_store
|