eligible 1.0 → 3.0.0.beta17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +76 -0
  3. data/.codeclimate.yml +23 -0
  4. data/.gitignore +3 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +1158 -0
  7. data/.ruby-version +1 -0
  8. data/CHANGELOG.md +170 -0
  9. data/Gemfile +4 -0
  10. data/Gemfile.lock +66 -0
  11. data/LICENSE +1 -1
  12. data/README.md +700 -93
  13. data/Rakefile +12 -2
  14. data/eligible.gemspec +14 -16
  15. data/lib/eligible/api_resource.rb +49 -5
  16. data/lib/eligible/calculator_deploy_url.rb +7 -0
  17. data/lib/eligible/claim.rb +22 -6
  18. data/lib/eligible/coverage.rb +19 -0
  19. data/lib/eligible/coverage_resource.rb +23 -0
  20. data/lib/eligible/customer.rb +19 -0
  21. data/lib/eligible/demographic.rb +6 -35
  22. data/lib/eligible/eligible_object.rb +12 -15
  23. data/lib/eligible/encryptor.rb +121 -0
  24. data/lib/eligible/enrollment.rb +23 -0
  25. data/lib/eligible/errors/eligible_error.rb +6 -3
  26. data/lib/eligible/errors/invalid_request_error.rb +4 -0
  27. data/lib/eligible/icd.rb +16 -0
  28. data/lib/eligible/json.rb +5 -15
  29. data/lib/eligible/lockbox.rb +39 -0
  30. data/lib/eligible/medicare.rb +11 -0
  31. data/lib/eligible/oauth_token.rb +9 -0
  32. data/lib/eligible/ocr.rb +15 -0
  33. data/lib/eligible/original_signature_pdf.rb +45 -0
  34. data/lib/eligible/payer.rb +17 -0
  35. data/lib/eligible/payer_mapping.rb +37 -0
  36. data/lib/eligible/payment.rb +11 -0
  37. data/lib/eligible/preauth_resource.rb +11 -0
  38. data/lib/eligible/precert.rb +15 -0
  39. data/lib/eligible/provider_model.rb +7 -0
  40. data/lib/eligible/public_key.rb +27 -0
  41. data/lib/eligible/received_pdf.rb +26 -0
  42. data/lib/eligible/referral.rb +11 -0
  43. data/lib/eligible/risk_assessment.rb +15 -0
  44. data/lib/eligible/session_token.rb +11 -0
  45. data/lib/eligible/ticket.rb +40 -0
  46. data/lib/eligible/util.rb +29 -38
  47. data/lib/eligible/v1_0/action.rb +9 -0
  48. data/lib/eligible/v1_0/attribute.rb +9 -0
  49. data/lib/eligible/v1_0/charge.rb +13 -0
  50. data/lib/eligible/v1_0/claim.rb +25 -0
  51. data/lib/eligible/v1_0/claim_service_line.rb +9 -0
  52. data/lib/eligible/v1_0/contract.rb +9 -0
  53. data/lib/eligible/v1_0/device.rb +9 -0
  54. data/lib/eligible/v1_0/discount.rb +9 -0
  55. data/lib/eligible/v1_0/enrollment.rb +17 -0
  56. data/lib/eligible/v1_0/estimate.rb +29 -0
  57. data/lib/eligible/v1_0/estimate_service_line.rb +17 -0
  58. data/lib/eligible/v1_0/fee.rb +21 -0
  59. data/lib/eligible/v1_0/fee_refund.rb +29 -0
  60. data/lib/eligible/v1_0/file.rb +17 -0
  61. data/lib/eligible/v1_0/file_link.rb +13 -0
  62. data/lib/eligible/v1_0/insurance_company.rb +21 -0
  63. data/lib/eligible/v1_0/insurance_company_alias.rb +9 -0
  64. data/lib/eligible/v1_0/insurance_policy.rb +9 -0
  65. data/lib/eligible/v1_0/patient_question.rb +9 -0
  66. data/lib/eligible/v1_0/patient_questionnaire.rb +9 -0
  67. data/lib/eligible/v1_0/patient_record.rb +9 -0
  68. data/lib/eligible/v1_0/patient_statement.rb +54 -0
  69. data/lib/eligible/v1_0/patient_statement_service_line.rb +13 -0
  70. data/lib/eligible/v1_0/payment_report.rb +21 -0
  71. data/lib/eligible/v1_0/product.rb +9 -0
  72. data/lib/eligible/v1_0/provider.rb +9 -0
  73. data/lib/eligible/v1_0/remark.rb +21 -0
  74. data/lib/eligible/v1_0/reports/accuracy_stats.rb +23 -0
  75. data/lib/eligible/v1_0/reports/estimate_friction.rb +23 -0
  76. data/lib/eligible/v1_0/reports/in_scope_distribution.rb +23 -0
  77. data/lib/eligible/v1_0/rest_api_base.rb +44 -0
  78. data/lib/eligible/v1_0/rule.rb +13 -0
  79. data/lib/eligible/v1_0/session.rb +21 -0
  80. data/lib/eligible/v1_0/transaction.rb +21 -0
  81. data/lib/eligible/v1_0/treatment.rb +9 -0
  82. data/lib/eligible/v1_0/value_list.rb +9 -0
  83. data/lib/eligible/v1_0/value_list_item.rb +9 -0
  84. data/lib/eligible/v1_0/verification.rb +17 -0
  85. data/lib/eligible/version.rb +1 -1
  86. data/lib/eligible/visit_type.rb +11 -0
  87. data/lib/eligible/x12.rb +8 -0
  88. data/lib/eligible.rb +320 -110
  89. metadata +148 -67
  90. data/CONTRIBUTORS +0 -1
  91. data/lib/eligible/plan.rb +0 -42
  92. data/lib/eligible/service.rb +0 -39
  93. data/test/test_eligible.rb +0 -279
  94. data/test/test_helper.rb +0 -67
