eligible 3.0.0 → 3.1.0.beta1

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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +1 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +101 -11
  5. data/Gemfile +4 -0
  6. data/Gemfile.lock +13 -6
  7. data/README.md +51 -54
  8. data/eligible.gemspec +2 -1
  9. data/lib/eligible/api_resource.rb +27 -6
  10. data/lib/eligible/calculator_deploy_url.rb +2 -2
  11. data/lib/eligible/claim.rb +10 -10
  12. data/lib/eligible/coverage.rb +8 -4
  13. data/lib/eligible/coverage_resource.rb +4 -4
  14. data/lib/eligible/customer.rb +8 -8
  15. data/lib/eligible/encryptor.rb +1 -1
  16. data/lib/eligible/enrollment.rb +8 -8
  17. data/lib/eligible/errors/eligible_error.rb +2 -1
  18. data/lib/eligible/icd.rb +6 -6
  19. data/lib/eligible/lockbox.rb +6 -6
  20. data/lib/eligible/oauth_token.rb +9 -0
  21. data/lib/eligible/ocr.rb +2 -2
  22. data/lib/eligible/original_signature_pdf.rb +12 -10
  23. data/lib/eligible/payer.rb +6 -6
  24. data/lib/eligible/payer_mapping.rb +37 -0
  25. data/lib/eligible/payment.rb +4 -4
  26. data/lib/eligible/preauth_resource.rb +4 -4
  27. data/lib/eligible/precert.rb +2 -2
  28. data/lib/eligible/provider_model.rb +2 -2
  29. data/lib/eligible/public_key.rb +8 -8
  30. data/lib/eligible/received_pdf.rb +6 -4
  31. data/lib/eligible/risk_assessment.rb +6 -6
  32. data/lib/eligible/session_token.rb +4 -4
  33. data/lib/eligible/ticket.rb +12 -12
  34. data/lib/eligible/util.rb +2 -2
  35. data/lib/eligible/v1_0/action.rb +9 -0
  36. data/lib/eligible/v1_0/attribute.rb +9 -0
  37. data/lib/eligible/v1_0/balance_capture.rb +21 -0
  38. data/lib/eligible/v1_0/charge.rb +13 -0
  39. data/lib/eligible/v1_0/claim.rb +25 -0
  40. data/lib/eligible/v1_0/claim_service_line.rb +9 -0
  41. data/lib/eligible/v1_0/contract.rb +9 -0
  42. data/lib/eligible/v1_0/device.rb +9 -0
  43. data/lib/eligible/v1_0/discount.rb +9 -0
  44. data/lib/eligible/v1_0/enrollment.rb +17 -0
  45. data/lib/eligible/v1_0/estimate.rb +29 -0
  46. data/lib/eligible/v1_0/estimate_service_line.rb +17 -0
  47. data/lib/eligible/v1_0/fee.rb +21 -0
  48. data/lib/eligible/v1_0/fee_refund.rb +29 -0
  49. data/lib/eligible/v1_0/file.rb +17 -0
  50. data/lib/eligible/v1_0/file_link.rb +13 -0
  51. data/lib/eligible/v1_0/insurance_company.rb +21 -0
  52. data/lib/eligible/v1_0/insurance_company_alias.rb +9 -0
  53. data/lib/eligible/v1_0/insurance_policy.rb +9 -0
  54. data/lib/eligible/v1_0/patient_question.rb +9 -0
  55. data/lib/eligible/v1_0/patient_questionnaire.rb +9 -0
  56. data/lib/eligible/v1_0/patient_record.rb +9 -0
  57. data/lib/eligible/v1_0/patient_statement.rb +59 -0
  58. data/lib/eligible/v1_0/patient_statement_service_line.rb +13 -0
  59. data/lib/eligible/v1_0/payment_report.rb +21 -0
  60. data/lib/eligible/v1_0/product.rb +9 -0
  61. data/lib/eligible/v1_0/provider.rb +9 -0
  62. data/lib/eligible/v1_0/refund.rb +21 -0
  63. data/lib/eligible/v1_0/remark.rb +21 -0
  64. data/lib/eligible/v1_0/rest_api_base.rb +44 -0
  65. data/lib/eligible/v1_0/rule.rb +13 -0
  66. data/lib/eligible/v1_0/session.rb +21 -0
  67. data/lib/eligible/v1_0/transaction.rb +21 -0
  68. data/lib/eligible/v1_0/treatment.rb +9 -0
  69. data/lib/eligible/v1_0/value_list.rb +9 -0
  70. data/lib/eligible/v1_0/value_list_item.rb +9 -0
  71. data/lib/eligible/v1_0/verification.rb +17 -0
  72. data/lib/eligible/version.rb +1 -1
  73. data/lib/eligible/visit_type.rb +4 -4
  74. data/lib/eligible/x12.rb +2 -2
  75. data/lib/eligible.rb +150 -38
  76. metadata +47 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0da7714383e0531eae08e29fddaef4723a40de320e5788af1fe3b4720e82a5d6
