Class: Ralyxa::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/ralyxa/handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Handler

Returns a new instance of Handler.



7
8
9
# File 'lib/ralyxa/handler.rb', line 7

def initialize(request)
  @request = request
end

Instance Method Details

#audio_playerObject



30
31
32
# File 'lib/ralyxa/handler.rb', line 30

def audio_player
  Ralyxa::ResponseEntities::Directives::AudioPlayer
end

#card(title, body, image_url = nil, card_class = Ralyxa::ResponseEntities::Card) ⇒ Object



26
27
28
# File 'lib/ralyxa/handler.rb', line 26

def card(title, body, image_url = nil, card_class = Ralyxa::ResponseEntities::Card)
  card_class.as_hash(title, body, image_url)
end

#handleObject

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/ralyxa/handler.rb', line 11

def handle
  raise NotImplementedError
end


34
35
36
# File 'lib/ralyxa/handler.rb', line 34

def (card_class = Ralyxa::ResponseEntities::Card)
  card_class.
end

#log(level, message) ⇒ Object



38
39
40
# File 'lib/ralyxa/handler.rb', line 38

def log(level, message)
  puts "[#{Time.new}] [#{@request.user_id}] #{level} - #{message}"
end