-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from jyoung488/add-apiapp
Add apiapp
- Loading branch information
Showing
22 changed files
with
226 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
class ApplicationController < ActionController::Base | ||
protect_from_forgery with: :exception | ||
|
||
before_action :client | ||
|
||
private | ||
|
||
def client | ||
client = ApplicationRecord.initiate_client | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
class AppsController < ApplicationController | ||
skip_before_action :verify_authenticity_token | ||
|
||
def info | ||
app = client.get_api_app :client_id => params[:client_id] | ||
|
||
render json: app | ||
end | ||
|
||
def list | ||
app_list = client.get_api_apps :page => 2 | ||
|
||
render json: app_list | ||
end | ||
|
||
def create | ||
|
||
white_labeling = { | ||
"primary_button_color":"#778899", | ||
"primary_button_text_color":"#ffffff" | ||
} | ||
|
||
app = client.create_api_app( | ||
:name => params[:app_name], | ||
:domain => 'www.rubyonrails.com', | ||
:white_labeling_options => white_labeling.to_json | ||
) | ||
|
||
render json: app | ||
end | ||
|
||
def update | ||
app = client.update_api_app( | ||
:name => params[:app_name], | ||
:client_id => params[:client_id] | ||
) | ||
|
||
render json: app | ||
end | ||
|
||
def delete | ||
client.delete_api_app :client_id => params[:client_id] | ||
|
||
flash[:notice] = "App deleted!" | ||
redirect_to root_path | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.