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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +1 -1
  3. data/.rubocop.yml +23 -7
  4. data/.travis.yml +1 -1
  5. data/lib/tessitura_rest/crm/accounts.rb +4 -3
  6. data/lib/tessitura_rest/crm/actions.rb +16 -18
  7. data/lib/tessitura_rest/crm/addresses.rb +79 -80
  8. data/lib/tessitura_rest/crm/attributes.rb +9 -10
  9. data/lib/tessitura_rest/crm/constituencies.rb +8 -9
  10. data/lib/tessitura_rest/crm/constituents.rb +72 -75
  11. data/lib/tessitura_rest/crm/issues.rb +21 -23
  12. data/lib/tessitura_rest/crm/phones.rb +12 -13
  13. data/lib/tessitura_rest/crm/web_logins.rb +2 -4
  14. data/lib/tessitura_rest/custom/email.rb +15 -15
  15. data/lib/tessitura_rest/custom/local_procedure.rb +2 -2
  16. data/lib/tessitura_rest/diagnostics/diagnostics.rb +2 -2
  17. data/lib/tessitura_rest/finance/appeals.rb +1 -2
  18. data/lib/tessitura_rest/finance/gift_certificates.rb +1 -2
  19. data/lib/tessitura_rest/reference_data/countries.rb +2 -3
  20. data/lib/tessitura_rest/reference_data/sections.rb +1 -2
  21. data/lib/tessitura_rest/reference_data/states.rb +2 -3
  22. data/lib/tessitura_rest/security/security_user_groups.rb +2 -3
  23. data/lib/tessitura_rest/txn/orders.rb +8 -11
  24. data/lib/tessitura_rest/txn/package.rb +11 -11
  25. data/lib/tessitura_rest/txn/payments.rb +1 -1
  26. data/lib/tessitura_rest/txn/performance_extension.rb +15 -14
  27. data/lib/tessitura_rest/txn/performance_package_mode_of_sales.rb +2 -4
  28. data/lib/tessitura_rest/txn/price_types.rb +2 -4
  29. data/lib/tessitura_rest/txn/product_keywords.rb +1 -3
  30. data/lib/tessitura_rest/txn/production_extension.rb +2 -3
  31. data/lib/tessitura_rest/txn/production_season.rb +3 -5
  32. data/lib/tessitura_rest/txn/sub_line_items.rb +4 -4
  33. data/lib/tessitura_rest/txn/web_contents.rb +1 -3
  34. data/lib/tessitura_rest/version.rb +1 -1
  35. data/lib/tessitura_rest/web/cart.rb +141 -143
  36. data/lib/tessitura_rest/web/login.rb +26 -13
  37. data/lib/tessitura_rest/web/payment_plan_extension.rb +18 -19
  38. data/lib/tessitura_rest/web/registration.rb +34 -36
  39. data/lib/tessitura_rest/web/session.rb +37 -38
  40. data/lib/tessitura_rest.rb +1 -2
  41. data/tessitura_rest.gemspec +17 -15
  42. metadata +19 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6b2fcc55c832163daaada90d305305c168190bc90d8ff8320b87d16dbf5e3dd
4
- data.tar.gz: 54423f5d268a2ca8595288500edfd521c8774826279b0851b1d4331d24932645
3
+ metadata.gz: 29001154bd7cb717ba0cdf2dc395a99d7fc6dad99a362c59ee656cb83f50e07d
4
+ data.tar.gz: '084cda4d0a4019127badad64017a862d3514ce726b0aa9a3fe19f78c3ffedda2'
5
5
  SHA512:
