zuora_connect 2.0.41 → 2.0.42

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
  SHA256:
3
- metadata.gz: bc48433f373e6b4ca92cfed049f2fe2a4292db788c360eff9e7a67752fd5e576
4
- data.tar.gz: 2258e1fd905e9c5ceacd83eed7a87ce4832fa69cf1466a4f82a84c296f0b62c6
3
+ metadata.gz: 7a9e773f6114368213a5c0d414998c8cdd9b02a8e666b6f2895952e99960dbd0
4
+ data.tar.gz: d400a44cb72fdce90550a4406aabc5a60890f1b5326a8f5aa9dbfa478c9578e3
5
5
  SHA512:
6
- metadata.gz: 60659892ae4e2199b66f4efa7e7ea8d882849d2104f5be16621f89cf1c31d410c0261300daf21c134f19bcf46a423cbc358a37676bd864d7fbee740cb58eb734
7
- data.tar.gz: 8a2ddb96860a86ccf6b667b62cde4663222c54855bd8f3737db1da0333e455a0025dcca94f9b9f2d78d04bcd3a4da4ca3bf0bbb7e88ba57c9538800ab475336f
6
+ metadata.gz: c9139ea5852684e0ecbd7e5aa4e60f2cd1995fbf3977f06839c5ee68746c3d1f64d0f35625e0f202d1284d9723c44a5c0a3d69a67b0a885cf057e78f5eefa758
7
+ data.tar.gz: 1f6864370b8d59caf0691c929349aaac0317a7c2332a9842a15442d0ab141d441d24d984abd44afd0e39cfe9c560b3a246150aceced9969f45db7cbfa3dab110
@@ -19,6 +19,7 @@ module ZuoraConnect
19
19
  API_LIMIT_TIMEOUT = 2.minutes #Used to set the default for expiring timeout when api rate limiting is in effect
20
20
  BLANK_OBJECT_ID_LOOKUP = 'BlankValueSupplied'
21
21
  HOLDING_PATTERN_SLEEP = 5.seconds
22
+ CONNECT_APPLICATION_ID = 0
22
23
  CONNECT_COMMUNICATION_SLEEP= 5.seconds
23
24
  IGNORED_LOCALS = ['fr', 'ja', 'es', 'zh', 'de']
24
25
  INTERNAL_HOSTS = []
@@ -562,6 +563,45 @@ module ZuoraConnect
562
563
  end
563
564
  end
564
565
 
566
+ def fetch_org_details(debug: false)
567
+ details_count ||= 0
568
+ self.new_session if !defined?(self.target_login)
569
+
570
+ response = HTTParty.get("#{ZuoraConnect.configuration.url}/api/#{self.api_version}/tenants/search?hostname=#{self.target_login.client.hostname}&node_id=#{self.zuora_entity_ids.first}")
571
+
572
+ if response.success?
573
+ parsed_json = JSON.parse(response.body)
574
+
575
+ #Set Org
576
+ if self.id >= 25000000 && parsed_json['organization'].blank?
577
+ self.zuora_logins = self.zuora_logins.merge({'organization' => [parsed_json['organization']]})
578
+ end
579
+ if defined?(ZuoraConnect::AppInstance::CONNECT_APPLICATION_ID)
580
+ downloads = parsed_json.fetch('downloads',[]).select{|a| a['applicationId'] == ZuoraConnect::AppInstance::CONNECT_APPLICATION_ID }.map { |h| h.slice('Name', 'provisionState') }
581
+ Rails.logger.info("Instance Downloads: #{downloads.to_s}") if debug
582
+ if downloads.size > 1
583
+ self.provision_status = 'MultipleProvisioningRecords'
584
+ self.provisioned_app = downloads.map {|d| d['Name']}.to_s
585
+ elsif downloads.size == 1
586
+ self.provision_status = downloads.first['provisionState']
587
+ self.provisioned_app = downloads.first['Name']
588
+ else
589
+ self.provision_status = 'NoProvisioningRecords'
590
+ self.provisioned_app = nil
591
+ end
592
+ end
593
+ self.save(:validate => false)
594
+
595
+ return parsed_json
596
+ end
597
+ rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS + ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
598
+ if (details_count += 1) < 3
599
+ retry
600
+ else
601
+ raise
602
+ end
603
+ end
604
+
565
605
  def update_task(options)
566
606
  update_task_count ||= 0
567
607
  response = HTTParty.post(ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/tasks/#{self.id}/update_task",:body => {:access_token => self.username}.merge(options))
@@ -0,0 +1,6 @@
1
+ class AddProvisioningFields < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :zuora_connect_app_instances, :provision_status, :text, default: "NoProvisioningRecords" unless column_exists? :zuora_connect_app_instances, :provision_status
4
+ add_column :zuora_connect_app_instances, :provisioned_app, :text, default: nil unless column_exists? :zuora_connect_app_instances, :provisioned_app
5
+ end
6
+ end
@@ -261,13 +261,6 @@ module ZuoraConnect
261
261
  zuora_instance_id = nil
262
262
  zuora_details["identity"]["entityId"] = identity['entityId']
263
263
 
264
- client_describe, response = zuora_client.rest_call(
265
- url: zuora_client.rest_endpoint("genesis/user/info").gsub('v1/', ''),
266
- session_type: zuora_client.class == ZuoraAPI::Oauth ? :bearer : :basic,
267
- headers: auth_headers
268
- )
269
- session["ZuoraCurrentUserInfo"] = client_describe
270
-
271
264
  if zuora_entity_id != identity['entityId']
272
265
  if zuora_tenant_id.to_s == "10548"
273
266
  render "zuora_connect/static/error_handled", :locals => {
@@ -279,6 +272,13 @@ module ZuoraConnect
279
272
  raise ZuoraConnect::Exceptions::Error.new("Header entity id does not match identity call entity id.")
280
273
  end
281
274
  end
275
+
276
+ client_describe, response = zuora_client.rest_call(
277
+ url: zuora_client.rest_endpoint("genesis/user/info").gsub('v1/', ''),
278
+ session_type: zuora_client.class == ZuoraAPI::Oauth ? :bearer : :basic,
279
+ headers: auth_headers
280
+ )
281
+ session["ZuoraCurrentUserInfo"] = client_describe
282
282
  end
283
283
 
284
284
  #Find matching app instances.
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "2.0.41"
2
+ VERSION = "2.0.42"
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: 2.0.41
4
+ version: 2.0.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-27 00:00:00.000000000 Z
11
+ date: 2020-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment
@@ -337,6 +337,7 @@ files:
337
337
  - db/migrate/20181206162339_add_fields_to_instance.rb
338
338
  - db/migrate/20190520232221_add_zuora_user_table_and_alter_app_instance_id_table.rb
339
339
  - db/migrate/20190520232222_add_unique_index.rb
340
+ - db/migrate/20190520232223_add_provisioning_fields.rb
340
341
  - lib/logging/connect_formatter.rb
341
342
  - lib/metrics/influx/point_value.rb
342
343
  - lib/metrics/net.rb