tessitura_rest 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -1
- data/.rubocop.yml +23 -7
- data/.travis.yml +1 -1
- data/lib/tessitura_rest/crm/accounts.rb +4 -3
- data/lib/tessitura_rest/crm/actions.rb +16 -18
- data/lib/tessitura_rest/crm/addresses.rb +79 -80
- data/lib/tessitura_rest/crm/attributes.rb +9 -10
- data/lib/tessitura_rest/crm/constituencies.rb +8 -9
- data/lib/tessitura_rest/crm/constituents.rb +72 -75
- data/lib/tessitura_rest/crm/issues.rb +21 -23
- data/lib/tessitura_rest/crm/phones.rb +12 -13
- data/lib/tessitura_rest/crm/web_logins.rb +2 -4
- data/lib/tessitura_rest/custom/email.rb +15 -15
- data/lib/tessitura_rest/custom/local_procedure.rb +2 -2
- data/lib/tessitura_rest/diagnostics/diagnostics.rb +2 -2
- data/lib/tessitura_rest/finance/appeals.rb +1 -2
- data/lib/tessitura_rest/finance/gift_certificates.rb +1 -2
- data/lib/tessitura_rest/reference_data/countries.rb +2 -3
- data/lib/tessitura_rest/reference_data/sections.rb +1 -2
- data/lib/tessitura_rest/reference_data/states.rb +2 -3
- data/lib/tessitura_rest/security/security_user_groups.rb +2 -3
- data/lib/tessitura_rest/txn/orders.rb +8 -11
- data/lib/tessitura_rest/txn/package.rb +11 -11
- data/lib/tessitura_rest/txn/payments.rb +1 -1
- data/lib/tessitura_rest/txn/performance_extension.rb +15 -14
- data/lib/tessitura_rest/txn/performance_package_mode_of_sales.rb +2 -4
- data/lib/tessitura_rest/txn/price_types.rb +2 -4
- data/lib/tessitura_rest/txn/product_keywords.rb +1 -3
- data/lib/tessitura_rest/txn/production_extension.rb +2 -3
- data/lib/tessitura_rest/txn/production_season.rb +3 -5
- data/lib/tessitura_rest/txn/sub_line_items.rb +4 -4
- data/lib/tessitura_rest/txn/web_contents.rb +1 -3
- data/lib/tessitura_rest/version.rb +1 -1
- data/lib/tessitura_rest/web/cart.rb +141 -143
- data/lib/tessitura_rest/web/login.rb +26 -13
- data/lib/tessitura_rest/web/payment_plan_extension.rb +18 -19
- data/lib/tessitura_rest/web/registration.rb +34 -36
- data/lib/tessitura_rest/web/session.rb +37 -38
- data/lib/tessitura_rest.rb +1 -2
- data/tessitura_rest.gemspec +17 -15
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29001154bd7cb717ba0cdf2dc395a99d7fc6dad99a362c59ee656cb83f50e07d
|
4
|
+
data.tar.gz: '084cda4d0a4019127badad64017a862d3514ce726b0aa9a3fe19f78c3ffedda2'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b27cb8a505f4c72934c5b835e794d006cfb6a7c7a1d1c1f3b4661e32673cedf988d9e3eb835b382ef06395235a66579982a30dd59fc560ec292a81aa7e9af81
|
7
|
+
data.tar.gz: 7e0c2d304a6ef951bf8234fed18c1ab439751536f2726a3450d4cea3df35ecd463913e740d43b381e6dd5cdc8401277fe597cc579c798e2456e30f1c8e411e4a
|
data/.codeclimate.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
|
1
2
|
AllCops:
|
3
|
+
NewCops: enable
|
2
4
|
Exclude:
|
3
5
|
- spec/**/*
|
6
|
+
TargetRubyVersion: 3.0.1
|
4
7
|
|
5
8
|
Naming/AccessorMethodName:
|
6
9
|
Description: Check the naming of accessor methods for get_/set_.
|
@@ -196,10 +199,10 @@ Style/LineEndConcatenation:
|
|
196
199
|
line end.
|
197
200
|
Enabled: false
|
198
201
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
202
|
+
Layout/LineLength:
|
203
|
+
Description: 'Limit lines to 80 characters.'
|
204
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
|
205
|
+
Max: 180
|
203
206
|
|
204
207
|
Metrics/MethodLength:
|
205
208
|
Description: 'Avoid methods longer than 10 lines of code.'
|
@@ -543,11 +546,24 @@ Lint/Void:
|
|
543
546
|
Description: 'Possible use of operator/literal/variable in void context.'
|
544
547
|
Enabled: false
|
545
548
|
|
546
|
-
|
547
|
-
|
548
|
-
Performance/Sample:
|
549
|
+
Style/Sample:
|
549
550
|
Description: >-
|
550
551
|
Use `sample` instead of `shuffle.first`,
|
551
552
|
`shuffle.last`, and `shuffle[Fixnum]`.
|
552
553
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
554
|
+
Enabled: false
|
555
|
+
|
556
|
+
Style/OptionHash:
|
557
|
+
Enabled: false
|
558
|
+
|
559
|
+
Style/OptionalBooleanParameter:
|
560
|
+
Enabled: false
|
561
|
+
|
562
|
+
Lint/SymbolConversion:
|
563
|
+
Enabled: false
|
564
|
+
|
565
|
+
Style/HashSyntax:
|
566
|
+
EnforcedStyle: no_mixed_keys
|
567
|
+
|
568
|
+
Naming/VariableNumber:
|
553
569
|
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module Accounts
|
2
|
-
|
3
|
-
def get_all_accounts(constituent_id, inactive=false, include_affiliate=false, options={})
|
2
|
+
def get_all_accounts(constituent_id, inactive = false, include_affiliate = false, options = {})
|
4
3
|
options.merge!(basic_auth: @auth, headers: @headers)
|
5
|
-
response = self.class.get(
|
4
|
+
response = self.class.get(
|
5
|
+
base_api_endpoint("CRM/Accounts?constituentId=#{constituent_id}&includeInactive=#{inactive}&includeAffiliates=#{include_affiliate}"), options
|
6
|
+
)
|
6
7
|
JSON.parse(response.body)
|
7
8
|
end
|
8
9
|
end
|
@@ -1,36 +1,34 @@
|
|
1
1
|
module Actions
|
2
|
-
|
3
|
-
def get_action(id, options={})
|
2
|
+
def get_action(id, options = {})
|
4
3
|
options.merge!(basic_auth: @auth, headers: @headers)
|
5
4
|
response = self.class.get(base_api_endpoint("CRM/Actions/#{id}"), options)
|
6
5
|
JSON.parse(response.body)
|
7
6
|
end
|
8
7
|
|
9
|
-
def get_actions(constituent_id, issue_id, options={})
|
8
|
+
def get_actions(constituent_id, issue_id, options = {})
|
10
9
|
options.merge!(basic_auth: @auth, headers: @headers)
|
11
10
|
response = self.class.get(base_api_endpoint("CRM/Actions?constituentId=#{constituent_id}&issueId=#{issue_id}"), options)
|
12
11
|
JSON.parse(response.body)
|
13
12
|
end
|
14
13
|
|
15
|
-
def create_action(action_type, constituent_id, issue_id, notes = '', options={})
|
14
|
+
def create_action(action_type, constituent_id, issue_id, notes = '', options = {})
|
16
15
|
parameters =
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
16
|
+
{
|
17
|
+
'ActionType': {
|
18
|
+
'Id': action_type,
|
19
|
+
},
|
20
|
+
'Issue': {
|
21
|
+
'Id': issue_id,
|
22
|
+
},
|
23
|
+
'Constituent': {
|
24
|
+
'Id': constituent_id,
|
25
|
+
},
|
26
|
+
'Notes': notes,
|
27
|
+
'Resolved': true,
|
28
|
+
}
|
30
29
|
options.merge!(basic_auth: @auth, headers: @headers)
|
31
30
|
options.merge!(:body => parameters)
|
32
31
|
response = self.class.post(base_api_endpoint('CRM/Actions'), options)
|
33
32
|
JSON.parse(response.body)
|
34
33
|
end
|
35
|
-
|
36
34
|
end
|
@@ -1,121 +1,120 @@
|
|
1
1
|
module Addresses
|
2
|
-
|
3
|
-
def get_address(address_id, options={})
|
2
|
+
def get_address(address_id, options = {})
|
4
3
|
options.merge!(basic_auth: @auth, headers: @headers)
|
5
4
|
response = self.class.get(base_api_endpoint("CRM/Addresses/#{address_id}"), options)
|
6
5
|
JSON.parse(response.body)
|
7
6
|
end
|
8
7
|
|
9
|
-
def get_all_addresses(constituent_id, options={})
|
8
|
+
def get_all_addresses(constituent_id, options = {})
|
10
9
|
options.merge!(basic_auth: @auth, headers: @headers)
|
11
10
|
response = self.class.get(base_api_endpoint("CRM/Addresses?constituentId=#{constituent_id}"), options)
|
12
11
|
JSON.parse(response.body)
|
13
12
|
end
|
14
13
|
|
15
|
-
def create_address(constituent, address_type, city, postal_code, state, country, street1, street2, primary, options={})
|
14
|
+
def create_address(constituent, address_type, city, postal_code, state, country, street1, street2, primary, options = {})
|
16
15
|
parameters =
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
16
|
+
{
|
17
|
+
'AddressType': {
|
18
|
+
'Id': address_type,
|
19
|
+
},
|
20
|
+
'City': city,
|
21
|
+
'Constituent': {
|
22
|
+
'Id': constituent,
|
23
|
+
},
|
24
|
+
'Inactive': false,
|
25
|
+
'Label': true,
|
26
|
+
'Months': 'YYYYYYYYYYYY',
|
27
|
+
'PostalCode': postal_code,
|
28
|
+
'PrimaryIndicator': primary,
|
29
|
+
'State': {
|
30
|
+
'Id': state,
|
31
|
+
'Country': {
|
32
|
+
'Id': country,
|
33
|
+
},
|
34
|
+
},
|
35
|
+
'Street1': street1,
|
36
|
+
'Street2': street2,
|
32
37
|
'Country': {
|
33
|
-
'Id': country
|
34
|
-
}
|
35
|
-
},
|
36
|
-
'Street1': street1,
|
37
|
-
'Street2': street2,
|
38
|
-
'Country': {
|
39
|
-
'Id': country
|
38
|
+
'Id': country,
|
39
|
+
},
|
40
40
|
}
|
41
|
-
}
|
42
41
|
options.merge!(basic_auth: @auth, headers: @headers)
|
43
42
|
options.merge!(:body => parameters)
|
44
|
-
response = self.class.post(base_api_endpoint(
|
43
|
+
response = self.class.post(base_api_endpoint('CRM/Addresses'), options)
|
45
44
|
JSON.parse(response.body)
|
46
45
|
end
|
47
46
|
|
48
|
-
def update_address(id, address_type, city, postal_code, state, country, street1, street2, primary, options={})
|
47
|
+
def update_address(id, address_type, city, postal_code, state, country, street1, street2, primary, options = {})
|
49
48
|
current = get_address(id)
|
50
49
|
parameters =
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
50
|
+
{
|
51
|
+
'Id': id,
|
52
|
+
'UpdatedDateTime': current['UpdatedDateTime'],
|
53
|
+
'AddressType': {
|
54
|
+
'Id': address_type,
|
55
|
+
},
|
56
|
+
'City': city,
|
57
|
+
'Constituent': {
|
58
|
+
'Id': current['Constituent']['Id'],
|
59
|
+
},
|
60
|
+
'Inactive': false,
|
61
|
+
'Label': true,
|
62
|
+
'Months': 'YYYYYYYYYYYY',
|
63
|
+
'PostalCode': postal_code,
|
64
|
+
'PrimaryIndicator': primary,
|
65
|
+
'State': {
|
66
|
+
'Id': state,
|
67
|
+
'Country': {
|
68
|
+
'Id': country,
|
69
|
+
},
|
70
|
+
},
|
71
|
+
'Street1': street1,
|
72
|
+
'Street2': street2,
|
68
73
|
'Country': {
|
69
|
-
'Id': country
|
70
|
-
}
|
71
|
-
},
|
72
|
-
'Street1': street1,
|
73
|
-
'Street2': street2,
|
74
|
-
'Country': {
|
75
|
-
'Id': country
|
74
|
+
'Id': country,
|
75
|
+
},
|
76
76
|
}
|
77
|
-
}
|
78
77
|
options.merge!(basic_auth: @auth, headers: @headers)
|
79
78
|
options.merge!(:body => parameters)
|
80
79
|
response = self.class.put(base_api_endpoint("CRM/Addresses/#{id}"), options)
|
81
80
|
JSON.parse(response.body)
|
82
81
|
end
|
83
82
|
|
84
|
-
def deactivate_address(id, options={})
|
83
|
+
def deactivate_address(id, options = {})
|
85
84
|
current = get_address(id)
|
86
85
|
parameters =
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
86
|
+
{
|
87
|
+
'Id': id,
|
88
|
+
'UpdatedDateTime': current['UpdatedDateTime'],
|
89
|
+
'AddressType': {
|
90
|
+
'Id': current['AddressType']['Id'],
|
91
|
+
},
|
92
|
+
'City': current['City'],
|
93
|
+
'Constituent': {
|
94
|
+
'Id': current['Constituent']['Id'],
|
95
|
+
},
|
96
|
+
'Inactive': true,
|
97
|
+
'Label': true,
|
98
|
+
'Months': 'YYYYYYYYYYYY',
|
99
|
+
'PostalCode': current['PostalCode'],
|
100
|
+
'State': {
|
101
|
+
'Id': current['State']['Id'],
|
102
|
+
'Country': {
|
103
|
+
'Id': current['Country']['Id'],
|
104
|
+
},
|
105
|
+
},
|
106
|
+
'Street1': current['Street1'],
|
107
|
+
'Street2': current['Street2'],
|
103
108
|
'Country': {
|
104
|
-
'Id': current['Country']['Id']
|
105
|
-
}
|
106
|
-
},
|
107
|
-
'Street1': current['Street1'],
|
108
|
-
'Street2': current['Street2'],
|
109
|
-
'Country': {
|
110
|
-
'Id': current['Country']['Id']
|
109
|
+
'Id': current['Country']['Id'],
|
110
|
+
},
|
111
111
|
}
|
112
|
-
}
|
113
112
|
options.merge!(basic_auth: @auth, headers: @headers)
|
114
113
|
options.merge!(:body => parameters)
|
115
114
|
self.class.put(base_api_endpoint("CRM/Addresses/#{id}"), options)
|
116
115
|
end
|
117
116
|
|
118
|
-
def delete_address(address_id, options={})
|
117
|
+
def delete_address(address_id, options = {})
|
119
118
|
options.merge!(basic_auth: @auth, headers: @headers)
|
120
119
|
self.class.delete(base_api_endpoint("CRM/Addresses/#{address_id}"), options)
|
121
120
|
end
|
@@ -1,16 +1,15 @@
|
|
1
1
|
module Attributes
|
2
|
-
|
3
|
-
def add_attribute(constituent_id, attribute_id, value, options={})
|
2
|
+
def add_attribute(constituent_id, attribute_id, value, options = {})
|
4
3
|
parameters =
|
5
4
|
{
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
5
|
+
'Keyword' => {
|
6
|
+
'Id' => attribute_id,
|
7
|
+
},
|
8
|
+
'Constituent' => {
|
9
|
+
'Id' => constituent_id,
|
10
|
+
},
|
11
|
+
'Value' => value,
|
12
|
+
'UpdatedDateTime' => DateTime.now.to_s,
|
14
13
|
}
|
15
14
|
options.merge!(basic_auth: @auth, headers: @headers)
|
16
15
|
options.merge!(:body => parameters)
|
@@ -1,20 +1,19 @@
|
|
1
1
|
module Constituencies
|
2
|
-
|
3
|
-
def get_constituencies(id, options={})
|
2
|
+
def get_constituencies(id, options = {})
|
4
3
|
options.merge!(basic_auth: @auth, headers: @headers)
|
5
4
|
response = self.class.get(base_api_endpoint("CRM/Constituencies?constituentId=#{id}"), options)
|
6
5
|
JSON.parse(response.body)
|
7
6
|
end
|
8
7
|
|
9
|
-
def create_constituencies(constituency, id, options={})
|
8
|
+
def create_constituencies(constituency, id, options = {})
|
10
9
|
parameters =
|
11
10
|
{
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
'ConstituencyType': {
|
12
|
+
'Id': constituency,
|
13
|
+
},
|
14
|
+
'Constituent': {
|
15
|
+
'Id': id,
|
16
|
+
},
|
18
17
|
}
|
19
18
|
options.merge!(basic_auth: @auth, headers: @headers)
|
20
19
|
options.merge!(:body => parameters)
|
@@ -1,59 +1,58 @@
|
|
1
1
|
module Constituents
|
2
|
-
|
3
|
-
def get_constituent_snapshot(id, options={})
|
2
|
+
def get_constituent_snapshot(id, options = {})
|
4
3
|
options.merge!(basic_auth: @auth, headers: @headers)
|
5
4
|
response = self.class.get(base_api_endpoint("CRM/Constituents/#{id}/Snapshot"), options)
|
6
5
|
JSON.parse(response.body)
|
7
6
|
end
|
8
7
|
|
9
|
-
def create_constituent_by_snapshot(first_name, last_name, email, phone, constituent_type, source, street1, street2, city, state, zip, country, options={})
|
8
|
+
def create_constituent_by_snapshot(first_name, last_name, email, phone, constituent_type, source, street1, street2, city, state, zip, country, options = {})
|
10
9
|
parameters =
|
11
10
|
{
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
'ConstituentType': {
|
12
|
+
'Id': constituent_type,
|
13
|
+
'Inactive': false,
|
15
14
|
},
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
'FirstName': first_name,
|
16
|
+
'LastName': last_name,
|
17
|
+
'ElectronicAddress': {
|
18
|
+
'Address': email,
|
19
|
+
'ElectronicAddressType': {
|
20
|
+
'Id': 1,
|
22
21
|
},
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
'AllowHtmlFormat': true,
|
23
|
+
'Inactive': false,
|
24
|
+
'AllowMarketing': false,
|
25
|
+
'Months': 'YYYYYYYYYYYY',
|
26
|
+
'PrimaryIndicator': true,
|
28
27
|
},
|
29
|
-
|
28
|
+
'PrimaryPhoneNumbers':
|
30
29
|
[
|
31
30
|
{
|
32
|
-
|
33
|
-
|
31
|
+
'PhoneNumber': phone,
|
32
|
+
'PhoneType':
|
34
33
|
{
|
35
|
-
|
34
|
+
'Id': 1,
|
36
35
|
},
|
37
36
|
},
|
38
37
|
],
|
39
|
-
|
40
|
-
|
38
|
+
'OriginalSource': {
|
39
|
+
'Id': source,
|
41
40
|
},
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
'Address': {
|
42
|
+
'AddressType': {
|
43
|
+
'Id': 3,
|
45
44
|
},
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
'City': city,
|
46
|
+
'PostalCode': zip,
|
47
|
+
'State': {
|
48
|
+
'Id': state,
|
50
49
|
},
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
'Street1': street1,
|
51
|
+
'Street2': street2,
|
52
|
+
'Country': {
|
53
|
+
'Id': country,
|
55
54
|
},
|
56
|
-
}
|
55
|
+
},
|
57
56
|
}
|
58
57
|
parameters.delete(:PrimaryPhoneNumbers) unless phone.present?
|
59
58
|
options.merge!(basic_auth: @auth, headers: @headers)
|
@@ -61,34 +60,34 @@ module Constituents
|
|
61
60
|
self.class.post(base_api_endpoint('CRM/Constituents/Snapshot'), options)
|
62
61
|
end
|
63
62
|
|
64
|
-
def update_constituent(constituent_id, params, options={})
|
63
|
+
def update_constituent(constituent_id, params, options = {})
|
65
64
|
current = get_constituent_snapshot(constituent_id)
|
66
65
|
if is_household?(current)
|
67
66
|
update_household(params, current)
|
68
67
|
else
|
69
68
|
parameters =
|
70
69
|
{
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
'ConstituentType': {
|
71
|
+
'Id': current['ConstituentType']['Id'],
|
72
|
+
'Inactive': false,
|
74
73
|
},
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
74
|
+
'Id': constituent_id,
|
75
|
+
'UpdatedDateTime': current['UpdatedDateTime'],
|
76
|
+
'FirstName': params[:first_name],
|
77
|
+
'LastName': params[:last_name],
|
78
|
+
'MiddleName': params[:middle_name],
|
79
|
+
'SortName': current['SortName'],
|
80
|
+
'Prefix': {
|
81
|
+
'Id': params[:prefix],
|
82
|
+
'Inactive': false,
|
84
83
|
},
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
'Suffix': {
|
85
|
+
'Id': params[:suffix],
|
86
|
+
'Inactive': false,
|
88
87
|
},
|
89
|
-
|
90
|
-
|
91
|
-
|
88
|
+
'OriginalSource': {
|
89
|
+
'Id': current['OriginalSource']['Id'],
|
90
|
+
'Inactive': false,
|
92
91
|
},
|
93
92
|
}
|
94
93
|
parameters.delete(:Prefix) unless params[:prefix].present?
|
@@ -103,33 +102,33 @@ module Constituents
|
|
103
102
|
snapshot['ConstituentType']['Id'] == 9
|
104
103
|
end
|
105
104
|
|
106
|
-
def update_household(params, current, options={})
|
107
|
-
constituents = current['Affiliates'].map{|c| c['RelatedConstituentId']}
|
105
|
+
def update_household(params, current, options = {})
|
106
|
+
constituents = current['Affiliates'].map { |c| c['RelatedConstituentId'] }
|
108
107
|
update = []
|
109
108
|
constituents.each_with_index do |constituent, i|
|
110
109
|
snapshot = get_constituent_snapshot(constituent)
|
111
110
|
parameters =
|
112
111
|
{
|
113
|
-
|
114
|
-
|
115
|
-
|
112
|
+
'ConstituentType': {
|
113
|
+
'Id': snapshot['ConstituentType']['Id'],
|
114
|
+
'Inactive': false,
|
116
115
|
},
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
116
|
+
'Id': constituent,
|
117
|
+
'FirstName': i == 0 ? params[:first_name] : params[:first_name_2],
|
118
|
+
'UpdatedDateTime': snapshot['UpdatedDateTime'],
|
119
|
+
'LastName': i == 0 ? params[:last_name] : params[:last_name_2],
|
120
|
+
'MiddleName': i == 0 ? params[:middle_name] : params[:middle_name_2],
|
121
|
+
'Prefix': {
|
122
|
+
'Id': i == 0 ? params[:prefix] : params[:prefix_2],
|
123
|
+
'Inactive': false,
|
125
124
|
},
|
126
|
-
|
127
|
-
|
128
|
-
|
125
|
+
'Suffix': {
|
126
|
+
'Id': i == 0 ? params[:suffix] : params[:suffix_2],
|
127
|
+
'Inactive': false,
|
129
128
|
},
|
130
|
-
|
131
|
-
|
132
|
-
|
129
|
+
'OriginalSource': {
|
130
|
+
'Id': snapshot['OriginalSource']['Id'],
|
131
|
+
'Inactive': false,
|
133
132
|
},
|
134
133
|
}
|
135
134
|
options.merge!(basic_auth: @auth, headers: @headers)
|
@@ -138,6 +137,4 @@ module Constituents
|
|
138
137
|
end
|
139
138
|
update.last if update.present?
|
140
139
|
end
|
141
|
-
|
142
|
-
|
143
140
|
end
|