eligible 2.9.7 → 3.1.0.beta6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +77 -0
  3. data/.gitignore +1 -0
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.md +279 -0
  6. data/Gemfile +4 -0
  7. data/Gemfile.lock +66 -0
  8. data/README.md +21 -1
  9. data/eligible.gemspec +7 -5
  10. data/lib/eligible/api_resource.rb +27 -6
  11. data/lib/eligible/calculator_deploy_url.rb +2 -2
  12. data/lib/eligible/claim.rb +10 -10
  13. data/lib/eligible/coverage.rb +8 -4
  14. data/lib/eligible/coverage_resource.rb +4 -4
  15. data/lib/eligible/customer.rb +8 -8
  16. data/lib/eligible/encryptor.rb +1 -1
  17. data/lib/eligible/enrollment.rb +8 -8
  18. data/lib/eligible/errors/eligible_error.rb +2 -1
  19. data/lib/eligible/icd.rb +16 -0
  20. data/lib/eligible/lockbox.rb +6 -6
  21. data/lib/eligible/oauth_token.rb +9 -0
  22. data/lib/eligible/ocr.rb +2 -2
  23. data/lib/eligible/original_signature_pdf.rb +12 -10
  24. data/lib/eligible/payer.rb +6 -6
  25. data/lib/eligible/payer_mapping.rb +37 -0
  26. data/lib/eligible/payment.rb +4 -4
  27. data/lib/eligible/preauth_resource.rb +4 -4
  28. data/lib/eligible/precert.rb +2 -2
  29. data/lib/eligible/provider_model.rb +2 -2
  30. data/lib/eligible/public_key.rb +8 -8
  31. data/lib/eligible/received_pdf.rb +6 -4
  32. data/lib/eligible/risk_assessment.rb +8 -4
  33. data/lib/eligible/session_token.rb +4 -4
  34. data/lib/eligible/ticket.rb +12 -12
  35. data/lib/eligible/util.rb +3 -3
  36. data/lib/eligible/v1_0/action.rb +9 -0
  37. data/lib/eligible/v1_0/attribute.rb +9 -0
  38. data/lib/eligible/v1_0/balance_capture.rb +21 -0
  39. data/lib/eligible/v1_0/charge.rb +13 -0
  40. data/lib/eligible/v1_0/claim.rb +25 -0
  41. data/lib/eligible/v1_0/claim_service_line.rb +9 -0
  42. data/lib/eligible/v1_0/contract.rb +9 -0
  43. data/lib/eligible/v1_0/device.rb +9 -0
  44. data/lib/eligible/v1_0/discount.rb +9 -0
  45. data/lib/eligible/v1_0/enrollment.rb +17 -0
  46. data/lib/eligible/v1_0/estimate.rb +29 -0
  47. data/lib/eligible/v1_0/estimate_service_line.rb +17 -0
  48. data/lib/eligible/v1_0/fee.rb +21 -0
  49. data/lib/eligible/v1_0/fee_refund.rb +29 -0
  50. data/lib/eligible/v1_0/file.rb +17 -0
  51. data/lib/eligible/v1_0/file_link.rb +13 -0
  52. data/lib/eligible/v1_0/insurance_company.rb +21 -0
  53. data/lib/eligible/v1_0/insurance_company_alias.rb +9 -0
  54. data/lib/eligible/v1_0/insurance_policy.rb +9 -0
  55. data/lib/eligible/v1_0/patient_question.rb +9 -0
  56. data/lib/eligible/v1_0/patient_questionnaire.rb +9 -0
  57. data/lib/eligible/v1_0/patient_record.rb +9 -0
  58. data/lib/eligible/v1_0/patient_statement.rb +59 -0
  59. data/lib/eligible/v1_0/patient_statement_service_line.rb +13 -0
  60. data/lib/eligible/v1_0/payment_report.rb +21 -0
  61. data/lib/eligible/v1_0/product.rb +9 -0
  62. data/lib/eligible/v1_0/provider.rb +9 -0
  63. data/lib/eligible/v1_0/refund.rb +21 -0
  64. data/lib/eligible/v1_0/remark.rb +21 -0
  65. data/lib/eligible/v1_0/rest_api_base.rb +44 -0
  66. data/lib/eligible/v1_0/rule.rb +13 -0
  67. data/lib/eligible/v1_0/session.rb +21 -0
  68. data/lib/eligible/v1_0/transaction.rb +21 -0
  69. data/lib/eligible/v1_0/treatment.rb +9 -0
  70. data/lib/eligible/v1_0/value_list.rb +9 -0
  71. data/lib/eligible/v1_0/value_list_item.rb +9 -0
  72. data/lib/eligible/v1_0/verification.rb +17 -0
  73. data/lib/eligible/version.rb +1 -1
  74. data/lib/eligible/visit_type.rb +4 -4
  75. data/lib/eligible/x12.rb +2 -2
  76. data/lib/eligible.rb +152 -35
  77. metadata +76 -22
  78. data/ChangeLog +0 -131
  79. data/circle.yml +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2087c29cc24d66520e062147815be9c32f09b1a3e76a905ad77a4d8b4a7681e4