data/test/test_helper.rb DELETED
@@ -1,67 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'eligible'
3
-
4
- module Eligible
5
- @mock_rest_client = nil
6
-
7
- def self.mock_rest_client=(mock_client)
8
- @mock_rest_client = mock_client
9
- end
10
-
11
- def self.execute_request(opts)
12
- get_params = (opts[:headers] || {})[:params]
13
- post_params = opts[:payload]
14
- case opts[:method]
15
- when :get then @mock_rest_client.get opts[:url], get_params, post_params
16
- when :post then @mock_rest_client.post opts[:url], get_params, post_params
17
- when :delete then @mock_rest_client.delete opts[:url], get_params, post_params
18
- end
19
- end
20
- end
21
-
22
- def test_response(body, code=200)
23
- # When an exception is raised, restclient clobbers method_missing. Hence we
24
- # can't just use the stubs interface.
25
- body = MultiJson.dump(body) if !(body.kind_of? String)
26
- m = mock
27
- m.instance_variable_set('@eligible_values', { :body => body, :code => code })
28
- def m.body; @eligible_values[:body]; end
29
- def m.code; @eligible_values[:code]; end
30
- m
31
- end
32
-
33
- def test_invalid_api_key_error
34
- { "error" => [ { "message" => "Could not authenticate you. Please re-try with a valid API key.", "code" => 1 }] }
35
- end
36
-
37
- def test_plan_missing_params
38
- {"timestamp"=>"2013-02-01T13:25:58", "eligible_id"=>"A4F4E1D6-7DC3-4B20-87CE-B59F48811290", "mapping_version"=>"plan/all$Revision:6$$Date:13-01-110:18$", "error"=>{"response_code"=>"Y", "response_description"=>"Yes", "agency_qualifier_code"=>"", "agency_qualifier_description"=>"", "reject_reason_code"=>"41", "reject_reason_description"=>"Authorization/AccessRestrictions", "follow-up_action_code"=>"C", "follow-up_action_description"=>"PleaseCorrectandResubmit"}}
39
- end
40
-
41
- def test_plan
42
- {"timestamp"=>"2013-01-14T20:39:57", "eligible_id"=>"B97BC91A-3E84-40A9-AA5C-D416CAE5CDB1", "mapping_version"=>"plan/all$Revision:6$$Date:13-01-110:18$", "primary_insurance"=>{"name"=>"Aetna", "id"=>"00002", "group_name"=>"TOWERGROUPCOMPANIES", "plan_begins"=>"2010-01-01", "plan_ends"=>"", "comments"=>["AetnaChoicePOSII"]}, "type"=>"30", "coverage_status"=>"1", "precertification_needed"=>"", "exclusions"=>"", "deductible_in_network"=>{"individual"=>{"base_period"=>"500", "remaining"=>"500", "comments"=>["MedDent", "MedDent"]}, "family"=>{"base_period"=>"1000", "remaining"=>"1000", "comments"=>["MedDent", "MedDent"]}}, "deductible_out_network"=>{"individual"=>{"base_period"=>"1250", "remaining"=>"1250", "comments"=>["MedDent", "MedDent"]}, "family"=>{"base_period"=>"3750", "remaining"=>"3750", "comments"=>["MedDent", "MedDent"]}}, "stop_loss_in_network"=>{"individual"=>{"base_period"=>"", "remaining"=>"2000", "comments"=>[]}, "family"=>{"base_period"=>"", "remaining"=>"4000", "comments"=>[]}}, "stop_loss_out_network"=>{"individual"=>{"base_period"=>"", "remaining"=>"3000", "comments"=>[]}, "family"=>{"base_period"=>"", "remaining"=>"6000", "comments"=>[]}}, "balance"=>"", "comments"=>[], "additional_insurance"=>{"comments"=>[]}}
43
- end
44
-
45
- def test_service_missing_params
46
- {"timestamp"=>"2013-02-04T17:23:12", "eligible_id"=>"7EEA40A7-58C5-4EBC-A450-10C37CA2D252", "mapping_version"=>"service/all$Revision:4$$Date:12-12-280:13$", "error"=>{"response_code"=>"Y", "response_description"=>"Yes", "agency_qualifier_code"=>"", "agency_qualifier_description"=>"", "reject_reason_code"=>"41", "reject_reason_description"=>"Authorization/AccessRestrictions", "follow-up_action_code"=>"C", "follow-up_action_description"=>"PleaseCorrectandResubmit"}}
47
- end
48
-
49
- def test_service
50
- {"timestamp"=>"2013-02-01T15:28:16", "eligible_id"=>"FD8994B1-F977-459A-81AC-D182EA8FE66D", "mapping_version"=>"service/all$Revision:4$$Date:12-12-280:13$", "type"=>"33", "coverage_status"=>"1", "service_begins"=>"", "service_ends"=>"", "not_covered"=>[], "comments"=>["AetnaChoicePOSII"], "precertification_needed"=>"", "visits_in_network"=>{"individual"=>{"total"=>"", "remaining"=>"", "comments"=>[]}, "family"=>{"total"=>"", "remaining"=>"", "comments"=>[]}}, "visits_out_network"=>{"individual"=>{"total"=>"", "remaining"=>"", "comments"=>[]}, "family"=>{"total"=>"", "remaining"=>"", "comments"=>[]}}, "copayment_in_network"=>{"individual"=>{"amount"=>"", "comments"=>[]}, "family"=>{"amount"=>"35", "comments"=>["OFFCHIROVISI", "COPAYNOTINCLUDEDINOOP", "MANPULATNCHRO"]}}, "copayment_out_network"=>{"individual"=>{"amount"=>"", "comments"=>[]}, "family"=>{"amount"=>"0", "comments"=>["MANPULATNCHRO"]}}, "coinsurance_in_network"=>{"individual"=>{"percent"=>"", "comments"=>[]}, "family"=>{"percent"=>"0", "comments"=>["OFFCHIROVISI", "MANPULATNCHRO"]}}, "coinsurance_out_network"=>{"individual"=>{"percent"=>"", "comments"=>[]}, "family"=>{"percent"=>"30", "comments"=>["CHIROVSTEVAL", "COINSAPPLIESTOOUTOFPOCKET", "MANPULATNCHRO"]}}, "deductible_in_network"=>{"individual"=>{"base_period"=>"", "remaining"=>"", "comments"=>[]}, "family"=>{"base_period"=>"", "remaining"=>"", "comments"=>[]}}, "deductible_out_network"=>{"individual"=>{"base_period"=>"", "remaining"=>"", "comments"=>[]}, "family"=>{"base_period"=>"", "remaining"=>"", "comments"=>[]}}, "additional_insurance"=>{"comments"=>[]}}
51
- end
52
-
53
- def test_demographic_missing_params
54
- {"timestamp"=>"2013-02-05T13:21:38", "eligible_id"=>"AE9F5EB3-B4BF-4B2E-92C5-6307CE91DB81", "mapping_version"=>"demographic/dob$Revision:1$$Date:12-12-2619:01$", "error"=>{"response_code"=>"Y", "response_description"=>"Yes", "agency_qualifier_code"=>"", "agency_qualifier_description"=>"", "reject_reason_code"=>"41", "reject_reason_description"=>"Authorization/AccessRestrictions", "follow-up_action_code"=>"C", "follow-up_action_description"=>"PleaseCorrectandResubmit"}}
55
- end
56
-
57
- def test_demographic
58
- {"timestamp"=>"2013-02-05T13:14:36", "eligible_id"=>"DCE2FFB3-179A-4825-ADA6-B8108FB5FB90", "mapping_version"=>"demographic/all$Revision:4$$Date:12-12-2622:25$", "last_name"=>"AUSTEN", "first_name"=>"JANE", "member_id"=>"R112114321", "group_id"=>"060801203300001", "group_name"=>"TOWERGROUPCOMPANIES", "dob"=>"1955-12-14", "gender"=>"M", "address"=>{"street_line_1"=>"123SOUTH7THSTREET", "street_line_2"=>"", "city"=>"CHICAGO", "state"=>"CA", "zip"=>"89701"}}
59
- end
60
-
61
- def test_claim_missing_params
62
- {"timestamp"=>"2013-02-05T13:21:38", "eligible_id"=>"AE9F5EB3-B4BF-4B2E-92C5-6307CE91DB81", "mapping_version"=>"claim/status$Revision:1$$Date:12-12-2619:01$", "error"=>{"response_code"=>"Y", "response_description"=>"Yes", "agency_qualifier_code"=>"", "agency_qualifier_description"=>"", "reject_reason_code"=>"41", "reject_reason_description"=>"Authorization/AccessRestrictions", "follow-up_action_code"=>"C", "follow-up_action_description"=>"PleaseCorrectandResubmit"}}
63
- end
64
-
65
- def test_claim
66
- {"timestamp"=>"2012-12-30T22:41:10", "eligible_id"=>"DCE2FFB3-179A-4825-ADA6-B8108FB5FB90", "mapping_version"=>"claim/status$Revision:1$$Date:12-12-3022:10$", "referenced_transaction_trace_number"=>"970779644", "claim_status_category_code"=>"F0", "claim_status_category_description"=>"Finalized-Theclaim/encounterhascompletedtheadjudicationcycleandnomoreactionwillbetaken.", "claim_status_code"=>"1", "claim_status_description"=>"Formoredetailedinformation,seeremittanceadvice.", "status_information_effective_date"=>"2007-03-13", "total_claim_charge_amount"=>"172", "claim_payment_amount"=>"126.9", "adjudication_finalized_date"=>"2007-03-18", "remittance_date"=>"2007-03-19", "remittance_trace_number"=>"458787", "payer_claim_control_number"=>"4121476181852", "claim_service_begin_date"=>"2007-02-23", "claim_service_end_date"=>"2007-02-28"}
67
- end