Skip to content

Commit

Permalink
Add method to Get API App
Browse files Browse the repository at this point in the history
  • Loading branch information
jyoung488 committed Sep 12, 2017
1 parent b3fd0ac commit ba55354
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/controllers/apps_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class AppsController < ApplicationController
skip_before_action :verify_authenticity_token

def info
client = App.initiate_client

app = client.get_api_app :client_id => params[:client_id]

render json: app
end
end
5 changes: 5 additions & 0 deletions app/models/app.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class App < ApplicationRecord
def self.initiate_client
HelloSign::Client.new :api_key => ENV['HS_KEY']
end
end
Empty file added app/views/apps/info.html.erb
Empty file.
9 changes: 9 additions & 0 deletions app/views/signs/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ Hello API event received
<%= link_to 'Update Template', templates_update_path %>
</li>
</ul>
<h4>API Apps</h4>
<ul>
<li>
<%= form_tag("/apps/info", method: "get") do %>
<%= text_field_tag(:client_id, nil, :placeholder => 'Client ID') %>
<%= submit_tag("Get API App") %>
<% end %>
</li>
</ul>
</div>
<div align="center">
<%= link_to 'Embedded Signatures', embeddeds_path %>
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@

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

get '/apps/info' => 'apps#info'
end

0 comments on commit ba55354

Please sign in to comment.