4
- data.tar.gz: df283017a8695462eb04e145f8449d3f5a3839588e50bd720dfc79c8593329c2
3
+ metadata.gz: 145a555cc5bba94da162aef31cfc32fb38d74e5c5d17a7fc20087e6f3e4b850e
4
+ data.tar.gz: eb5e4667d021445c248787a50df412ed819fea457a0baa24fdf1148a09e71185
5
5
  SHA512:
6
- metadata.gz: 9474825a03bef36d6872d7f1b150411ffc98802943da910f2efabadd74fd92f1c957f84d0a94bbd900b6d32d0f67c590fab1b01b8a27fa6ef256f10f229f2ee1
7
- data.tar.gz: 23189dc4ecc8c27314881b97782e4217276d53f4c74e06b84174387e16ccc7d67c02320cd42fa47fa8dcef8905e918fb0ebd68e71b18a58cc5ab1f2b27ff6e23
6
+ metadata.gz: f68c403164019c78cb8441b412c2033cfa1c0ca9df2a0c88cf0480abaea1ff1b72b31da059b6139556562acc8b853af228c87350a7dcd6448ff42ce6fee599a9
7
+ data.tar.gz: c83d145ce338fac86389d60661bc3cc233f56c1a93fb0856b19d9f768c9299bdd60aa83c18664a90c383cd89aba07a076f7313e219e93290cc127401ecdcda20
@@ -0,0 +1,77 @@
1
+ version: 2
2
+ default_environment: &default_environment
3
+ docker:
4
+ - image: cimg/ruby:3.1.0
5
+ environment:
6
+ BUNDLE_JOBS: 3
7
+ BUNDLE_RETRY: 3
8
+ BUNDLE_PATH: vendor/bundle
9
+ RAILS_ENV: test
10
+ CC_TEST_REPORTER_ID: 1a814ffba15f437df919868f6c26f3c6ac111338b88f9a9d7e2b3030598bccdd
11
+ working_directory: ~/eligible-ruby
12
+
13
+ aliases:
14
+ # Bundle install dependencies
15
+ - &bundle_install
16
+ name: Bundle Install
17
+ command: bundle check || (bundle install --deployment && bundle clean) # Stop growing cache
18
+ - &save_bundle_cache
19
+ key: gems-{{ .Environment.CACHE_VERSION }}-{{ checksum "Gemfile.lock" }}
20
+ paths:
21
+ - vendor/bundle
22
+ - /usr/local/bundle/config
23
+ - &restore_bundle_cache
24
+ keys:
25
+ - gems-{{ .Environment.CACHE_VERSION }}-{{ checksum "Gemfile.lock" }}
26
+ - gems-{{ .Environment.CACHE_VERSION }}- # Fallback to any recent cache
27
+
28
+ - &pre_build
29
+ name: Pre build
30
+ command: ./cc-test-reporter before-build
31
+
32
+ # Setup CC
33
+ - &setup_cc_test_reporter
34
+ name: Setup CodeClimate test reporter
35
+ command: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter &&
36
+ chmod +x cc-test-reporter
37
+
38
+ # Code Climate coverage
39
+ - &upload_coverage
40
+ name: Upload coverage report to CodeClimate
41
+ command: |
42
+ ./cc-test-reporter sum-coverage --output - coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -
43
+
44
+ # Running RSpec
45
+ - &run_rspec
46
+ name: Run RSpec
47
+ command: |
48
+ ./cc-test-reporter before-build
49
+ bundle exec rspec
50
+
51
+ jobs:
52
+ tests:
53
+ <<: *default_environment
54
+ parallelism: 2
55
+ steps:
56
+ - checkout
57
+ - run: ruby --version
58
+
59
+ - restore_cache: *restore_bundle_cache
60
+ - run: *bundle_install
61
+ - save_cache: *save_bundle_cache
62
+
63
+ # Setup CC
64
+ - run: *setup_cc_test_reporter
65
+
66
+ # Run specs in parallel
67
+ - run: *run_rspec
68
+ - run:
69
+ name: Code Climate Test Coverage
70
+ command: |
71
+ ./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
72
+ - run: *upload_coverage
73
+ workflows:
74
+ version: 2
75
+ test:
76
+ jobs:
77
+ - tests
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/tmp
17
17
  test/version_tmp
