tessitura_rest 1.1.6 → 1.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +37 -0
  3. data/.codeclimate.yml +10 -3
  4. data/.github/workflows/gem-push.yml +34 -0
  5. data/.rubocop.yml +23 -7
  6. data/lib/tessitura_rest/crm/accounts.rb +4 -3
  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 +19 -33
  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 +1 -17
  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 -3
  41. data/tessitura_rest.gemspec +17 -15
  42. metadata +24 -25
  43. data/.env.enc +0 -0
  44. data/.travis.yml +0 -7
  45. data/lib/tessitura_rest/crm/actions.rb +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6b2fcc55c832163daaada90d305305c168190bc90d8ff8320b87d16dbf5e3dd
4
- data.tar.gz: 54423f5d268a2ca8595288500edfd521c8774826279b0851b1d4331d24932645
3
+ metadata.gz: 9c40488c47b4497e72d33d34168b7df274cd940e3fa9719b4d394aab301b221c
4
+ data.tar.gz: 35d4f943fbc7372de657e3e1497f7f18e744a6ab4930ec58dcb00da28be4e32a
5
5
  SHA512:
6
- metadata.gz: fd82b97aec4322cdd20a48f1db2ed9b03611bf175d1ee376c8ab3e0dc050303f950d14d4c3668e3b3e7b67da909196d58588bd30ad2eb6341c1dc2246cf59853
7
- data.tar.gz: d2e4457f4fbedcf849b25635df5a91202621c41b25f5f881a6f5e6155be6acca84af4e0118fbc1689d2e33c07d59222c3e01ae6a22ab531102ab47090ae2bec6
6
+ metadata.gz: baa5f419a800dfeb948dc22c3619440571faa5a8a67e324532c032a7c9da0292cf57f59eb8b16878e0ee219630887b42a55081c096e92bf76748ca395db4473b
7
+ data.tar.gz: ffbbdf5ac4a3dfcb6428e2d7ae79b92f60022290eacea2655bd215ff8262ba414694473f448768fe1dac8401cbf6ea92b0f14ad8f240c38afb3f36558b6df6cf
@@ -0,0 +1,37 @@
1
+ # Use the latest 2.1 version of CircleCI pipeline process engine.
2
+ # See: https://circleci.com/docs/2.0/configuration-reference
3
+ version: 2.1
4
+ orbs:
5
+ ruby: circleci/ruby@1.4.0
6
+ # Define a job to be invoked later in a workflow.
7
+ # See: https://circleci.com/docs/2.0/configuration-reference/#jobs
8
+ jobs:
9
+ test:
10
+ docker:
11
+ - image: cimg/ruby:3.0.1-node
12
+
13
+ # Add steps to the job
14
+ # See: https://circleci.com/docs/2.0/configuration-reference/#steps
15
+
16
+ steps:
17
+ - checkout
18
+ - run:
19
+ name: Install Bundler
20
+ command: gem install bundler
21
+ - run:
22
+ name: Install Dependencies
23
+ command: bundle install
24
+ - run:
25
+ name: Decrypt Env
26
+ command: echo "$ENV_ENC" | base64 --decode > .env
27
+
28
+ - run:
29
+ name: Run tests
30
+ command: bundle exec rspec
31
+ # Invoke jobs via workflows
32
+ # See: https://circleci.com/docs/2.0/configuration-reference/#workflows
33
+ workflows:
34
+ version: 2
35
+ deploy:
36
+ jobs:
37
+ - test
data/.codeclimate.yml CHANGED
@@ -11,7 +11,7 @@ plugins:
11
11
  flog:
12
12
  enabled: true
13
13
  config:
14
- score_threshold: 20.0
14
+ score_threshold: 20.0
15
15
  haml-lint:
16
16
  enabled: false
17
17
  checks:
@@ -20,15 +20,22 @@ plugins:
20
20
  reek:
21
21
  enabled: true
22
22
  checks:
23
+ checks:
24
+ BooleanParameter:
25
+ enabled: false
26
+ DataClump:
27
+ enabled: false
23
28
  IrresponsibleModule:
24
29
  enabled: false
30
+ LongParameterList:
31
+ enabled: false
25
32
  UncommunicativeName:
26
33
  enabled: false
27
34
  UncommunicativeVariableName:
28
35
  enabled: false
29
36
  rubocop:
30
37
  enabled: true
31
- channel: rubocop-0-88
38
+ channel: rubocop-1-21-0
32
39
  stylelint:
33
40
  enabled: false
34
41
  checks:
@@ -38,5 +45,5 @@ plugins:
38
45
  enabled: false
39
46
  exclude_patterns:
40
47
  - .rubocop.yml
41
- - .rubocop_todo.yml
42
48
  - spec/**/*
49
+ - bin/*
@@ -0,0 +1,34 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ paths: [ 'lib/tessitura_rest/version.rb' ]
7
+
8
+ jobs:
9
+ build:
10
+ name: Build + Publish
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: read
14
+ packages: write
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - name: Set up Ruby 2.6
18
+ uses: actions/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.6.x
21
+
22
+ - name: Publish to RubyGems
23
+ run: |
24
+ mkdir -p $HOME/.gem
25
+ touch $HOME/.gem/credentials
26
+ chmod 0600 $HOME/.gem/credentials
27
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
28
+ gem build *.gemspec
29
+ gem push *.gem
30
+ env:
31
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
32
+
33
+ - name: Remove gem build file
34
+ run: rm *.gem
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
@@ -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,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