milton 1.1.0 → 1.1.1

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. data/History.txt +5 -0
  2. data/lib/milton.rb +16 -2
  3. metadata +4 -4
@@ -1,3 +1,8 @@
1
+ === 1.1.1 / 2009-10-02
2
+
3
+ * Added supervisor page handling.
4
+ * Added error handling
5
+
1
6
  === 1.1.0 / 2009-07-09
2
7
 
3
8
  * 1 major enhancement
@@ -12,7 +12,7 @@ require 'yaml'
12
12
 
13
13
  class Milton
14
14
 
15
- VERSION = '1.1.0'
15
+ VERSION = '1.1.1'
16
16
 
17
17
  def self.load_config config_file
18
18
  unless File.exist? config_file then
@@ -126,6 +126,13 @@ the current week with eight hours/day.
126
126
  form['__EVENTTARGET'] = 'btnLogin'
127
127
  }.submit
128
128
  change_password password if @page.body =~ /Old Password/
129
+
130
+ if @page.body =~ /Supervisor Services/ then
131
+ warn "switching to employee page"
132
+ option = @page.parser.css("select#Banner1_ddlServices").children.find { |n| n["value"] =~ /EmployeeServicesStart/ }
133
+ @page = @agent.get option["value"]
134
+ end
135
+
129
136
  @page = @page.link_with(:text => 'Time Sheet').click
130
137
  end
131
138
 
@@ -234,10 +241,17 @@ the current week with eight hours/day.
234
241
  # Prints out your timesheet for the selected time frame
235
242
 
236
243
  def extract_timesheet
244
+ @page.parser.css(".ErrorText").each do |n|
245
+ puts "ERROR: #{n.text}"
246
+ end
247
+
237
248
  timesheet = parse_timesheet
238
249
 
239
250
  department = timesheet.first[6]
240
251
  employee_id = timesheet.first[7]
252
+ error = timesheet.first[9]
253
+
254
+ puts "ERROR: #{error}" if error
241
255
 
242
256
  puts "Employee #{@username} id #{employee_id}, department #{department}"
243
257
 
@@ -328,7 +342,7 @@ the current week with eight hours/day.
328
342
  row = match[0].gsub(/"/, '').split(',')
329
343
  row.map { |x|
330
344
  CGI.unescape(x.strip).delete('[]')
331
- }.values_at(0, 7, 8, 9, 11, 12, 14, 15, 32)
345
+ }.values_at(0, 7, 8, 9, 11, 12, 14, 15, 32, 1)
332
346
  end
333
347
  end
334
348
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milton
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-09 00:00:00 -07:00
12
+ date: 2009-10-02 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.3.2
33
+ version: 2.3.3
34
34
  version:
35
35
  description: Milton fills out your ADP ezLaborManager timesheet
36
36
  email:
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  requirements: []
79
79
 
80
80
  rubyforge_project: seattlerb
81
- rubygems_version: 1.3.4
81
+ rubygems_version: 1.3.5
82
82
  signing_key:
83
83
  specification_version: 3
84
84
  summary: Milton fills out your ADP ezLaborManager timesheet