18
18
  tmp
19
19
  .idea
20
+ .DS_Store
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.3
1
+ 3.1.0
data/CHANGELOG.md ADDED
@@ -0,0 +1,279 @@
1
+ # Changelog
2
+ ## 3.1.0.beta6 - 2026-01-15
3
+
4
+ - Updated pinned GDS SSL certificate
5
+
6
+ ## 3.1.0.beta5 - 2025-01-20
7
+
8
+ - Updated pinned GDS SSL certificate
9
+
10
+ ## 3.1.0.beta4 - 2025-01-15
11
+
12
+ - Updated pinned GDS SSL certificate
13
+
14
+ ## 3.1.0.beta3 - 2024-01-16
15
+
16
+ - Updated pinned GDS SSL certificate
17
+
18
+ ## 3.1.0.beta2 - 2023-01-16
19
+
20
+ - Updated pinned GDS SSL certificate
21
+
22
+ ## 3.1.0.beta1 - 2022-09-12
23
+
24
+ - Added support of ruby 3.1
25
+
26
+ ## 3.0.0.beta28 - 2022-02-07
27
+
28
+ - Updated pinned GDS SSL certificate
29
+
30
+ ## 3.0.0.beta27 - 2021-09-23
31
+
32
+ - Updated pinned api.eligible.com certificate
33
+
34
+ ## 3.0.0.beta26 - 2021-05-12
35
+
36
+ - Updated pinned GDS SSL certificate for Staging
37
+
38
+ ## 3.0.0.beta25 - 2021-04-12
39
+
40
+ - Updated pinned GDS SSL certificate
41
+
42
+ ## 3.0.0.beta24 - 2021-04-01
43
+
44
+ - Updated pinned GDS SSL certificate
45
+
46
+ ## 3.0.0.beta23 - 2020-11-13
47
+
48
+ - Bug fixes
49
+
50
+ ## 3.0.0.beta22 - 2020-10-21
51
+
52
+ - Bug fixes
53
+
54
+ ## 3.0.0.beta21 - 2020-10-21
55
+
56
+ - Add post method for CE API to avoid 414 error with large X12 inputs
57
+
58
+ ## 3.0.0.beta20 - 2020-08-17
59
+
60
+ - Bug fixes
61
+
62
+ ## 3.0.0.beta19 - 2020-07-28
63
+
64
+ - Added refunds and balance_captures REST API endpoints
65
+
66
+ ## 3.0.0.beta18 - 2020-07-24
67
+
68
+ - Added claim_submit endpoint API url for PatientStatement endpoint
69
+
70
+ ## 3.0.0.beta17 - 2020-07-13
71
+
72
+ - Bug fixes
73
+
74
+ ## 3.0.0.beta16 - 2020-07-10
75
+
76
+ - Migrated "Patient" endpoint to "PatientRecord"
77
+
78
+ ## 3.0.0.beta15 - 2020-06-12
79
+
80
+ - Added support for patient questionnaire, patient questions API endpoints
81
+
82
+ ## 3.0.0.beta14 - 2020-06-08
83
+
84
+ - Added Fee and FeeRefund new REST API endpoints
85
+
86
+ ## 3.0.0.beta13 - 2020-06-05
87
+
88
+ - Added create, update, delete and validate endpoints support for rules
89
+
90
+ ## 3.0.0.beta12 - 2020-05-12
91
+
92
+ - Updated pinned GDS SSL certificate
93
+
94
+ ## 3.0.0.beta11 - 2020-05-12
95
+
96
+ - Added summary and escalate actions for Enrollments endpoint
97
+ - Added Action endpoint
98
+ - Added Attribute endpoint
99
+ - Added Claim endpoint
100
+ - Added ClaimServiceLine endpoint
101
+ - Added Device endpoint
102
+ - Added Discount endpoint
103
+ - Renamed FileObject to File in order to kept consistency
104
+ - Added FileLink endpoint
105
+ - Added InsuranceCompanyAlias endpoint
106
+ - Added PaymentReport endpoint
107
+ - Added Remark endpoint
108
+ - Added Rule endpoint
109
+ - Added Session endpoint
110
+ - Added Transaction endpoint
111
+ - Added ValueList endpoint
112
+ - Added ValueListItem endpoint
113
+ - Added Verification endpoint
114
+ - Updated Charge endpoint to raise exception on delete action
115
+ - Updated Estimate endpoint, raise exception on update and delete actions, and added missing actions process, reestimate, convert
116
+ - Update EstimateServiceLine endpoint to raise exception on update and delete actions
117
+ - Updated InsuranceCompany endpoint to raise exception on delete action
118
+
119
+ ## 3.0.0.beta10 - 2020-05-06
120
+
121
+ - Added support for new REST API endpoints "Contract, Enrollment, Provider"
122
+ - Added support delete operations on new API.
123
+
124
+ ## 3.0.0.beta9 - 2020-05-04
125
+
126
+ - Added support for new REST API endpoints "Charge, Estimate, EstimateServiceLine, Product, Treatment"
127
+
128
+ ## 3.0.0.beta8 - 2020-04-30
129
+
130
+ - Fixed payment and payment_reports API urls for new PatientStatement endpoint
131
+
132
+ ## 3.0.0.beta7 - 2020-04-16
133
+
134
+ - Removed un-wanted parameters from the API request while making calls to new REST API endpoint
135
+
136
+ ## 3.0.0.beta6 - 2020-04-08
137
+
138
+ - Bug fix for "PatientStatement" endpoint
139
+
140
+ ## 3.0.0.beta5 - 2020-03-31
141
+
142
+ - Added support for new REST API endpoints "Insurance Company, Insurance Policy, Patient"
143
+
144
+ ## 3.0.0.beta4 - 2020-03-16
145
+
146
+ - Fixed query params conversion to support Expand feature for new REST API Endpoints
147
+ - Changed new REST API endpoints format to support `ID` field or `params`
148
+
149
+ ## 3.0.0.beta3 - 2020-03-09
150
+
151
+ - Added support for new REST API endpoint "PatientStatement" and "PatientStatementServiceLine"
152
+
153
+ ## 3.0.0.beta2 - 2020-03-03
154
+
155
+ - Added support for V1.0 REST API endpoints and added Files endpoints
156
+ - Update pinned api.eligible.com and wildcard.eligible.com certificate
157
+
158
+ ## 3.0.0.beta1 - 2019-10-01
159
+
160
+ - Added support for Eligible-Account Header in the API requests when used Eligible Connect feature
161
+
162
+ ## 2.9.9 - 2019-08-07
163
+
164
+ - Added Icd code endpoints
165
+
166
+ ## 2.9.8 - 2019-06-24
167
+
168
+ - Added an endpoint to fetch Risk Assessment
169
+
170
+ ## 2.9.7 - 2019-03-08
171
+
172
+ - Updated GDS SSL certificate
173
+
174
+ ## 2.9.6 - 2018-07-17
175
+
176
+ - Added Risk Assessment endpoints
177
+
178
+ ## 2.9.5 - 2018-07-06
179
+
180
+ - Added Mix and Match support for coverage requests
181
+
182
+ ## 2.9.4 - 2018-04-25
183
+
184
+ - Rename endpoint provider_detail to provider_model
185
+
186
+ ## 2.9.3 - 2018-04-19
187
+
188
+ - Added new endpoints visit types, provider details
189
+
190
+ ## 2.9.2 - 2018-03-26
191
+
192
+ - We can use session token or api_key for making a Eligible Call
193
+ - for session token supported endpoints
194
+
195
+ ## 2.9.0 - 2017-10-04
196
+
197
+ - Adding revoke functionality for session tokens
198
+
199
+ ## 2.8.2 - 2017-03-24
200
+
201
+ - Upgraded internal rest-client dependency to 2.0.0 and higher
202
+
203
+ ## 2.8.1 - 2017-02-23
204
+
205
+ - Upgraded internal rest-client dependency to 2.0.1
206
+ - Fixes mime-type dependency issue with newer Rails projects
207
+
208
+ ## 2.8.0 - 2017-02-23
209
+
210
+ - Added support for session tokens
211
+
212
+ ## 2.7.0 - 2016-12-14
213
+
214
+ - Changed default content type to application/json
215
+
216
+ ## 2.6.3 - 2016-11-18
217
+
218
+ - Added a new certificate fingerprint
219
+
220
+ ## 2.6.2 - 2016-08-31
221
+
222
+ - New APIs added in testing mode, no public-facing changes
223
+
224
+ ## 2.6.1 - 2016-05-10
225
+
226
+ - Suppressing ssl_verify_callback return code warning
227
+ - Added new endpoints: received_pdf, precert and referral
228
+ - Refactored the code and fixed couple of bugs
229
+ - Documentation updates for the endpoints
230
+
231
+ ## 2.6.0 - 2016-02-23
232
+
233
+ - Added new endpoints customer, original signature pdf, and payer.
234
+ - Added specs
235
+ - Bumped api version to 1.5
236
+ - Fixed few bugs
237
+
238
+ ## 2.5.0 - 2016-01-07
239
+
240
+ - Added certificate pinning
241
+ - Added rubocop and fixed style/linting/metrics issues
242
+ - Migrated from outdated test-unit/mocha to current rspec for test suite
243
+
244
+ ## 2.4
245
+
246
+ - Refactoring Code
247
+ - More test cases
248
+ - Removed legacy endpoint for _plans_, _coverage_ should be used instead.
249
+ - Removed legacy endpoint for _services_, _coverage_ should be used instead.
250
+ - List of contributors and documentation updated.
251
+ - Gemfile updated, dependencies updated as well.
252
+ - Removed json gem in favor of multi_json
253
+ - Fixed the code to let the users make x12 requests at anytime.
254
+ - New endpoint for Tickets
255
+
256
+ ## 2.3
257
+
258
+ - New endpoint for Batch
259
+
260
+ ## 2.2
261
+
262
+ - New endpoint for x12 POST
263
+
264
+ ## 2.1
265
+
266
+ - New endpoint for payment status
267
+
268
+ ## 2.0
269
+
270
+ - Additional endpoints for claims, enrollments, and coverage
271
+
272
+ ## 1.1
273
+
274
+ - Additional endpoints for service/general and service/list
275
+ - Support x12 format in params
276
+
277
+ ## 1.0
278
+
279
+ - Initial release
data/Gemfile CHANGED
@@ -1,4 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ # cut patch number off the version number and lock it down to the minor version
4
+ ruby_version = File.read(File.expand_path('.ruby-version', __dir__)).chomp.split('.')[0..1].join('.')
5
+ ruby "~> #{ruby_version}"
6
+
3
7
  # Specify your gem's dependencies in eligible.gemspec
