Skip to content

Commit ba55354

Browse files
committed
Add method to Get API App
1 parent b3fd0ac commit ba55354

5 files changed

Lines changed: 26 additions & 0 deletions

File tree

app/controllers/apps_controller.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class AppsController < ApplicationController
2+
skip_before_action :verify_authenticity_token
3+
4+
def info
5+
client = App.initiate_client
6+
7+
app = client.get_api_app :client_id => params[:client_id]
8+
9+
render json: app
10+
end
11+
end

app/models/app.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class App < ApplicationRecord
2+
def self.initiate_client
3+
HelloSign::Client.new :api_key => ENV['HS_KEY']
4+
end
5+
end

app/views/apps/info.html.erb

Whitespace-only changes.

app/views/signs/index.html.erb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ Hello API event received
5656
<%= link_to 'Update Template', templates_update_path %>
5757
</li>
5858
</ul>
59+
<h4>API Apps</h4>
60+
<ul>
61+
<li>
62+
<%= form_tag("/apps/info", method: "get") do %>
63+
<%= text_field_tag(:client_id, nil, :placeholder => 'Client ID') %>
64+
<%= submit_tag("Get API App") %>
65+
<% end %>
66+
</li>
67+
</ul>
5968
</div>
6069
<div align="center">
6170
<%= link_to 'Embedded Signatures', embeddeds_path %>

config/routes.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@
3232

3333
get '/templates/update' => 'templates#update'
3434

35+
get '/apps/info' => 'apps#info'
3536
end

0 commit comments

Comments
 (0)