eligible 1.0

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.
@@ -0,0 +1,67 @@
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
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eligible
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Andy Brett
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: mocha
16
+ requirement: &70130122371040 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70130122371040
25
+ - !ruby/object:Gem::Dependency
26
+ name: shoulda
27
+ requirement: &70130122370000 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70130122370000
36
+ - !ruby/object:Gem::Dependency
37
+ name: test-unit
38
+ requirement: &70130122368580 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70130122368580
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: &70130122367240 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70130122367240
58
+ - !ruby/object:Gem::Dependency
59
+ name: rest-client
60
+ requirement: &70130122450000 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '1.4'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *70130122450000
69
+ - !ruby/object:Gem::Dependency
70
+ name: multi_json
71
+ requirement: &70130122473580 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: 1.0.4
77
+ - - <
78
+ - !ruby/object:Gem::Version
79
+ version: '2'
80
+ type: :runtime
81
+ prerelease: false
82
+ version_requirements: *70130122473580
83
+ description: Eligible is a developer-friendly way to process health care eligibility
84
+ checks. Learn more at https://eligibleapi.com
85
+ email:
86
+ - andy@andybrett.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - .gitignore
92
+ - CONTRIBUTORS
93
+ - Gemfile
94
+ - LICENSE
95
+ - README.md
96
+ - Rakefile
97
+ - eligible.gemspec
98
+ - lib/eligible.rb
99
+ - lib/eligible/api_resource.rb
100
+ - lib/eligible/claim.rb
101
+ - lib/eligible/demographic.rb
102
+ - lib/eligible/eligible_object.rb
103
+ - lib/eligible/errors/api_connection_error.rb
104
+ - lib/eligible/errors/api_error.rb
105
+ - lib/eligible/errors/authentication_error.rb
106
+ - lib/eligible/errors/eligible_error.rb
107
+ - lib/eligible/json.rb
108
+ - lib/eligible/plan.rb
109
+ - lib/eligible/service.rb
110
+ - lib/eligible/util.rb
111
+ - lib/eligible/version.rb
112
+ - test/test_eligible.rb
113
+ - test/test_helper.rb
114
+ homepage: https://eligibleapi.com/
115
+ licenses:
116
+ - MIT
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ! '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 1.8.13
136
+ signing_key:
137
+ specification_version: 3
138
+ summary: Ruby wrapper for the Eligible API
139
+ test_files:
140
+ - test/test_eligible.rb
141
+ - test/test_helper.rb