6
- metadata.gz: fd82b97aec4322cdd20a48f1db2ed9b03611bf175d1ee376c8ab3e0dc050303f950d14d4c3668e3b3e7b67da909196d58588bd30ad2eb6341c1dc2246cf59853
7
- data.tar.gz: d2e4457f4fbedcf849b25635df5a91202621c41b25f5f881a6f5e6155be6acca84af4e0118fbc1689d2e33c07d59222c3e01ae6a22ab531102ab47090ae2bec6
6
+ metadata.gz: 3b27cb8a505f4c72934c5b835e794d006cfb6a7c7a1d1c1f3b4661e32673cedf988d9e3eb835b382ef06395235a66579982a30dd59fc560ec292a81aa7e9af81
7
+ data.tar.gz: 7e0c2d304a6ef951bf8234fed18c1ab439751536f2726a3450d4cea3df35ecd463913e740d43b381e6dd5cdc8401277fe597cc579c798e2456e30f1c8e411e4a
data/.codeclimate.yml CHANGED
@@ -28,7 +28,7 @@ plugins:
28
28
  enabled: false
29
29
  rubocop:
30
30
  enabled: true
31
- channel: rubocop-0-88
31
+ channel: rubocop-1-21-0
32
32
  stylelint:
33
33
  enabled: false
34
34
  checks:
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
- # Metrics/LineLength:
200
- # Description: 'Limit lines to 80 characters.'
201
- # StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
202
- # Max: 80
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
- # Performance
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,7 +1,7 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.5.3
4
+ - 2.6.3
5
5
  before_install:
6
6
  - gem install bundler -v 2.2.15
7
7
  - openssl aes-256-cbc -K $encrypted_3c84dcdc6bbe_key -iv $encrypted_3c84dcdc6bbe_iv -in .env.enc -out .env -d