4
- data.tar.gz: c7974c3752355d4812881fb64c13e31f28debc4e04d2b7ec374b8557bf328cab
3
+ metadata.gz: 3aeb6336ce4a8b2bd31afea5fc7fddde359ab52f922e91a2015ecf870388e5ae
4
+ data.tar.gz: 022fb21e622e9031f946da58dc466648fe8a0c941078982167d8f9223fd569ef
5
5
  SHA512:
6
- metadata.gz: d6d06d5316800d32f1cdbe30dbc127bae4c0a60b4bd6da639beceb3958fbe55ef0e6ab2e8ab2dd8747fd32e5e791d743918379d91cf986ac9d84ccae15ad4191
7
- data.tar.gz: 067ba3f72873f361edcedfa1c4137e2d04fd9fbe2169f40d26d3d1caeffb2fc0e7eec8e7c2d991e1b516908f1224714dba72474840bec86477460ab6b808a37d
6
+ metadata.gz: a9be55e34f6d5c70fa2ee8afb258987f650a04ef9b55cb37e9a2029662d139a8113db4bcad0d0d2fd4c4eca883111fe92ac7d0f78228e3377cd08d09fb16f39f
7
+ data.tar.gz: e29564e5e491c774141fe6663bddc9d5f0b9591e4d958cb4125514fd5dd2020bb62e07d8ad19f1589d55fe714fa5426be05c08d3e47f2140ff4798663c53f16f
data/.circleci/config.yml CHANGED
@@ -54,6 +54,7 @@ jobs:
54
54
  parallelism: 2
55
55
  steps:
56
56
  - checkout
57
+ - run: ruby --version
57
58
 
58
59
  - restore_cache: *restore_bundle_cache
59
60
  - run: *bundle_install
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/tmp
17
17
  test/version_tmp
18
18
  tmp
19
19
  .idea
20
+ .DS_Store
data/CHANGELOG.md CHANGED
@@ -1,25 +1,115 @@
1
1
  # Changelog
2
- ## 3.0.0 - 2024-01-17
3
- - Add support for ruby 3 versions
2
+ ## 3.1.0.beta1 - 2022-09-12
3
+ - Added support of ruby 3.1
4
4
 
5
- ## 2.9.15 - 2024-01-11
5
+ ## 3.0.0.beta28 - 2022-02-07
6
6
  - Updated pinned GDS SSL certificate
7
7
 
8
- ## 2.9.14 - 2023-01-16
8
+ ## 3.0.0.beta27 - 2021-09-23
9
+ - Updated pinned api.eligible.com certificate
10
+
11
+ ## 3.0.0.beta26 - 2021-05-12
12
+ - Updated pinned GDS SSL certificate for Staging
13
+
14
+ ## 3.0.0.beta25 - 2021-04-12
9
15
  - Updated pinned GDS SSL certificate
