zuora_connect 1.4.57 → 1.4.58

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: a8bad9c8e35e2ce96888b415c7654892db2ee7cb
4
- data.tar.gz: 60f5c4ef8fdbc0ce8d8d0918ae69dc44729e8f37
3
+ metadata.gz: f3fdf964f66f49e9a0a9a3307c7c945381acc0ef
4
+ data.tar.gz: de26b3ef267bc0d4ef5341a1cb2dfe6ee73450a8
5
5
  SHA512:
6
- metadata.gz: a1ceef9d2802520ad5991ebda7fbbf2279671c463ba2d14fa87e05dd7e4bca225c7cdaa200b770a9e891831a57b62df066625b1bf254a1bd318c779e7f7258ad
7
- data.tar.gz: 97a90aaf22ea1c09dc858a7d7311a79d25d5d915fc9f0cf37d0075e7a9a3a8082fdac8bc0d366fc77a93f8af7e41db37867de863ba32b6bd1cbdf98d7c0d20cb
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 = (username.include?("@") ? "v1" : "v2")
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
- if self.api_version == "v1"
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/v2/tools/tasks/#{self.id}/logins",:body => {:access_token => self.username}.merge(options))
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 && response.code == 401
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
- if self.api_version == "v1"
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 self.api_version == "v2" && count < 2 && response.code == 401
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
- rescue
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
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "1.4.57"
2
+ VERSION = "1.4.58"
3
3
  end
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.57
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-24 00:00:00.000000000 Z
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