zuora_connect_ui 0.11.5 → 0.11.6

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: 021bce24c74c4ff3a706bbe404e74748113e736fbc03ac3ad735cfc77906373a
4
- data.tar.gz: 4f9363bb2c303f6853c31caaab9e0430d30d8f6d25de1db1a294951cdd5fb322
3
+ metadata.gz: 61cb67a239da8e4227096a1dd8cb4310fef64934a3278580d86c3c7913725084
4
+ data.tar.gz: 4d694680f26a6b83b08e18abdb77e63ae30166e9ba9dc517e7a729a362941bb8
5
5
  SHA512:
6
- metadata.gz: 5c9f86be608bfa31af25a1760bb404561a8c4b83c916dbcee248f73b9bbe19bf3749f5255037806fbdd475e18515e7f3c309c20b6bcf21aa580f2a6185610595
7
- data.tar.gz: 3b178d773ebb58252110a473dd9dcde3287e4640a2e59e6fcadaf5be4ad2ea772f84e3588d89b031c8e957b3c24464f42f60069d8aa4cfcd53a4f63870d08823
6
+ metadata.gz: 0c7f98347b0013e84c2246f2bf46ac9592520ad4bf7308ddaa4f983dd1dd2d07e4e473f4fdc9e8908ce03f7c4ed457b2109a186bca2eba4b82d716f7856ab11e
7
+ data.tar.gz: 433f3fa7deaa995b2416bd76b0ebfd6606a4087708fade38ec86a28e893e25271a4c937a53c2ca142961091569848a0a73b5eab4815be660bad6730245426145
File without changes
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,4 @@
1
+ require 'oj'
2
+
3
+ Oj.default_options = { mode: :rails }
4
+ Oj.optimize_rails()
@@ -52,10 +52,10 @@ module ZuoraConnectUi
52
52
  end
53
53
 
54
54
  def hash_for_collection
55
- hash = { data: {} }
55
+ hash = { data: { items: [] } }
56
56
 
57
- hash[:data][:items] = @resource.each_with_object([]) do |resource, items|
58
- items << record_hash(resource, @record_type)
57
+ @resource.each do |resource|
58
+ hash[:data][:items] << record_hash(resource, @record_type)
59
59
  end
60
60
 
61
61
  return hash if @associations.empty?
@@ -86,16 +86,21 @@ module ZuoraConnectUi
86
86
  end
87
87
  @associations.each do |association|
88
88
  field = association.id_method_name
89
- hash[key_transform(field)] = resource.public_send(field)
89
+ camel_key = @cache_keys[field] ||= key_transform(field)
90
+ hash[camel_key] = resource.public_send(field)
90
91
  end
91
92
  hash
92
93
  end
93
94
 
94
95
  def get_associations(resource)
95
- @associations.each_with_object({}) do |a, h|
96
+ associations = {}
97
+
98
+ @associations.each do |a|
96
99
  hash_key = key_transform(a.plural_type)
97
- h[hash_key] = a.serialize(resource, @fields[a.record_type])
100
+ associations[hash_key] = a.serialize(resource, @fields[a.record_type])
98
101
  end
102
+
103
+ associations
99
104
  end
100
105
 
101
106
  def parse_fields(fields)
@@ -17,7 +17,9 @@ module ZuoraConnectUi
17
17
  end
18
18
 
19
19
  def serialize(resources, fields)
20
- resources.each_with_object({}) do |resource, hash|
20
+ relationship_hash = {}
21
+
22
+ resources.each do |resource|
21
23
  relations = resource.public_send(key)
22
24
 
23
25
  next if relations.nil?
@@ -25,11 +27,13 @@ module ZuoraConnectUi
25
27
  relations = [relations] unless @relationship_type == :has_many
26
28
 
27
29
  relations.each do |relation|
28
- next if hash.key? relation.id.to_s.to_sym
30
+ next if relationship_hash.key? relation.id
29
31
 
30
- hash[relation.id.to_s.to_sym] = record_hash(relation, fields)
32
+ relationship_hash[relation.id] = record_hash(relation, fields)
31
33
  end
32
34
  end
35
+
36
+ relationship_hash
33
37
  end
34
38
 
35
39
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZuoraConnectUi
4
- VERSION = '0.11.5'
4
+ VERSION = '0.11.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_connect_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.5
4
+ version: 0.11.6
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-11-11 00:00:00.000000000 Z
11
+ date: 2020-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -283,8 +283,9 @@ executables: []
283
283
  extensions: []
284
284
  extra_rdoc_files: []
285
285
  files:
286
- - LICENSE.txt
286
+ - LICENSE
287
287
  - README.md
288
+ - Rakefile
288
289
  - app/assets/javascripts/zuora_connect_ui.js
289
290
  - app/assets/javascripts/zuora_connect_ui/app.js.erb
290
291
  - app/assets/javascripts/zuora_connect_ui/bundle/connect-ui.min.js
@@ -314,6 +315,7 @@ files:
314
315
  - app/views/partials/_row_actions.html.erb
315
316
  - app/views/partials/_table.html.erb
316
317
  - app/views/peek/views/_connect.html.erb
318
+ - config/initializers/oj.rb
317
319
  - lib/peek/views/connect.rb
318
320
  - lib/zuora_connect_ui.rb
319
321
  - lib/zuora_connect_ui/serializer.rb