10
16
 
11
- ## 2.9.13 - 2022-02-07
17
+ ## 3.0.0.beta24 - 2021-04-01
12
18
  - Updated pinned GDS SSL certificate
13
19
 
14
- ## 2.9.12 - 2021-04-12
15
- - Fixing the pinned GDS SSL certificate
20
+ ## 3.0.0.beta23 - 2020-11-13
21
+ - Bug fixes
16
22
 
17
- ## 2.9.11 - 2021-04-01
18
- - Updated pinned GDS SSL certificate
23
+ ## 3.0.0.beta22 - 2020-10-21
24
+ - Bug fixes
25
+
26
+ ## 3.0.0.beta21 - 2020-10-21
27
+ - Add post method for CE API to avoid 414 error with large X12 inputs
28
+
29
+ ## 3.0.0.beta20 - 2020-08-17
30
+ - Bug fixes
31
+
32
+ ## 3.0.0.beta19 - 2020-07-28
33
+ - Added refunds and balance_captures REST API endpoints
34
+
35
+ ## 3.0.0.beta18 - 2020-07-24
36
+ - Added claim_submit endpoint API url for PatientStatement endpoint
19
37
 
20
- ## 2.9.10 - 2020-05-13
38
+ ## 3.0.0.beta17 - 2020-07-13
39
+ - Bug fixes
40
+
41
+ ## 3.0.0.beta16 - 2020-07-10
42
+ - Migrated "Patient" endpoint to "PatientRecord"
43
+
44
+ ## 3.0.0.beta15 - 2020-06-12
45
+ - Added support for patient questionnaire, patient questions API endpoints
46
+
47
+ ## 3.0.0.beta14 - 2020-06-08
48
+ - Added Fee and FeeRefund new REST API endpoints
49
+
50
+ ## 3.0.0.beta13 - 2020-06-05
51
+ - Added create, update, delete and validate endpoints support for rules
52
+
53
+ ## 3.0.0.beta12 - 2020-05-12
21
54
  - Updated pinned GDS SSL certificate
22
55
 
56
+ ## 3.0.0.beta11 - 2020-05-12
57
+ - Added summary and escalate actions for Enrollments endpoint
58
+ - Added Action endpoint
59
+ - Added Attribute endpoint
60
+ - Added Claim endpoint
61
+ - Added ClaimServiceLine endpoint
62
+ - Added Device endpoint
63
+ - Added Discount endpoint
64
+ - Renamed FileObject to File in order to kept consistency
65
+ - Added FileLink endpoint
66
+ - Added InsuranceCompanyAlias endpoint
67
+ - Added PaymentReport endpoint
68
+ - Added Remark endpoint
69
+ - Added Rule endpoint
70
+ - Added Session endpoint
71
+ - Added Transaction endpoint
72
+ - Added ValueList endpoint
73
+ - Added ValueListItem endpoint
74
+ - Added Verification endpoint
75
+ - Updated Charge endpoint to raise exception on delete action
76
+ - Updated Estimate endpoint, raise exception on update and delete actions, and added missing actions process, reestimate, convert
77
+ - Update EstimateServiceLine endpoint to raise exception on update and delete actions
78
+ - Updated InsuranceCompany endpoint to raise exception on delete action
79
+
80
+ ## 3.0.0.beta10 - 2020-05-06
81
+ - Added support for new REST API endpoints "Contract, Enrollment, Provider"
82
+ - Added support delete operations on new API.
83
+
84
+ ## 3.0.0.beta9 - 2020-05-04
85
+ - Added support for new REST API endpoints "Charge, Estimate, EstimateServiceLine, Product, Treatment"
86
+
87
+ ## 3.0.0.beta8 - 2020-04-30
88
+ - Fixed payment and payment_reports API urls for new PatientStatement endpoint
89
+
90
+ ## 3.0.0.beta7 - 2020-04-16
91
+ - Removed un-wanted parameters from the API request while making calls to new REST API endpoint
92
+
93
+ ## 3.0.0.beta6 - 2020-04-08
94
+ - Bug fix for "PatientStatement" endpoint
95
+
96
+ ## 3.0.0.beta5 - 2020-03-31
97
+ - Added support for new REST API endpoints "Insurance Company, Insurance Policy, Patient"
98
+
99
+ ## 3.0.0.beta4 - 2020-03-16
100
+ - Fixed query params conversion to support Expand feature for new REST API Endpoints
101
+ - Changed new REST API endpoints format to support `ID` field or `params`
102
+
103
+ ## 3.0.0.beta3 - 2020-03-09
104
+ - Added support for new REST API endpoint "PatientStatement" and "PatientStatementServiceLine"
105
+
106
+ ## 3.0.0.beta2 - 2020-03-03
107
+ - Added support for V1.0 REST API endpoints and added Files endpoints
108
+ - Update pinned api.eligible.com and wildcard.eligible.com certificate
109
+
110
+ ## 3.0.0.beta1 - 2019-10-01
111
+ - Added support for Eligible-Account Header in the API requests when used Eligible Connect feature
112
+
23
113
  ## 2.9.9 - 2019-08-07