4
8
  gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,66 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ eligible (3.1.0.beta6)
5
+ multi_json (~> 1.15.0)
6
+ rest-client (~> 2.1.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ diff-lcs (1.5.0)
12
+ docile (1.4.0)
13
+ domain_name (0.6.20240107)
14
+ http-accept (1.7.0)
15
+ http-cookie (1.1.0)
16
+ domain_name (~> 0.5)
17
+ logger (1.7.0)
18
+ mime-types (3.7.0)
19
+ logger
20
+ mime-types-data (~> 3.2025, >= 3.2025.0507)
21
+ mime-types-data (3.2025.0924)
22
+ multi_json (1.15.0)
23
+ netrc (0.11.0)
24
+ rake (13.0.6)
25
+ rest-client (2.1.0)
26
+ http-accept (>= 1.7.0, < 2.0)
27
+ http-cookie (>= 1.0.2, < 2.0)
28
+ mime-types (>= 1.16, < 4.0)
29
+ netrc (~> 0.8)
30
+ rspec (3.11.0)
31
+ rspec-core (~> 3.11.0)
32
+ rspec-expectations (~> 3.11.0)
33
+ rspec-mocks (~> 3.11.0)
34
+ rspec-core (3.11.0)
35
+ rspec-support (~> 3.11.0)
36
+ rspec-expectations (3.11.1)
37
+ diff-lcs (>= 1.2.0, < 2.0)
38
+ rspec-support (~> 3.11.0)
39
+ rspec-mocks (3.11.1)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.11.0)
42
+ rspec-support (3.11.0)
43
+ rspec_junit_formatter (0.5.1)
44
+ rspec-core (>= 2, < 4, != 2.12.0)
45
+ simplecov (0.21.2)
46
+ docile (~> 1.1)
47
+ simplecov-html (~> 0.11)
48
+ simplecov_json_formatter (~> 0.1)
49
+ simplecov-html (0.12.3)
50
+ simplecov_json_formatter (0.1.4)
51
+
52
+ PLATFORMS
53
+ ruby
54
+
55
+ DEPENDENCIES
56
+ eligible!
57
+ rake (~> 13.0.6)
58
+ rspec (~> 3.11.0)
59
+ rspec_junit_formatter (~> 0.5.1)
60
+ simplecov (~> 0.21.2)
61
+
62
+ RUBY VERSION
63
+ ruby 3.1.0p0
64
+
65
+ BUNDLED WITH
66
+ 2.1.4
data/README.md CHANGED
@@ -1,9 +1,29 @@
1
1
  # Eligible
