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 +4 -4
- data/lib/rock_rms/response/attribute.rb +2 -1
- data/lib/rock_rms/response/attribute_value.rb +1 -0
- data/lib/rock_rms/response/base.rb +17 -2
- data/lib/rock_rms/version.rb +1 -1
- data/spec/rock_rms/response/attribute_value_spec.rb +1 -1
- data/spec/rock_rms/response/defined_value_spec.rb +28 -0
- data/spec/rock_rms/response/recurring_donation_spec.rb +2 -0
- data/spec/support/fixtures/defined_values.json +76 -10
- data/spec/support/fixtures/transactions.json +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7974e19cd0e049bd7036e12089908695a4c2f76d216749fb82654ddfeca5e3b
|
4
|
+
data.tar.gz: af53f6a8e677665833aa0a6fae87f9ba60f9461b3c8afea867f9c6b83e6bfeac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f41059825c20226c09d0813933ace8e6a5cfed1aae11f7ce979a8ae1ed02498a40baa6b3b3df3544d495195001fb9adb1fa2ab7c62844f03724bf4fa288c0e64
|
7
|
+
data.tar.gz: edcd96028806dbbff9cb6d4022211ddbd34bd2d9b28e742ee6f7d43fe7298c75a92bf1fd5c7fd5625ee3a9a8ead50e3a9f8cb93703dd1384b04bcb31c4ecf3b7
|
@@ -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
|
-
|
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
|
data/lib/rock_rms/version.rb
CHANGED
@@ -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
|
@@ -1,13 +1,79 @@
|
|
1
1
|
[
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
]
|
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:
|
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-
|
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
|