24
114
  - Added Icd code endpoints
25
115
 
@@ -74,7 +164,7 @@
74
164
  - Documentation updates for the endpoints
75
165
 
76
166
  ## 2.6.0 - 2016-02-23
77
- - Added new endpoints customer, original signature pdf and payer.
167
+ - Added new endpoints customer, original signature pdf, and payer.
78
168
  - Added specs
79
169
  - Bumped api version to 1.5
80
170
  - Fixed few bugs
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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eligible (3.0.0)
4
+ eligible (3.1.0.beta1)
5
5
  multi_json (~> 1.15.0)
6
6
  rest-client (~> 2.1.0)
7
7
 
@@ -10,13 +10,14 @@ GEM
10
10
  specs:
11
11
  diff-lcs (1.5.0)
12
12
  docile (1.4.0)
13
- domain_name (0.6.20240107)
13
+ domain_name (0.5.20190701)
14
+ unf (>= 0.0.5, < 1.0.0)
14
15
  http-accept (1.7.0)
15
16
  http-cookie (1.0.5)
16
17
  domain_name (~> 0.5)
17
- mime-types (3.5.2)
18
+ mime-types (3.4.1)
18
19
  mime-types-data (~> 3.2015)
19
- mime-types-data (3.2023.1205)
20
+ mime-types-data (3.2022.0105)
20
21
  multi_json (1.15.0)
21
22
  netrc (0.11.0)
22
23
  rake (13.0.6)
@@ -37,7 +38,7 @@ GEM
37
38
  rspec-mocks (3.11.1)
38
39
  diff-lcs (>= 1.2.0, < 2.0)
39
40
  rspec-support (~> 3.11.0)
40
- rspec-support (3.11.1)
41
+ rspec-support (3.11.0)
41
42
  rspec_junit_formatter (0.5.1)
42
43
  rspec-core (>= 2, < 4, != 2.12.0)
43
44
  simplecov (0.21.2)
@@ -46,6 +47,9 @@ GEM
46
47
  simplecov_json_formatter (~> 0.1)
47
48
  simplecov-html (0.12.3)
48
49
  simplecov_json_formatter (0.1.4)
50
+ unf (0.1.4)
51
+ unf_ext
52
+ unf_ext (0.0.8.2)
49
53
 
50
54
  PLATFORMS
51
55
  ruby
@@ -54,8 +58,11 @@ DEPENDENCIES
54
58
  eligible!
55
59
  rake (~> 13.0.6)
56
60
  rspec (~> 3.11.0)
57
- rspec_junit_formatter (~> 0.5.1x)
61
+ rspec_junit_formatter (~> 0.5.1)
58
62
  simplecov (~> 0.21.2)
59
63
 