2
2
 
3
- [![Circle CI](https://circleci.com/gh/eligible/eligible-ruby.svg?style=svg)](https://circleci.com/gh/eligible/eligible-ruby) [![Code Climate](https://codeclimate.com/github/eligible/eligible-ruby/badges/gpa.svg)](https://codeclimate.com/github/eligible/eligible-ruby)
3
+ [![CircleCI](https://circleci.com/gh/eligible/eligible-ruby/tree/master.svg?style=svg&circle-token=2217025edb5af2901121d277f96ace65dc47f306)](https://circleci.com/gh/eligible/eligible-ruby/tree/master)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/d86aadd0f6670a2548d8/maintainability)](https://codeclimate.com/repos/56cca689c952c60085003f10/maintainability)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/d86aadd0f6670a2548d8/test_coverage)](https://codeclimate.com/repos/56cca689c952c60085003f10/test_coverage)
4
6
 
5
7
  Ruby bindings for the [Eligible API](https://eligible.com/rest)
6
8
 
9
+ ### IMPORTANT NOTES
10
+
11
+ We are maintaining two active branches for `eligible` gem
12
+
13
+ #### 1. `master` branch
14
+
15
+ 1. It has the following two additional changes when compared with the `releasev2` branch
16
+ * Support for V1 API (Eligible objects such as Patients, Insurance Policies, Verification, etc.)
17
+ * Support for Ruby 3.1.0
18
+ 2. Eligible apps (for example, GDS, Patients, etc.) are using gem versions published from this branch.
19
+ 3. Do not merge/rebase these changes with the `releasev2` branch directly without performing proper testing because this branch has breaking changes(for example, it may not work with Ruby 2.X.X)
20
+
21
+ #### 2. `releasev2` branch
22
+
23
+ 1. Eligible customers are using gem versions published from this branch.
24
+ 2. Whenever we rotate SSL keys, we update fingerprints and force our customers to upgrade the `eligible` gem. So When you make changes to the branch, ensure those changes do not break existing customers.
25
+
26
+
7
27
  ## Installation
8
28
 
9
29
  Add this line to your application's Gemfile:
data/eligible.gemspec CHANGED
@@ -15,11 +15,13 @@ Gem::Specification.new do |gem|
15
15
 
16
16
  gem.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
17
  gem.require_paths = ['lib']
18
+ gem.required_ruby_version = '>= 3.1.0'
18
19
 
19
- gem.add_dependency('rest-client', '~> 2.0.0')
20
- gem.add_dependency('multi_json', '~> 1.7')
20
+ gem.add_dependency('rest-client', '~> 2.1.0')
21
+ gem.add_dependency('multi_json', '~> 1.15.0')
21
22
 
22
- gem.add_development_dependency('rake', '~> 12.0')
23
- gem.add_development_dependency('rspec', '~> 3.4')
24
- gem.add_development_dependency('simplecov', '~> 0.11')
23
+ gem.add_development_dependency('rake', '~> 13.0.6')
24
+ gem.add_development_dependency('rspec', '~> 3.11.0')
25
+ gem.add_development_dependency('rspec_junit_formatter', '~> 0.5.1')
26
+ gem.add_development_dependency('simplecov', '~> 0.21.2')
25
27
  end
@@ -6,10 +6,10 @@ module Eligible
6
6
 
7
7
  def self.api_url(base, params = nil, param_id = nil)
8
8
  if params.nil?
9
- "/#{base}.json"
9
+ "/#{base}"
10
10
  else
11
11
  id = Util.value(params, param_id)
12
- "/#{base}/#{id}.json"
12
+ "/#{base}/#{id}"
13
13
  end
14
14
  end
15
15
 
@@ -20,18 +20,39 @@ module Eligible
20
20
  "/#{CGI.escape(class_name.downcase)}/"
21
21
  end
22
22
 
23
+ def self.endpoint_name
24
+ self.const_get('ENDPOINT_NAME')
25
+ end
26
+
23
27
  def self.require_param(value, name)
24
28
  fail ArgumentError, "#{name} of the #{class_name} is required" if value.nil? || (value.is_a?(String) && value.empty?)
25
29
  end
26
30
 
27
- def self.send_request(method, url, api_key, params, required_param_name = nil)
28
- unless required_param_name.nil?
31
+ def self.required_param_validation(params:, required_params:)
32
+ return if required_params.nil? || !required_params.is_a?(Array)
33
+
34
+ required_params.each do |required_param_name|
29
35
  required_param = Util.value(params, required_param_name)
30
36
  require_param(required_param, required_param_name)
31
37
  end
32
- response, api_key = Eligible.request(method, url, api_key, params)
33
- Util.convert_to_eligible_object(response, api_key)
34
38
  end
35
39
 
40
+ def self.rest_api_params(id_or_params)
41
+ id_or_params.is_a?(Hash) ? id_or_params : { id: id_or_params }
42
+ end
43
+
44
+ def self.send_request(method, url, params, opts = {})
45
+ headers = opts.clone
46
+ client_secret = headers.delete(:client_secret)
47
+ api_key = headers.delete(:api_key)
48
+ api_key = client_secret unless client_secret.nil?
49
+
50
+ required_param_validation(params: params, required_params: headers.delete(:required_params))
51
+
52
+ # Here rest_api_version is related to New REST API Endpoints
53
+ params = self.const_defined?(:REST_API_VERSION) ? params.merge(rest_api_version: self::REST_API_VERSION) : params
54
+ response, api_key = Eligible.request(method, url, api_key, params, **headers)
55
+ Util.convert_to_eligible_object(response, api_key)
56
+ end
36
57
  end
37
58
  end
@@ -1,7 +1,7 @@
1
1
  module Eligible
2
2
  class CalculatorDeployUrl < APIResource
3
- def self.fetch_or_create(params, api_key = nil)
4
- send_request(:get, '/calculator_deploy_urls.json', api_key, params)
3
+ def self.fetch_or_create(params, opts = {})
4
+ send_request :get, '/calculator_deploy_urls.json', params, **opts
5
5
  end
6
6
  end
7
7
  end
@@ -1,28 +1,28 @@
1
1
  module Eligible
2
2
  class Claim < APIResource
3
- def self.ack(params, api_key = nil)
3
+ def self.ack(params, opts = {})
4
4
  reference_id = Util.value(params, :reference_id)
5
- send_request(:get, "/claims/#{reference_id}/acknowledgements.json", api_key, params, :reference_id)
5
+ send_request :get, "/claims/#{reference_id}/acknowledgements.json", params, **opts.merge(required_params: [:reference_id])
6
6
  end
7
7
 
8
- def self.post(params, api_key = nil)
9
- send_request(:post, '/claims.json', api_key, params)
8
+ def self.post(params, opts = {})
9
+ send_request :post, '/claims.json', params, **opts
10
10
  end
11
11
 
12
- def self.acks(params, api_key = nil)
13
- send_request(:get, '/claims/acknowledgements.json', api_key, params)
12
+ def self.acks(params, opts = {})
13
+ send_request :get, '/claims/acknowledgements.json', params, **opts
14
14
  end
15
15
 
16
- def self.payment_report(params, api_key = nil)
16
+ def self.payment_report(params, opts = {})
17
17
  reference_id = Util.value(params, :reference_id)
18
18
  require_param(reference_id, 'Reference id')
19
19
  id = Util.value(params, :id)
20
20
  url = id.nil? ? "/claims/#{reference_id}/payment_reports" : "/claims/#{reference_id}/payment_reports/#{id}"
21
- send_request(:get, url, api_key, params)
21
+ send_request :get, url, params, **opts
22
22
  end
23
23
 
24
- def self.payment_reports(params, api_key = nil)
25
- send_request(:get, '/claims/payment_reports.json', api_key, params)
24
+ def self.payment_reports(params, opts = {})
25
+ send_request :get, '/claims/payment_reports.json', params, **opts
26
26
  end
27
27
  end
28
28
  end
@@ -8,12 +8,16 @@ module Eligible
8
8
  return '/coverage/all/batch.json'
9
9
  end
10
10
 
11
- def self.cost_estimate(params, api_key = nil)
12
- send_request(:get, '/coverage/cost_estimates.json', api_key, params)
11
+ def self.cost_estimate(params, opts = {})
12
+ send_request :get, '/coverage/cost_estimates.json', params, **opts
13
13
  end
14
14
 
15
- def self.batch_medicare_post(params, api_key = nil)
16
- send_request(:post, '/medicare/coverage/batch.json', api_key, params)
15
+ def self.cost_estimate_post(params, opts = {})
16
+ send_request :post, '/coverage/cost_estimates.json', params, **opts
17
+ end
18
+
19
+ def self.batch_medicare_post(params, opts = {})
20
+ send_request :post, '/medicare/coverage/batch.json', params, **opts
17
21
  end
18
22
  end
19
23
  end
@@ -1,11 +1,11 @@
1
1
  module Eligible
2
2
  class CoverageResource < APIResource
3
- def self.get(params, api_key = nil)
4
- send_request(:get, get_uri, api_key, params)
3
+ def self.get(params, opts = {})
4
+ send_request :get, get_uri, params, **opts
5
5
  end
6
6
 
7
- def self.post(params, api_key = nil)
8
- send_request(:post, post_uri, api_key, params)
7
+ def self.post(params, opts = {})
8
+ send_request :post, post_uri, params, **opts
9
9
  end
10
10
 
11
11
  def self.get_uri
@@ -1,19 +1,19 @@
1
1
  module Eligible
2
2
  class Customer < APIResource
3
- def self.get(params, api_key = nil)
4
- send_request(:get, api_url('customers', params, :customer_id), api_key, params, :customer_id)
3
+ def self.get(params, opts = {})
4
+ send_request :get, api_url('customers', params, :customer_id), params, **opts.merge(required_params: [:customer_id])
5
5
  end
6
6
 
7
- def self.post(params, api_key = nil)
8
- send_request(:post, api_url('customers'), api_key, params)
7
+ def self.post(params, opts = {})
8
+ send_request :post, api_url('customers'), params, **opts
9
9
  end
10
10
 
11
- def self.update(params, api_key = nil)
12
- send_request(:put, api_url('customers', params, :customer_id), api_key, params, :customer_id)
11
+ def self.update(params, opts = {})
12
+ send_request :put, api_url('customers', params, :customer_id), params, **opts.merge(required_params: [:customer_id])
13
13
  end
14
14
 
15
- def self.all(params, api_key = nil)
16
- send_request(:get, api_url('customers'), api_key, params)
15
+ def self.all(params, opts = {})
16
+ send_request :get, api_url('customers'), params, **opts
17
17
  end
18
18
  end
19
19
  end