module Kamiflex::Actions

Public Instance Methods

message_action(label, **params) click to toggle source
# File lib/kamiflex/actions.rb, line 3
def message_action(label, **params)
  {
    type: "message",
    label: label,
    text: params[:text] || label
  }.merge(params)
end
postback_action(data, **params) click to toggle source
# File lib/kamiflex/actions.rb, line 28
def postback_action(data, **params)
  {
    type: "postback",
    data: data
  }.merge(params)
end
uri_action(uri, **params) click to toggle source
# File lib/kamiflex/actions.rb, line 11
def uri_action(uri, **params)
  action = {
    type: "uri",
    label: uri[0...40],
    uri: uri
  }

  return action if params.nil?
  return action if params[:desktop].nil?

  action[:altUri] = {
    desktop: params[:desktop]
  }

  action
end