Module: Paycom

Defined in:
lib/paycom.rb,
lib/paycom/version.rb

Defined Under Namespace

Classes: Login, Menu, SinglePunch

Constant Summary collapse

VERSION =
'0.0.3'

Class Method Summary collapse

Class Method Details

.http_start(uri) ⇒ Object



159
160
161
162
163
# File 'lib/paycom.rb', line 159

def http_start(uri)
  Net::HTTP.start uri.host, uri.port, :use_ssl => uri.scheme == 'https' do |http|
    yield http
  end
end

.week_punch(login, date) ⇒ Object



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/paycom.rb', line 165

def week_punch(,date)
  punches = {
      'ID' => DateTime.now.beginning_of_day + 8.hours,
      'OL' => DateTime.now.beginning_of_day + 12.hours,
      'IL' => DateTime.now.beginning_of_day + 13.hours,
      'OD' => DateTime.now.beginning_of_day + 17.hours
  }
  single = SinglePunch.new 
  single.punch_date_start = date.beginning_of_week
  single.punch_date_end = date.end_of_week - 2.days
  punches.each_pair do |type,punch_time|
    single.punch_time = punch_time
    single.punch_type = type
    single.punch_dept = type[0] == 'I' ? '103750' : ''
    single.punch
  end
end