great-west-life-cli 0.0.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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/bin/great-west-life-cli +184 -0
  3. metadata +79 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4ad1f40cf3e303653be9b7ccf3f815e89832434b
4
+ data.tar.gz: 73a715f91d71c5f0dbdd25bc6fb94d899add8531
5
+ SHA512:
6
+ metadata.gz: e390161961d05c9cfe171496b6b41e0e8c4f1f88b3fec1bcd2706ccc4d8ef6e77e588f36e1c7c4fbb3d9862cd9907c4457f6ad8fa758d0373e25082d5f11e4e3
7
+ data.tar.gz: c4cd31d7bbba3ec8add6adf3325695a553355579c83f8d87a6e70db78c58c37c1e723b093288ec08e877c4cdcd680f641157d9180b3b6dad490059468ee2ef9e
@@ -0,0 +1,184 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'optparse/date'
5
+ require 'highline/import'
6
+ require 'capybara'
7
+
8
+ options = OpenStruct.new
9
+ options.username = ''
10
+ options.claim_type = 'Massage Therapy'
11
+ options.provider = ''
12
+ options.date = Date.today.prev_day.strftime("%b %e %Y")
13
+ options.hours = 0
14
+ options.minutes = 30
15
+ options.amount = 60.00
16
+
17
+ CLAIM_TYPES = [
18
+ 'Athletic Therapy',
19
+ 'Dental',
20
+ 'Massage Therapy',
21
+ 'Physiotherapy',
22
+ 'Social Worker',
23
+ 'Chiropody',
24
+ 'Dietician',
25
+ 'Naturopath',
26
+ 'Podiatry',
27
+ 'Speech Therapy',
28
+ 'Chiropractor',
29
+ 'Drug',
30
+ 'Osteopath',
31
+ 'Psychology'
32
+ ]
33
+
34
+ opt_parser = OptionParser.new do |opts|
35
+ opts.banner = "Usage: script.rb [options]"
36
+
37
+ opts.on("-u", "--user USER", "USER is required") do |user|
38
+ options.username = user
39
+ end
40
+
41
+ opts.on("-t", "--type CLAIM_TYPE", CLAIM_TYPES, "need to specify a claim type") do |claim_type|
42
+ options.claim_type = claim_type
43
+ end
44
+
45
+ opts.on("-p", "--provider PROVIDER", "The service provider (must exist in Great West Life already)") do |provider|
46
+ options.provider = provider
47
+ end
48
+
49
+ opts.on("-d", "--date DATE", Date, "The date of the claim") do |date|
50
+ options.date = date.strftime("%b %e %Y")
51
+ end
52
+
53
+ opts.on("-h", "--hours HOURS", "length of the visit") do |hours|
54
+ options.hours = hours.to_i
55
+ end
56
+
57
+ opts.on("-m", "--minutes MINUTES", "length of the visit") do |minutes|
58
+ options.minutes = minutes.to_i
59
+ end
60
+
61
+ opts.on("-a", "--amount AMOUNT", Float, "cost of the visit") do |amount|
62
+ options.amount = amount
63
+ end
64
+ end
65
+
66
+ opt_parser.parse!(ARGV)
67
+
68
+ puts "\nOptions:"
69
+ puts "--------"
70
+ options.to_h.each do |k,v|
71
+ puts "#{k} => #{v}"
72
+ end
73
+ puts ""
74
+
75
+ exit unless HighLine.agree('Please review options before continuing. Continue? [Y/n]')
76
+ password = ask("enter password to continue: ") { |q| q.echo = "*" }
77
+
78
+
79
+ # Login
80
+ session = Capybara::Session.new(:selenium)
81
+ session.visit "https://groupnet.greatwestlife.com/public/signin/login.public"
82
+
83
+ session.fill_in('usernameDisplay', :with => options.username)
84
+ session.fill_in('password', :with => password)
85
+ session.find("img[alt='Sign In'][src='/public/signin/images/en/signin_button_submit.gif']").click
86
+
87
+
88
+ # Navigate to claims area
89
+ begin
90
+ session.find_link('Submit a claim').click
91
+ session.first(:link, 'Online Claim').click
92
+ rescue => e
93
+ puts "Error logging in - check your username and password"
94
+ exit
95
+ end
96
+
97
+
98
+ # Step 1: Type of Claim
99
+ puts "Step 1: Type of Claim"
100
+ sleep 2
101
+ session.has_content?('Select Type of Claim')
102
+ session.has_selector?('span', text: options.claim_type)
103
+
104
+ session.first('span', text: options.claim_type).click
105
+
106
+ yes_spans = session.all('span', text: 'Yes')
107
+ yes_spans[0].click # Do you want to reimburse any unpaid portion of this claim from your spending account?
108
+
109
+ no_spans = session.all('span', text: 'No')
110
+ no_spans[1].click # Is a claim being made for Worker's Compensation Benefits?
111
+ no_spans[2].click # Has the claim been submitted to or paid in part by another group plan?
112
+ no_spans[3].click # Was the service provided outside of Canada?
113
+ no_spans[4].click # Is this claim for medical equipment and/or supplies?
114
+
115
+ session.find_button("Next Step >>").click
116
+
117
+
118
+ # Step 2: Provider Information
119
+ puts "Step 2: Provider Information"
120
+ sleep 2
121
+ session.has_content?('Select a Provider/Clinic or Add a New Provider')
122
+
123
+ begin
124
+ session.has_selector?('span', text: options.provider)
125
+ session.first('span', text: options.provider).click
126
+ rescue => e
127
+ puts "Error selecting provider - are you sure you picked the right one?"
128
+ exit
129
+ end
130
+
131
+ session.find_button("Next Step >>").click
132
+
133
+
134
+ # Step 3: Patient Information
135
+ puts "Step 3: Patient Information"
136
+ sleep 2
137
+ session.has_content?('Enter Patient Details')
138
+
139
+ no_spans = session.all('span', text: 'No')
140
+ no_spans[0].click # Are you, or any other member of your family, entitled to benefits under any other group plan for the expenses being claimed?
141
+
142
+ session.find_button("Next Step >>").click
143
+
144
+
145
+ # Step 4: Expense Details
146
+ puts "Step 4: Expense Details"
147
+ sleep 2
148
+ session.has_content?('Enter Expense Details')
149
+
150
+ inputs = session.all('input')
151
+ inputs[1].set(options.date)
152
+ session.first('option', text: 'Subsequent Treatment').click
153
+ inputs[2].set(options.hours)
154
+ inputs[3].set(options.minutes)
155
+ inputs[4].set(options.amount)
156
+
157
+ no_spans = session.all('span', text: 'No')
158
+ no_spans[0].click # Did you receive a physician's referral for this expense?
159
+ no_spans[1].click # Is treatment required as the result of a motor vehicle accident
160
+
161
+ session.find_button("Next Step >>").click
162
+
163
+
164
+ # Step 5: Summary and Consent
165
+ puts "Step 5: Summary and Content"
166
+ sleep 2
167
+ session.has_content?('Claim Summary and Consent')
168
+ session.find('input').click # I have read and agree with the Terms & Conditions
169
+
170
+ exit unless HighLine.agree('Submit the claim? [Y/n]')
171
+ session.find_button("I Agree - Submit >>").click
172
+
173
+
174
+ # Step 6: Finish
175
+ sleep 2
176
+ session.has_content?('Thank you. Your online claim has been submitted for')
177
+ screenshot_path = ENV['HOME'] + '/' + "#{options.claim_type.downcase} - #{options.date.downcase}.png"
178
+ session.save_screenshot(screenshot_path)
179
+ puts "Claim Submitted."
180
+ puts "Screenshot saved to #{screenshot_path}"
181
+
182
+ # this didn't work on my latest submissions
183
+ # not super important though since we are done
184
+ session.find_button("I'm Done'").click
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: great-west-life-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kevin Hughes
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: highline
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: capybara
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Submit claims with one command instead of clicking through an awful UI
42
+ email: kevinhughes27@gmail.com
43
+ executables:
44
+ - great-west-life-cli
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - bin/great-west-life-cli
49
+ homepage: https://github.com/kevinhughes27/great-west-life-cli
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
53
+ post_install_message: |2
54
+ Thanks for installing great-west-life-cli!
55
+ To get started run `great-west-life-cli` from the console.
56
+ Please review options carefully as it will submit to Great
57
+ West Life. This software is provided as is and I am not
58
+ responsible for any incorrect claims made using this
59
+ script.
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.2.2
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: CLI for submitting online claims to Great West Life
79
+ test_files: []