@@ -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(base_api_endpoint("CRM/Accounts?constituentId=#{constituent_id}&includeInactive=#{inactive}&includeAffiliates=#{include_affiliate}"), options)
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
- 'ActionType': {
19
- 'Id': action_type
20
- },
21
- 'Issue': {
22
- 'Id': issue_id
23
- },
24
- 'Constituent': {
25
- 'Id': constituent_id
26
- },
27
- 'Notes': notes,
28
- 'Resolved': true,
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
- 'AddressType': {
19
- 'Id': address_type
20
- },
21
- 'City': city,
22
- 'Constituent': {
23
- 'Id': constituent
24
- },
25
- 'Inactive': false,
26
- 'Label': true,
27
- 'Months': 'YYYYYYYYYYYY',
28
- 'PostalCode': postal_code,
29
- 'PrimaryIndicator': primary,
30
- 'State': {
31
- 'Id': state,
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("CRM/Addresses"), options)
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
- 'Id': id,
53
- 'UpdatedDateTime': current['UpdatedDateTime'],
54
- 'AddressType': {
55
- 'Id': address_type
56
- },
57
- 'City': city,
58
- 'Constituent': {
59
- 'Id': current['Constituent']['Id']
60
- },
61
- 'Inactive': false,
62
- 'Label': true,
63
- 'Months': 'YYYYYYYYYYYY',
64
- 'PostalCode': postal_code,
65
- 'PrimaryIndicator': primary,
66
- 'State': {
67
- 'Id': state,
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
- 'Id': id,
89
- 'UpdatedDateTime': current['UpdatedDateTime'],
90
- 'AddressType': {
91
- 'Id': current['AddressType']['Id']
92
- },
93
- 'City': current['City'],
94
- 'Constituent': {
95
- 'Id': current['Constituent']['Id']
96
- },
97
- 'Inactive': true,
98
- 'Label': true,
99
- 'Months': 'YYYYYYYYYYYY',
100
- 'PostalCode': current['PostalCode'],
101
- 'State': {
102
- 'Id': current['State']['Id'],
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
- 'Keyword' => {
7
- 'Id'=> attribute_id
8
- },
9
- 'Constituent'=> {
10
- 'Id'=> constituent_id
11
- },
12
- 'Value'=> value,
13
- 'UpdatedDateTime'=> DateTime.now.to_s
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
- 'ConstituencyType': {
13
- 'Id': constituency
14
- },
15
- 'Constituent': {
16
- 'Id': id
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
- "ConstituentType": {
13
- "Id": constituent_type,
14
- "Inactive": false,
11
+ 'ConstituentType': {
12
+ 'Id': constituent_type,
13
+ 'Inactive': false,
15
14
  },
16
- "FirstName": first_name,
17
- "LastName": last_name,
18
- "ElectronicAddress": {
19
- "Address": email,
20
- "ElectronicAddressType": {
21
- "Id": 1,
15
+ 'FirstName': first_name,
16
+ 'LastName': last_name,
17
+ 'ElectronicAddress': {
18
+ 'Address': email,
19
+ 'ElectronicAddressType': {
20
+ 'Id': 1,
22
21
  },
23
- "AllowHtmlFormat": true,
24
- "Inactive": false,
25
- "AllowMarketing": false,
26
- "Months": 'YYYYYYYYYYYY',
27
- "PrimaryIndicator": true,
22
+ 'AllowHtmlFormat': true,
23
+ 'Inactive': false,
24
+ 'AllowMarketing': false,
25
+ 'Months': 'YYYYYYYYYYYY',
26
+ 'PrimaryIndicator': true,
28
27
  },
29
- "PrimaryPhoneNumbers":
28
+ 'PrimaryPhoneNumbers':
30
29
  [
31
30
  {
32
- "PhoneNumber": phone,
33
- "PhoneType":
31
+ 'PhoneNumber': phone,
32
+ 'PhoneType':
34
33
  {
35
- "Id": 1
34
+ 'Id': 1,
36
35
  },
37
36
  },
38
37
  ],
39
- "OriginalSource": {
40
- "Id": source,
38
+ 'OriginalSource': {
39
+ 'Id': source,
41
40
  },
42
- "Address": {
43
- "AddressType": {
44
- "Id": 3,
41
+ 'Address': {
42
+ 'AddressType': {
43
+ 'Id': 3,
45
44
  },
46
- "City": city,
47
- "PostalCode": zip,
48
- "State": {
49
- "Id": state,
45
+ 'City': city,
46
+ 'PostalCode': zip,
47
+ 'State': {
48
+ 'Id': state,
50
49
  },
51
- "Street1": street1,
52
- "Street2": street2,
53
- "Country": {
54
- "Id": country,
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
- "ConstituentType": {
72
- "Id": current['ConstituentType']['Id'],
73
- "Inactive": false,
70
+ 'ConstituentType': {
71
+ 'Id': current['ConstituentType']['Id'],
72
+ 'Inactive': false,
74
73
  },
75
- "Id": constituent_id,
76
- "UpdatedDateTime": current['UpdatedDateTime'],
77
- "FirstName": params[:first_name],
78
- "LastName": params[:last_name],
79
- "MiddleName": params[:middle_name],
80
- "SortName": current['SortName'],
81
- "Prefix": {
82
- "Id": params[:prefix],
83
- "Inactive": false
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
- "Suffix": {
86
- "Id": params[:suffix],
87
- "Inactive": false
84
+ 'Suffix': {
85
+ 'Id': params[:suffix],
86
+ 'Inactive': false,
88
87
  },
89
- "OriginalSource": {
90
- "Id": current['OriginalSource']['Id'],
91
- "Inactive": false
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
- "ConstituentType": {
114
- "Id": snapshot['ConstituentType']['Id'],
115
- "Inactive": false,
112
+ 'ConstituentType': {
113
+ 'Id': snapshot['ConstituentType']['Id'],
114
+ 'Inactive': false,
116
115
  },
117
- "Id": constituent,
118
- "FirstName": i == 0 ? params[:first_name] : params[:first_name_2],
119
- "UpdatedDateTime": snapshot['UpdatedDateTime'],
120
- "LastName": i == 0 ? params[:last_name] : params[:last_name_2],
121
- "MiddleName": i == 0 ? params[:middle_name] : params[:middle_name_2],
122
- "Prefix": {
123
- "Id": i == 0 ? params[:prefix] : params[:prefix_2],
124
- "Inactive": false
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
- "Suffix": {
127
- "Id": i == 0 ? params[:suffix] : params[:suffix_2],
128
- "Inactive": false
125
+ 'Suffix': {
126
+ 'Id': i == 0 ? params[:suffix] : params[:suffix_2],
127
+ 'Inactive': false,
129
128
  },
130
- "OriginalSource": {
131
- "Id": snapshot['OriginalSource']['Id'],
132
- "Inactive": false
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