64
+ RUBY VERSION
65
+ ruby 3.1.0p0
66
+
60
67
  BUNDLED WITH
61
68
  2.1.4
data/README.md CHANGED
@@ -38,7 +38,7 @@ Eligible.test = true
38
38
  On each api call, you can overwrite the api key or the test parameter:
39
39
 
40
40
  ```ruby
41
- Eligible::Coverage.get({api_key: 'NEW_KEY', test: false})
41
+ Eligible::Coverage.get({:api_key => 'NEW_KEY', :test => false})
42
42
  ```
43
43
 
44
44
  ### Response Format
@@ -47,7 +47,7 @@ By default, all responses are in JSON, but you can request raw
47
47
  access to X12 by adding is as a parameter on the api call:
48
48
 
49
49
  ```ruby
50
- Eligible::Coverage.get({format: "x12"})
50
+ Eligible::Coverage.get({:format => "x12"})
51
51
  ```
52
52
 
53
53
  # Important notes
@@ -123,18 +123,17 @@ coverage.to_hash
123
123
  ### Retrieve eligibility and benefit information
124
124
 
125
125
  ```ruby
126
-
127
126
  params = {
128
- service_type: "30",
129
- payer_id: "ELIG_SNDBX",
130
- provider_last_name: "Last",
131
- provider_first_name: "First",
132
- provider_npi: "1234567893",
133
- member_id: "AETNA00OAMC",
134
- member_last_name: "Austen",
135
- member_first_name: "Jane",
136
- member_dob: "1955-12-14",
137
- test: true
127
+ :service_type => "33",
128
+ :network => "OUT",
129
+ :payer_id => "000001",
130
+ :provider_last_name => "Last",
131
+ :provider_first_name => "First",
132
+ :provider_npi => "12345678",
133
+ :member_id => "12345678",
134
+ :member_last_name => "Austen",
135
+ :member_first_name => "Jane",
136
+ :member_dob => "1955-12-14"
138
137
  }
139
138
 
140
139
  coverage = Eligible::Coverage.get(params)
@@ -155,11 +154,10 @@ params = {
155
154
  network: 'IN',
156
155
  payer_id: '00001',
157
156
  provider_npi: '1234567893',
158
- member_id: 'COST_ESTIMATES_001',
157
+ member_id: 'COST_ESTIMATE_001',
159
158
  member_dob: '1886-01-01',
160
159
  provider_price: '200',
161
- level: 'individual',
162
- test: true
160
+ level: 'individual'
163
161
  }
164
162
 
165
163
  cost_estimate = Eligible::Coverage.cost_estimate(params)
@@ -176,15 +174,14 @@ cost_estimate.to_hash # returns all coverage info along with cost estimate
176
174
 
177
175
  ```ruby
178
176
  params = {
179
- payer_id: "ELIG_SNDBX",
180
- provider_last_name: "Last",
181
- provider_first_name: "First",
182
- provider_npi: "1234567893",
183
- member_id: "333333333A",
184
- member_last_name: "Austen",
185
- member_first_name: "Jane",
186
- member_dob: "1955-12-14",
187
- test: true
177
+ :payer_id => "000001",
178
+ :provider_last_name => "Last",
179
+ :provider_first_name => "First",
180
+ :provider_npi => "12345678",
181
+ :member_id => "12345678",
182
+ :member_last_name => "Austen",
183
+ :member_first_name => "Jane",
184
+ :member_dob => "1955-12-14"
188
185
  }
189
186
  medicare = Eligible::Medicare.get(params)
190
187
  medicare.to_hash # returns all coverage info for the request
@@ -241,13 +238,13 @@ result.error # return error, if any
241
238
  ### Retrieve an Enrollment Request
242
239
 
