Class: Ruboty::Actions::Jobcan
- Inherits:
-
Object
- Object
- Ruboty::Actions::Jobcan
- Defined in:
- lib/ruboty/actions/jobcan.rb
Constant Summary collapse
- NAMESPACE =
"jobcan"
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #clock_in_out ⇒ Object
-
#initialize(message) ⇒ Jobcan
constructor
A new instance of Jobcan.
- #register_group_alias ⇒ Object
- #remember_code ⇒ Object
- #remember_group_id ⇒ Object
Constructor Details
#initialize(message) ⇒ Jobcan
Returns a new instance of Jobcan.
13 14 15 |
# File 'lib/ruboty/actions/jobcan.rb', line 13 def initialize() @message = end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
11 12 13 |
# File 'lib/ruboty/actions/jobcan.rb', line 11 def @message end |
Instance Method Details
#clock_in_out ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ruboty/actions/jobcan.rb', line 32 def clock_in_out unless client .reply("I don't know your JOBCAN login info.") return end if (group_name = [:group_name]) unless (group_id = user_data["alias_#{group_name}"]) .reply("I don't know that JOBCAN group alias '#{group_name}'.") return end else unless (group_id = user_data["group_id"]) .reply("I don't know your JOBCAN group ID.") return end end result = client.clock([:in_out].to_sym, group_id: group_id) unless result.is_a?(Hash) && (current_status = result["current_status"]) .reply("I got unknown response from JOBCAN: #{result}.") return end .reply("OK, your current status is #{current_status}.") end |
#register_group_alias ⇒ Object
27 28 29 30 |
# File 'lib/ruboty/actions/jobcan.rb', line 27 def register_group_alias user_data["alias_#{[:group_name]}"] = [:group_id] .reply("I registered alias #{[:group_name]} to ID #{[:group_id]}.") end |
#remember_code ⇒ Object
17 18 19 20 |
# File 'lib/ruboty/actions/jobcan.rb', line 17 def remember_code user_data["code"] = [:code] .reply("I remember.") end |
#remember_group_id ⇒ Object
22 23 24 25 |
# File 'lib/ruboty/actions/jobcan.rb', line 22 def remember_group_id user_data["group_id"] = [:group_id] .reply("I remember.") end |