Class: Ruboty::Actions::Jobcan
- Inherits:
-
Object
- Object
- Ruboty::Actions::Jobcan
- Defined in:
- lib/ruboty/actions/jobcan.rb
Defined Under Namespace
Classes: JobcanClient
Constant Summary collapse
- NAMESPACE =
"jobcan"
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #clock_in ⇒ Object
- #clock_out ⇒ Object
-
#initialize(message) ⇒ Jobcan
constructor
A new instance of Jobcan.
- #punch_clock(in_out = :auto) ⇒ Object
- #remember_code ⇒ Object
- #remember_group_id ⇒ Object
Constructor Details
#initialize(message) ⇒ Jobcan
Returns a new instance of Jobcan.
11 12 13 |
# File 'lib/ruboty/actions/jobcan.rb', line 11 def initialize() @message = end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
9 10 11 |
# File 'lib/ruboty/actions/jobcan.rb', line 9 def @message end |
Instance Method Details
#clock_in ⇒ Object
42 43 44 |
# File 'lib/ruboty/actions/jobcan.rb', line 42 def clock_in punch_clock(:in) end |
#clock_out ⇒ Object
46 47 48 |
# File 'lib/ruboty/actions/jobcan.rb', line 46 def clock_out punch_clock(:out) end |
#punch_clock(in_out = :auto) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ruboty/actions/jobcan.rb', line 25 def punch_clock(in_out = :auto) unless (code = user_data["code"]) .reply("I don't know your JOBCAN code.") return end unless (group_id = user_data["group_id"]) .reply("I don't know your JOBCAN group ID.") return end client = JobcanClient.new(code, group_id, in_out) client.authenticate! status = client.punch_clock! .reply("OK, your current status is #{status}.") rescue .reply("Error: #{$!}") end |
#remember_code ⇒ Object
15 16 17 18 |
# File 'lib/ruboty/actions/jobcan.rb', line 15 def remember_code user_data["code"] = [:code] .reply("I remember.") end |
#remember_group_id ⇒ Object
20 21 22 23 |
# File 'lib/ruboty/actions/jobcan.rb', line 20 def remember_group_id user_data["group_id"] = [:group_id] .reply("I remember.") end |