eligible 3.0.0 → 3.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class Fee < RestAPIBase
6
+ ENDPOINT_NAME = 'fees'.freeze
7
+
8
+ def self.create(_params, _opts = {})
9
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
10
+ end
11
+
12
+ def self.update(_params, _opts = {})
13
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
14
+ end
15
+
16
+ def self.delete(_params, _opts = {})
17
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class FeeRefund < RestAPIBase
6
+ ENDPOINT_NAME = 'fee_refunds'.freeze
7
+
8
+ def self.retrieve(params, opts = {})
9
+ send_request :get, "#{fee_url(params)}/fee_refunds/#{fee_refund_id(params)}", rest_api_params(params), **opts.merge(required_params: [:id, :fee])
10
+ end
11
+
12
+ def self.create(params, opts = {})
13
+ send_request :post, "#{fee_url(params)}/fee_refunds", rest_api_params(params), **opts.merge(required_params: [:fee])
14
+ end
15
+
16
+ def self.update(params, opts = {})
17
+ send_request :put, "#{fee_url(params)}/fee_refunds/#{fee_refund_id(params)}", rest_api_params(params), **opts.merge(required_params: [:id, :fee])
18
+ end
19
+
20
+ def self.list(params, opts = {})
21
+ send_request :get, "#{fee_url(params)}/fee_refunds", rest_api_params(params), **opts.merge(required_params: [:fee])
22
+ end
23
+
24
+ def self.delete(_params, _opts = {})
25
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class File < RestAPIBase
6
+ ENDPOINT_NAME = 'files'.freeze
7
+
8
+ def self.update(_params, _opts = {})
9
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
10
+ end
11
+
12
+ def self.delete(_params, _opts = {})
13
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class FileLink < RestAPIBase
6
+ ENDPOINT_NAME = 'file_links'.freeze
7
+
8
+ def self.delete(_params, _opts = {})
9
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class InsuranceCompany < RestAPIBase
6
+ ENDPOINT_NAME = 'insurance_companies'.freeze
7
+
8
+ def self.create(_params, _opts = {})
9
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
10
+ end
11
+
12
+ def self.update(_params, _opts = {})
13
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
14
+ end
15
+
16
+ def self.delete(_params, _opts = {})
17
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class InsuranceCompanyAlias < RestAPIBase
6
+ ENDPOINT_NAME = 'insurance_company_aliases'.freeze
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class InsurancePolicy < RestAPIBase
6
+ ENDPOINT_NAME = 'insurance_policies'.freeze
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class PatientQuestion < RestAPIBase
6
+ ENDPOINT_NAME = 'rules/patient_questions'.freeze
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class PatientQuestionnaire < RestAPIBase
6
+ ENDPOINT_NAME = 'rules/patient_questionnaires'.freeze
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class PatientRecord < RestAPIBase
6
+ ENDPOINT_NAME = 'patient_records'.freeze
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class PatientStatement < RestAPIBase
6
+ ENDPOINT_NAME = 'patient_statements'.freeze
7
+
8
+ # Finalize the patient statement
9
+ def self.finalize(id, opts = {})
10
+ send_request :post, "/#{endpoint_name}/#{object_id(id)}/finalize", rest_api_params(id), **opts.merge(required_params: [:id])
11
+ end
12
+
13
+ # Post a payment
14
+ def self.pay(params, opts = {})
15
+ send_request :post, "/#{endpoint_name}/#{object_id(params)}/payment_reports", rest_api_params(params), **opts.merge(required_params: [:id])
16
+ end
17
+
18
+ # List all payments
19
+ def self.payments(params, opts = {})
20
+ send_request :get, "/#{endpoint_name}/#{object_id(params)}/payment_reports", rest_api_params(params), **opts.merge(required_params: [:id])
21
+ end
22
+
23
+ # Capture a Patient Statement
24
+ def self.capture(params, opts = {})
25
+ send_request :post, "/#{endpoint_name}/#{object_id(params)}/capture", rest_api_params(params), **opts.merge(required_params: [:id])
26
+ end
27
+
28
+ # Process a Patient Statement
29
+ def self.process(params, opts = {})
30
+ send_request :post, "/#{endpoint_name}/#{object_id(params)}/process", rest_api_params(params), **opts.merge(required_params: [:id])
31
+ end
32
+
33
+ # Send a Patient Statement
34
+ def self.send(id, opts = {})
35
+ send_request :post, "/#{endpoint_name}/#{object_id(id)}/send", rest_api_params(id), **opts.merge(required_params: [:id])
36
+ end
37
+
38
+ # Void a Patient Statement
39
+ def self.void(id, opts = {})
40
+ send_request :post, "/#{endpoint_name}/#{object_id(id)}/void", rest_api_params(id), **opts.merge(required_params: [:id])
41
+ end
42
+
43
+ # Mark UnCollectible
44
+ def self.mark_uncollectible(id, opts = {})
45
+ send_request :post, "/#{endpoint_name}/#{object_id(id)}/mark_uncollectible", rest_api_params(id), **opts.merge(required_params: [:id])
46
+ end
47
+
48
+ # Reestimate a Patient Statement
49
+ def self.reestimate(params, opts = {})
50
+ send_request :post, "/#{endpoint_name}/#{object_id(params)}/reestimate", rest_api_params(params), **opts.merge(required_params: [:id])
51
+ end
52
+
53
+ # Submit a claim for a patient statement
54
+ def self.submit_claim(params, opts = {})
55
+ send_request :post, "/#{endpoint_name}/#{object_id(params)}/submit_claim", rest_api_params(params), **opts.merge(required_params: [:id])
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class PatientStatementServiceLine < RestAPIBase
6
+ ENDPOINT_NAME = 'patient_statement_service_lines'.freeze
7
+
8
+ def self.update(_params, _opts = {})
9
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class PaymentReport < RestAPIBase
6
+ ENDPOINT_NAME = 'payment_reports'.freeze
7
+
8
+ def self.create(_params, _opts = {})
9
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
10
+ end
11
+
12
+ def self.update(_params, _opts = {})
13
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
14
+ end
15
+
16
+ def self.delete(_params, _opts = {})
17
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class Product < RestAPIBase
6
+ ENDPOINT_NAME = 'products'.freeze
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class Provider < RestAPIBase
6
+ ENDPOINT_NAME = 'providers'.freeze
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class Refund < RestAPIBase
6
+ ENDPOINT_NAME = 'refunds'.freeze
7
+
8
+ def self.create(_params, _opts = {})
9
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
10
+ end
11
+
12
+ def self.update(_params, _opts = {})
13
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
14
+ end
15
+
16
+ def self.delete(_params, _opts = {})
17
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class Remark < RestAPIBase
6
+ ENDPOINT_NAME = 'remarks'.freeze
7
+
8
+ def self.create(_params, _opts = {})
9
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
10
+ end
11
+
12
+ def self.update(_params, _opts = {})
13
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
14
+ end
15
+
16
+ def self.delete(_params, _opts = {})
17
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class RestAPIBase < APIResource
6
+ REST_API_VERSION = '1.0'.freeze
7
+
8
+ def self.retrieve(id, opts = {})
9
+ send_request :get, api_url(endpoint_name, rest_api_params(id), :id), rest_api_params(id), **opts.merge(required_params: [:id])
10
+ end
11
+
12
+ def self.create(params, opts = {})
13
+ send_request :post, api_url(endpoint_name), rest_api_params(params), **opts
14
+ end
15
+
16
+ def self.update(params, opts = {})
17
+ send_request :put, api_url(endpoint_name, rest_api_params(params), :id), rest_api_params(params), **opts.merge(required_params: [:id])
18
+ end
19
+
20
+ def self.list(params, opts = {})
21
+ send_request :get, api_url(endpoint_name), rest_api_params(params), **opts
22
+ end
23
+
24
+ def self.delete(id, opts = {})
25
+ send_request :delete, api_url(endpoint_name, rest_api_params(id), :id), rest_api_params(id), **opts.merge(required_params: [:id])
26
+ end
27
+
28
+ private
29
+
30
+ def self.object_id(id_or_params)
31
+ id_or_params.is_a?(Hash) ? Util.value(id_or_params, :id) : id_or_params
32
+ end
33
+
34
+ def self.fee_refund_id(params)
35
+ Util.value(rest_api_params(params), :id)
36
+ end
37
+
38
+ def self.fee_url(params)
39
+ fee_id = Util.value(rest_api_params(params), :fee)
40
+ "/fees/#{fee_id}"
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class Rule < RestAPIBase
6
+ ENDPOINT_NAME = 'rules'.freeze
7
+
8
+ def self.validate(params, opts = {})
9
+ send_request :post, "/#{endpoint_name}/validate", rest_api_params(params), **opts
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class Session < RestAPIBase
6
+ ENDPOINT_NAME = 'sessions'.freeze
7
+
8
+ def self.update(_params, _opts = {})
9
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
10
+ end
11
+
12
+ def self.delete(_params, _opts = {})
13
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
14
+ end
15
+
16
+ def self.list(_params, _opts = {})
17
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class Transaction < RestAPIBase
6
+ ENDPOINT_NAME = 'transactions'.freeze
7
+
8
+ def self.create(_params, _opts = {})
9
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
10
+ end
11
+
12
+ def self.update(_params, _opts = {})
13
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
14
+ end
15
+
16
+ def self.delete(_params, _opts = {})
17
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class Treatment < RestAPIBase
6
+ ENDPOINT_NAME = 'treatments'.freeze
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class ValueList < RestAPIBase
6
+ ENDPOINT_NAME = 'rules/value_lists'.freeze
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class ValueListItem < RestAPIBase
6
+ ENDPOINT_NAME = 'rules/value_list_items'.freeze
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eligible
4
+ module V1_0
5
+ class Verification < RestAPIBase
6
+ ENDPOINT_NAME = 'verifications'.freeze
7
+
8
+ def self.update(_params, _opts = {})
9
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
10
+ end
11
+
12
+ def self.delete(_params, _opts = {})
13
+ fail NotImplementedError, "Not an allowed operation for this endpoint"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module Eligible
2
- VERSION = '3.0.0'.freeze
2
+ VERSION = '3.1.0.beta1'.freeze
3
3
  end
@@ -1,11 +1,11 @@
1
1
  module Eligible
2
2
  class VisitType < APIResource
3
- def self.list(params, api_key = nil)
4
- send_request(:get, '/visit_types.json', api_key, **params)
3
+ def self.list(params, opts = {})
4
+ send_request :get, '/visit_types.json', params, **opts
5
5
  end
6
6
 
7
- def self.insurance_company_ids(params, api_key = nil)
8
- send_request(:get, '/visit_types/insurance_company_ids.json', api_key, **params)
7
+ def self.insurance_company_ids(params, opts = {})
8
+ send_request :get, '/visit_types/insurance_company_ids.json', params, **opts
9
9
  end
10
10
  end
11
11
  end
data/lib/eligible/x12.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Eligible
2
2
  class X12 < APIResource
3
- def self.post(params, api_key = nil)
3
+ def self.post(params, opts = {})
4
4
  params[:format] = 'x12'
5
- send_request(:post, '/x12', api_key, **params)
5
+ send_request :post, '/x12', params, **opts
6
6
  end
7
7
  end
8
8
  end