Sha256: 0f5c0dbf9c2ab238bc47e24e3f5798d2799d5cb8dd980ff7092e9fe856876c2a

Contents?: true

Size: 726 Bytes

Versions: 2

Compression:

Stored size: 726 Bytes

Contents

require "pry"

class ChatopsController < ApplicationController
  include ::Chatops::Controller
  # The default chatops RPC prefix. Clients may replace this.
  chatops_namespace :example

  skip_before_action :verify_authenticity_token
  
  chatop :echo,
  /echo\s+(?<text>.*)/,
  "echo <text> - Echo some text back" do
    jsonrpc_success "Echoing back to you: #{jsonrpc_params[:text]}"
  end

  chatop :user,
  /user/,
  "user - returns the user" do
    jsonrpc_success params[:user]
  end

  chatop :room_id,
  /room_id/,
  "room_id - returns the user" do
    jsonrpc_success params[:room_id]
  end

  chatop :params_chatop,
  /params/,
  "params - returns the params" do
    jsonrpc_success JSON.generate(params)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chatops-rpc-0.0.2 fixtures/chatops-controller-example/app/controllers/chatops_controller.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/app/controllers/chatops_controller.rb