Skip to content

Commit 0e6ff09

Browse files
committed
Add callback method and parsing JSON data
1 parent 7060ae4 commit 0e6ff09

4 files changed

Lines changed: 26 additions & 7 deletions

File tree

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
class CallbacksController < ApplicationController
2+
skip_before_action :verify_authenticity_token
3+
24
def index
3-
@event = params["json"]
5+
@event = JSON.parse(params.to_json, symbolize_names: true)
6+
end
7+
8+
def create
9+
event = JSON.parse(params["json"], symbolize_names: true)
10+
# event = @response["json"]
11+
# object = JSON.parse(event, symbolize_names: true)
12+
# p "***** EVENT TYPE"
13+
# p event_type = object[:event][:event_type]
14+
15+
# client = Sign.initiate_client
16+
17+
event_type = event[:event][:event_type]
18+
419
end
520
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Hello API event received
2+
3+
<%= @event %>

app/views/callbacks/index.html.erb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
Hello API event received
2-
3-
<div class="response-data">
4-
<%= @event %>
5-
</div>
1+
<%= @event %>

config/routes.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
Rails.application.routes.draw do
22
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
33
resources :signs
4-
resources :callbacks
4+
# resources :callbacks
55

66
root 'signs#index'
77

88
post '/' => 'signs#index'
99

10+
get '/callbacks' => 'callbacks#index'
11+
post '/callbacks' => 'callbacks#create'
12+
1013
get 'account' => 'signs#account'
1114
get 'signature-request' => 'signs#signature_request'
1215
get 'all-requests' => 'signs#all_requests'
@@ -25,4 +28,6 @@
2528
get '/embeddeds/unclaimed-draft' => 'embeddeds#unclaimed_draft'
2629
get '/embeddeds/unclaimed-draft-template' => 'embeddeds#unclaimed_draft_template'
2730
get '/embeddeds/template-draft' => 'embeddeds#template_draft'
31+
32+
2833
end

0 commit comments

Comments
 (0)