243
240
  ```ruby
244
- params = { enrollment_request_id: 123 }
241
+ params = { :enrollment_request_id => 123 }
245
242
  enrollment = Eligible::Enrollment.get(params)
246
243
  enrollment.to_hash # return the api call results
247
244
  enrollment.error # return error, if any
248
245
  enrollment.enrollment_npis # quick access to the enrollment npis within the enrollment request object
249
246
 
250
- params = { npis: %w(123 456 789).join(',') }
247
+ params = { :npis => %w(123 456 789).join(',') }
251
248
  enrollment = Eligible::Enrollment.get(params)
252
249
  ```
253
250
 
@@ -342,7 +339,7 @@ claims = Eligible::Claim.all # returns acknowledgment information for all claims
342
339
 
343
340
  ```ruby
344
341
  params = {
345
- reference_id: "12345"
342
+ :reference_id => "12345"
346
343
  }
347
344
 
348
345
  claim = Eligible::Claim.get(params) # returns acknowledgment information on an individual claim identified by its reference_id
@@ -357,18 +354,18 @@ claim = Eligible::Claim.get(params) # returns acknowledgment information on an i
357
354
  ### Retrieve Payment status
358
355
 
359
356
  ```ruby
360
- params = { payer_id: '00001',
361
- provider_tax_id: '4373208923',
362
- provider_npi: '1234567890',
363
- provider_first_name: 'Thomas',
364
- provider_first_name: 'Thomas',
365
- member_id: '123',
366
- member_first_name: 'Benjamin',
367
- member_last_name: 'Franklin',
368
- member_dob: '01-01-1980',
369
- charge_amount: '100.00',
370
- start_date: '2013-03-25',
371
- end_date: '2013-03-25' }
357
+ params = { :payer_id => '00001',
358
+ :provider_tax_id => '4373208923',
359
+ :provider_npi => '1234567890',
360
+ :provider_first_name => 'Thomas',
361
+ :provider_first_name => 'Thomas',
362
+ :member_id => '123',
363
+ :member_first_name => 'Benjamin',
364
+ :member_last_name => 'Franklin',
365
+ :member_dob => '01-01-1980',
366
+ :charge_amount => '100.00',
367
+ :start_date => '2013-03-25',
368
+ :end_date => '2013-03-25' }
372
369
 
373
370
  result = Eligible::Payment.get(params)
374
371
  result.to_hash # return the api call results
@@ -380,7 +377,7 @@ result.error # return error, if any
380
377
  ### X12 post
381
378
 
382
379
  ```ruby
383
- params = { x12: "ISA*00* *00* *ZZ*SENDERID *ZZ*ELIGIB *130610*0409*^*00501*100000001*0*T*:~GS*HS*SENDERID*ELIGIB*20130610*0409*1*X*005010X279A1~ST*270*0001*005010X279A1~BHT*0022*13*137083739083716126837*20130610*0409~HL*1**20*1~NM1*PR*2*UnitedHealthCare*****PI*112~HL*2*1*21*1~NM1*1P*1*AUSTEN*JANE****XX*1222494919~HL*3*2*22*0~TRN*1*1*1453915417~NM1*IL*1*FRANKLIN*BENJAMIN****MI*23412342~DMG*D8*17371207~DTP*291*D8*20130610~EQ*30~SE*13*0001~GE*1*1~IEA*1*100000001~" }
380
+ params = { :x12 => "ISA*00* *00* *ZZ*SENDERID *ZZ*ELIGIB *130610*0409*^*00501*100000001*0*T*:~GS*HS*SENDERID*ELIGIB*20130610*0409*1*X*005010X279A1~ST*270*0001*005010X279A1~BHT*0022*13*137083739083716126837*20130610*0409~HL*1**20*1~NM1*PR*2*UnitedHealthCare*****PI*112~HL*2*1*21*1~NM1*1P*1*AUSTEN*JANE****XX*1222494919~HL*3*2*22*0~TRN*1*1*1453915417~NM1*IL*1*FRANKLIN*BENJAMIN****MI*23412342~DMG*D8*17371207~DTP*291*D8*20130610~EQ*30~SE*13*0001~GE*1*1~IEA*1*100000001~" }
384
381
 
385
382
  result = Eligible::X12.post(params)
386
383
  ```
