rock_rms 7.4.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00fcdb991bdd10e04f598ef06b949b21f8886f28319fa13158bea0a67b317049
4
- data.tar.gz: c59ae3091b292e2b63e951425aa6efd5b1fb01066333e1466882530b6f2e6b92
3
+ metadata.gz: f7974e19cd0e049bd7036e12089908695a4c2f76d216749fb82654ddfeca5e3b
4
+ data.tar.gz: af53f6a8e677665833aa0a6fae87f9ba60f9461b3c8afea867f9c6b83e6bfeac
5
5
  SHA512:
6
- metadata.gz: e09f0676e739eb78ec78730c4c1b45849f7197366d72f6da2f1ccf2835d80d17e7ecd21804bca2ab06e42cb1904a0edb5d62cae87a3f0d5ad9bdf8882e8f2610
7
- data.tar.gz: e2e838149dc00208e9e59de386f7019ff1fb64a35b36f9ba5ba7e17813126ec49197b50602bcd5090f93fac0b62c97a145ac8a1d09a18849e6b087634a06583e
6
+ metadata.gz: f41059825c20226c09d0813933ace8e6a5cfed1aae11f7ce979a8ae1ed02498a40baa6b3b3df3544d495195001fb9adb1fa2ab7c62844f03724bf4fa288c0e64
7
+ data.tar.gz: edcd96028806dbbff9cb6d4022211ddbd34bd2d9b28e742ee6f7d43fe7298c75a92bf1fd5c7fd5625ee3a9a8ead50e3a9f8cb93703dd1384b04bcb31c4ecf3b7
@@ -4,7 +4,8 @@ module RockRMS
4
4
  MAP = {
5
5
  name: 'Name',
6
6
  key: 'Key',
7
- description: 'Description'
7
+ description: 'Description',
8
+ entity_type_id: 'EntityTypeId'
8
9
  }.freeze
9
10
 
10
11
  def format_single(data)
@@ -4,6 +4,7 @@ module RockRMS
4
4
  MAP = {
5
5
  value: 'Value',
6
6
  value_as_number: 'ValueAsNumeric',
7
+ value_formatted: 'ValueFormatted',
7
8
  entity_id: 'EntityId'
8
9
  }.freeze
9
10
 
@@ -6,7 +6,9 @@ module RockRMS
6
6
  BASE_MAPPING = {
7
7
  id: 'Id',
8
8
  created_date_time: 'CreatedDateTime',
9
- modified_date_time: 'ModifiedDateTime'
9
+ modified_date_time: 'ModifiedDateTime',
10
+ attributes: 'Attributes',
11
+ attribute_values: 'AttributeValues'
10
12
  }.freeze
11
13
 
12
14
  def self.format(data)
@@ -31,9 +33,22 @@ module RockRMS
31
33
  dict
32
34
  .merge(BASE_MAPPING)
33
35
  .each_with_object({}) do |(l, r), object|
34
- object[l] = data[r]
36
+ if l == :attributes || l == :attribute_values
37
+ format_klass = l == :attributes ? Attribute : AttributeValue
38
+ object[l] = format_attributes(data[r], format_klass)
39
+ else
40
+ object[l] = data[r]
41
+ end
35
42
  end
36
43
  end
44
+
45
+ def format_attributes(res, klass)
46
+ return res if res.nil?
47
+
48
+ res.each_with_object({}) do |(attr, val), object|
49
+ object[attr] = klass.format(val)
50
+ end
51
+ end
37
52
  end
38
53
  end
39
54
  end
@@ -1,3 +1,3 @@
1
1
  module RockRMS
2
- VERSION = '7.4.0'.freeze
2
+ VERSION = '8.0.0'.freeze
3
3
  end
@@ -14,7 +14,7 @@ RSpec.describe RockRMS::Response::AttributeValue, type: :model do
14
14
 
15
15
  it 'has the correct number keys' do
16
16
  keys = result.first.keys
17
- expect(keys.count).to eq(6)
17
+ expect(keys.count).to eq(8)
18
18
  end
19
19
 
20
20
  it 'translates keys' do
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe RockRMS::Response::DefinedValue, type: :model do
4
+ let(:parsed) { JSON.parse(FixturesHelper.read('defined_values.json')) }
5
+
6
+ describe '.format' do
7
+ subject(:result) { described_class.format(parsed) }
8
+
9
+ context 'when response is array' do
10
+ it 'returns an array' do
11
+ expect(described_class.format([])).to be_a(Array)
12
+ end
13
+ end
14
+
15
+ it 'has the correct number keys' do
16
+ keys = result.first.keys
17
+ expect(keys.count).to eq(9)
18
+ end
19
+
20
+ it 'translates keys' do
21
+ result.zip(parsed) do |r, p|
22
+ expect(r[:id]).to eq(p['Id'])
23
+ expect(r[:value]).to eq(p['Value'])
24
+ expect(r[:description]).to eq(p['Description'])
25
+ end
26
+ end
27
+ end
28
+ end
@@ -32,6 +32,8 @@ RSpec.describe RockRMS::Response::RecurringDonation, type: :model do
32
32
  id
