Class: Rubotnik::PostbackDispatch
- Inherits:
-
Object
- Object
- Rubotnik::PostbackDispatch
- Defined in:
- lib/rubotnik/postback_dispatch.rb
Overview
Routing for postbacks
Constant Summary
Constants included from Helpers
Instance Attribute Summary collapse
-
#postback ⇒ Object
readonly
Returns the value of attribute postback.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(postback) ⇒ PostbackDispatch
constructor
A new instance of PostbackDispatch.
- #route(&block) ⇒ Object
Methods included from Helpers
call_graph_api, get_user_info, message_contains_location?, next_command, say, send_message, show, stop_thread, text_message?
Constructor Details
#initialize(postback) ⇒ PostbackDispatch
Returns a new instance of PostbackDispatch.
12 13 14 15 16 17 |
# File 'lib/rubotnik/postback_dispatch.rb', line 12 def initialize(postback) @postback = postback p @postback.class p @postback @user = Rubotnik::UserStore.instance.find_or_create_user(@postback.sender['id']) end |
Instance Attribute Details
#postback ⇒ Object (readonly)
Returns the value of attribute postback.
10 11 12 |
# File 'lib/rubotnik/postback_dispatch.rb', line 10 def postback @postback end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
10 11 12 |
# File 'lib/rubotnik/postback_dispatch.rb', line 10 def user @user end |
Instance Method Details
#route(&block) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/rubotnik/postback_dispatch.rb', line 19 def route(&block) @matched = false instance_eval(&block) rescue StandardError => error raise unless ENV["DEBUG"] == "true" stop_thread say "There was an error: #{error}" end |