@@ -394,10 +391,10 @@ result = Eligible::X12.post(params)
394
391
  ### Create a ticket
395
392
 
396
393
  ```ruby
397
- params = {priority: 'normal',
398
- title: 'TITLE',
399
- notification_email: 'admin@eligible.com',
400
- body: 'Your comment'}
394
+ params = {:priority => 'normal',
395
+ :title => 'TITLE',
396
+ :notification_email => 'admin@eligible.com',
397
+ :body => 'Your comment'}
401
398
  result = Eligible::Ticket.create params
402
399
  result.to_hash # return the api call results
403
400
  enrollment.error # return error, if any
@@ -406,7 +403,7 @@ enrollment.error # return error, if any
406
403
  ### Get a ticket
407
404
 
408
405
  ```ruby
409
- ticket = Eligible::Ticket.get(id: 1)
406
+ ticket = Eligible::Ticket.get(:id => 1)
410
407
  ticket.to_hash # return the api call result
411
408
  ticket.error # return error, if any
412
409
  ```
@@ -414,11 +411,11 @@ ticket.error # return error, if any
414
411
  ### Update a ticket
415
412
 
416
413
  ```ruby
417
- params = { id: 1,
418
- priority: 'normal',
419
- title: 'TITLE',
420
- notification_email: 'your_email@test.com',
421
- body: 'Your comment'}
414
+ params = { :id => 1,
415
+ :priority => 'normal',
416
+ :title => 'TITLE',
417
+ :notification_email => 'your_email@test.com',
418
+ :body => 'Your comment'}
422
419
  result = Eligible::Ticket.update(params)
423
420
  result.to_hash # return the api call results
424
421
  enrollment.error # return error, if any
@@ -427,7 +424,7 @@ enrollment.error # return error, if any
427
424
  ### Get comments for a ticket
428
425
 
429
426
  ```ruby
430
- comments = Eligible::Ticket.get(id: 1)
427
+ comments = Eligible::Ticket.get(:id => 1)
431
428
  comments.to_hash # return the api call result
432
429
  comments.error # return error, if any
433
430
 
@@ -435,7 +432,7 @@ comments.error # return error, if any
435
432
 
436
433
  ### Delete a ticket
437
434
  ```ruby
438
- result = Eligible::Ticket.delete(id: 1)
435
+ result = Eligible::Ticket.delete(:id => 1)
439
436
  comments.to_hash # return the api call result
440
437
  comments.error # return error, if any
441
438
  ```
@@ -682,7 +679,7 @@ result.error # returns error, if any
682
679
  ### Use session token without api_key
683
680
 
684
681
  ```ruby
685
- Eligible::Coverage.get({session_token: 'SESSION_TOKEN', test: false})
682
+ Eligible::Coverage.get({:session_token => 'SESSION_TOKEN', :test => false})
686
683
  ```
687
684
 
688
685
 
data/eligible.gemspec CHANGED
@@ -15,12 +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
20
  gem.add_dependency('rest-client', '~> 2.1.0')
20
21
  gem.add_dependency('multi_json', '~> 1.15.0')
21
22
 
22
23
  gem.add_development_dependency('rake', '~> 13.0.6')
23
24
  gem.add_development_dependency('rspec', '~> 3.11.0')
24
- gem.add_development_dependency('rspec_junit_formatter', '~> 0.5.1x')
25
+ gem.add_development_dependency('rspec_junit_formatter', '~> 0.5.1')
25
26
  gem.add_development_dependency('simplecov', '~> 0.21.2')
26
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
@@ -84,7 +84,7 @@ module Eligible
84
84
  cipher.pkcs5_keyivgen(options[:key])
85
85
  end
86
86
 
87
- yield cipher, options if block_given?
87
+ yield cipher, **options if block_given?
88
88
 
89
89
  value = options[:value]
90
90