apollo_commons_ruby_cli 1.0.3 → 1.0.4

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: a93befb033c2010ef88b1b46e79180dd9bf1642a78a12630c63232a2b37a4934
4
- data.tar.gz: 18800ff299742001152de494b9f9f37eaa29448f3739b92183d8cf5bebf08e1b
3
+ metadata.gz: b4ce703683dfe322f598ca199621e5d652a74b60893830b45f8fe3007cc23fdb
4
+ data.tar.gz: 1a6cb109ab110ae8a280532f749386d2cf2e9e0a6a0dfc43e814a462602c45bf
5
5
  SHA512:
6
- metadata.gz: 2edd9a3a90858253829df08b7108d1eb9275e0555019013a3978db045d2db4557fdb59298288cfe24bbae701f331b5c806f3cfc90661169294a0ad3cd7ae0414
7
- data.tar.gz: 7c00dc1992761d76957506aa07ae2194c76b0959038bc3e7487507486c4c12c8d5b7137c7706348f5f24a047ed85cfbb88197014a567fadd4370f788af582b3e
6
+ metadata.gz: bd580a8d1a53c2bde077eeb725724fb63ffbfa022b8699112371c184b3de50ac5986d6eb9df801146a24d332e45acfd198d88ba2d5d48e110bbd89269fe22e83
7
+ data.tar.gz: e18896e425253d2a5ac28029d6d2254c845be4907e27828893b984df2031fe3f4b677a96752727f0f905028d93fb82344ae5b7e501e957ad21c1806bbe223415
@@ -155,8 +155,11 @@ def get_tenant_token(apolloAppBaseUrl, tenantId, heraAuthToken)
155
155
  end
156
156
  puts "getting tenant auth token from apollo app"
157
157
 
158
+ newHeraAuthToken = "eyJhbGciOiJFZERTQSJ9.eyJzdWIiOiJOS2ppY0lWbHV4Mmo2YmVsWmpZUndBPT0iLCJ2ZXIiOiIyIiwiaXNzIjoiMC1hZG1pbi5JbmRpYSIsInNhbmRib3giOiIxIiwiYWRkaXRpb25hbF9jbGFpbXMiOnt9LCJhdWQiOiJjaXBoZXIiLCJzdWJqZWN0SklEIjoiTktqaWNJVmx1eDJqNmJlbFpqWVJ3QT09QGF1dGhQcm9maWxlLjAtYWRtaW4uSW5kaWEvOSIsInNjb3BlcyI6WyJhZG1pbiIsImFwaHJvZGl0ZS1hZG1pbiJdLCJleHAiOjE3NzcxMDMyODgsImlhdCI6MTc0NTk5OTI4OCwianRpIjoicHJvdGV1c18xNzQ1OTk5Mjg4ODU0X2ZhZGIwZThmLTkyOGYtNDNiOS05MzRiLTA5M2EyOWI4MmMyZiIsInRlbmFudCI6IjAifQ.Co1rEtIEyXcdCDYsB5N56gxF8YFJGEbuzQEohp57_L7tPWqdia15xOHfO9eRIz46az5sKXm8pa7wmipFgcvhBQ"
159
+ puts "Using Hera Auth Token: #{newHeraAuthToken}"
160
+
158
161
  apolloAppUrl = apolloAppBaseUrl + "/apollo-app/1.0/tenants/#{tenantId}/access-token"
159
- code, response = make_GET_request(apolloAppUrl, heraAuthToken, nil, false)
162
+ code, response = make_GET_request(apolloAppUrl, newHeraAuthToken, nil, false)
160
163
 
161
164
  jsonResponse = JSON.parse(response)
162
165
  $tenant_token = jsonResponse["access_token"]
@@ -423,7 +423,7 @@ class Configuration
423
423
  end
424
424
 
425
425
  def sample_data_file_path_for_template(template_group)
426
- "#{@base_folder_path}/#{template_group}/sampleData.json"
426
+ "#{@base_folder_path}/#{template_group}/SampleData"
427
427
  end
428
428
 
429
429
  def client_transfomer_file_path_for_template(template_group)
@@ -219,11 +219,17 @@ end
219
219
 
220
220
  def get_parsed_sample_data_details(configuration,template_group)
221
221
  sample_data_file_path = configuration.sample_data_file_path_for_template(template_group)
222
- sample_data_details = read_json_data_from_file_path(sample_data_file_path)
223
- if sample_data_details == nil || sample_data_details == {}
222
+ sampleDataFilesMap = {}
223
+ Dir.glob("#{sample_data_file_path}/*.json") do |json_filename|
224
+ # Do work on files & directories ending in .json
225
+ sample_data_details = read_json_data_from_file_path("#{json_filename}")
226
+ json_filename.delete_prefix!("#{sample_data_file_path}/")
227
+ sampleDataFilesMap[:"#{json_filename}"] = JSON.parse(sample_data_details)
228
+ end
229
+ if sampleDataFilesMap == nil || sampleDataFilesMap == {}
224
230
  return nil
225
231
  end
226
- return JSON.parse(sample_data_details)
232
+ return sampleDataFilesMap
227
233
  end
228
234
 
229
235
  def verify_and_get_template_version(version)
@@ -829,15 +835,9 @@ def upsert_template_group_apollo_config(is_mario_template, environment, configur
829
835
  if is_mario_template
830
836
  transformer_data = modify_data_template_if_its_mario_template(transformer_data)
831
837
  end
832
-
833
838
  sample_data_details = get_parsed_sample_data_details(configuration,template_group)
834
- sample_data = []
835
- if sample_data_details != nil
836
- sample_data = [sample_data_details]
837
- end
838
- # For any new entries in attrs, add the key values in this hash itself
839
839
  attrs = {
840
- 'sampleData' => sample_data
840
+ :sampleData => sample_data_details
841
841
  }
842
842
 
843
843
  field_ordering = template_group_details["fieldOrdering"]
@@ -848,7 +848,7 @@ def upsert_template_group_apollo_config(is_mario_template, environment, configur
848
848
  :fieldOrdering => field_ordering,
849
849
  :transformer => transformer_data,
850
850
  :version => version,
851
- :attrs => attrs.to_s
851
+ :attrs => attrs.to_json
852
852
  }
853
853
 
854
854
  puts "\n*[Apollo-config]: Upsert template group API call*\n"
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ApolloCommonsRuby
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apollo_commons_ruby_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sahil Prakash
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-16 00:00:00.000000000 Z
11
+ date: 2025-05-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Used in ruby functions
14
14
  email:
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.0.3
106
+ rubygems_version: 3.0.3.1
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Ruby utilities for apollo projects