33
33
  created_date_time
34
34
  modified_date_time
35
+ attributes
36
+ attribute_values
35
37
  ]
36
38
 
37
39
  expect(response.keys).to eq(expected_keys)
@@ -1,13 +1,79 @@
1
1
  [
2
-
3
- {
4
- "Guid": "36cf10d6-c695-413d-8e7c-4546efef385e",
5
- "Id": 1,
6
- "DefinedTypeId": 1,
7
- "Description": "A Person Record",
8
- "IsSystem": true,
9
- "Order": 0,
10
- "Value": "Person"
2
+ {
3
+ "Guid": "36cf10d6-c695-413d-8e7c-4546efef385e",
4
+ "Id": 1,
5
+ "DefinedTypeId": 1,
6
+ "Description": "A Person Record",
7
+ "IsSystem": true,
8
+ "Order": 0,
9
+ "Value": "Person",
10
+ "Attributes": {
11
+ "FinancialAccount": {
12
+ "Key": "FinancialAccount",
13
+ "Name": "FinancialAccount",
14
+ "Id": 10771
15
+ },
16
+ "Subaccount": {
17
+ "Key": "Subaccount",
18
+ "Name": "Subaccount",
19
+ "Id": 10772
20
+ },
21
+ "SortOrder": {
22
+ "Key": "SortOrder",
23
+ "Name": "SortOrder",
24
+ "Id": 10773
25
+ },
26
+ "MerlinWidgetKey": {
27
+ "Key": "MerlinWidgetKey",
28
+ "Name": "Merlin Widget Key",
29
+ "Id": 10813
30
+ }
31
+ },
32
+ "AttributeValues": {
33
+ "FinancialAccount": {
34
+ "AttributeId": 10771,
35
+ "EntityId": 6266,
36
+ "Value": "e6aa6cb5-3310-4c50-ba3c-6a518d57c728",
37
+ "ValueFormatted": "ABTS of CU",
38
+ "PersistedTextValue": null,
39
+ "PersistedHtmlValue": null,
40
+ "PersistedCondensedTextValue": null,
41
+ "PersistedCondensedHtmlValue": null,
42
+ "IsPersistedValueDirty": true
43
+ },
44
+ "Subaccount": {
45
+ "AttributeId": 10772,
46
+ "EntityId": 6266,
47
+ "Value": "f649378b-f71c-4706-84de-e48b23c28fc4",
48
+ "ValueFormatted": "001",
49
+ "PersistedTextValue": null,
50
+ "PersistedHtmlValue": null,
51
+ "PersistedCondensedTextValue": null,
52
+ "PersistedCondensedHtmlValue": null,
53
+ "IsPersistedValueDirty": true
54
+ },
55
+ "SortOrder": {
56
+ "AttributeId": 10773,
57
+ "EntityId": 6266,
58
+ "Value": "1",
59
+ "ValueFormatted": "1",
60
+ "PersistedTextValue": null,
61
+ "PersistedHtmlValue": null,
62
+ "PersistedCondensedTextValue": null,
63
+ "PersistedCondensedHtmlValue": null,
64
+ "IsPersistedValueDirty": true
65
+ },
66
+ "MerlinWidgetKey": {
67
+ "AttributeId": 10813,
68
+ "EntityId": 6266,
69
+ "Value": "",
70
+ "ValueFormatted": "",
71
+ "PersistedTextValue": "",
72
+ "PersistedHtmlValue": "",
73
+ "PersistedCondensedTextValue": "",
74
+ "PersistedCondensedHtmlValue": "",
75
+ "IsPersistedValueDirty": false
76
+ }
11
77
  }
12
-
78
+ }
13
79
  ]
@@ -6,7 +6,7 @@
6
6
  "Guid": "49fdc90aaabb",
7
7
  "Id": 1422,
8
8
  "AttributeValues": null,
9
- "Attributes": null,
9
+ "Attributes": {},
10
10
  "CreatedByPersonAliasId": 1,
11
11
  "CreatedDateTime": 727,
12
12
  "ModifiedAuditValuesAlreadyUpdated": false,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rock_rms
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.4.0
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Brooks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-07 00:00:00.000000000 Z
11
+ date: 2022-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -293,6 +293,7 @@ files:
293
293
  - spec/rock_rms/response/attribute_value_spec.rb
294
294
  - spec/rock_rms/response/batch_spec.rb
295
295
  - spec/rock_rms/response/campus_spec.rb
296
+ - spec/rock_rms/response/defined_value_spec.rb
296
297
  - spec/rock_rms/response/group_location_spec.rb
297
298
  - spec/rock_rms/response/group_spec.rb
298
299
  - spec/rock_rms/response/location_spec.rb