This repository has been archived by the owner on Feb 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
93 additions
and
136 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
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,18 +1,17 @@ | ||
class Api::ExchangesController < ApiController | ||
|
||
def index | ||
exchanges = Exchange.order(:name) | ||
@pagy, @exchanges = pagy(exchanges, items: 2) | ||
@pagy_metadata = pagy_metadata(@pagy) | ||
|
||
api_user.charge_credits(1, nil, 'Exchange index') | ||
api_user.charge_credits(1, nil, "Exchange index") | ||
end | ||
|
||
def show | ||
@exchange = Exchange.find_by('lower(acronym) = ? OR lower(mic_code) = ?', params[:id].downcase, params[:id].downcase) | ||
@exchange = Exchange.find_by("lower(acronym) = ? OR lower(mic_code) = ?", params[:id].downcase, params[:id].downcase) | ||
|
||
api_user.charge_credits(1, @exchange) | ||
|
||
raise ActiveRecord::RecordNotFound if @exchange.nil? | ||
end | ||
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
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,10 +1,10 @@ | ||
class PagesController < ApplicationController | ||
before_action :authenticate_user!, only: [:dashboard] | ||
before_action :authenticate_user!, only: [ :dashboard ] | ||
|
||
def index | ||
redirect_to dashboard_path# if user_signed_in? | ||
end | ||
|
||
def dashboard | ||
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
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
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
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,7 +1,7 @@ | ||
json.data do | ||
json.partial! 'exchange', locals: {exchange: @exchange} | ||
json.partial! "exchange", locals: { exchange: @exchange } | ||
end | ||
json.meta do | ||
json.credits_used 1 | ||
json.credits_remaining @api_key.user.balance | ||
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
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 |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
# Configure the e-mail address which will be shown in Devise::Mailer, | ||
# note that it will be overwritten if you use your own mailer class | ||
# with default "from" parameter. | ||
config.mailer_sender = '[email protected]' | ||
config.mailer_sender = "[email protected]" | ||
|
||
# Configure the class responsible to send e-mails. | ||
# config.mailer = 'Devise::Mailer' | ||
|
@@ -36,7 +36,7 @@ | |
# Load and configure the ORM. Supports :active_record (default) and | ||
# :mongoid (bson_ext recommended) by default. Other ORMs may be | ||
# available as additional gems. | ||
require 'devise/orm/active_record' | ||
require "devise/orm/active_record" | ||
|
||
# ==> Configuration for any authentication mechanism | ||
# Configure which keys are used when authenticating a user. The default is | ||
|
@@ -58,12 +58,12 @@ | |
# Configure which authentication keys should be case-insensitive. | ||
# These keys will be downcased upon creating or modifying a user and when used | ||
# to authenticate or find a user. Default is :email. | ||
config.case_insensitive_keys = [:email] | ||
config.case_insensitive_keys = [ :email ] | ||
|
||
# Configure which authentication keys should have whitespace stripped. | ||
# These keys will have whitespace before and after removed upon creating or | ||
# modifying a user and when used to authenticate or find a user. Default is :email. | ||
config.strip_whitespace_keys = [:email] | ||
config.strip_whitespace_keys = [ :email ] | ||
|
||
# Tell if authentication through request.params is enabled. True by default. | ||
# It can be set to an array that will enable params authentication only for the | ||
|
@@ -97,7 +97,7 @@ | |
# Notice that if you are skipping storage for all authentication paths, you | ||
# may want to disable generating routes to Devise's sessions controller by | ||
# passing skip: :sessions to `devise_for` in your config/routes.rb | ||
config.skip_session_storage = [:http_auth] | ||
config.skip_session_storage = [ :http_auth ] | ||
|
||
# By default, Devise cleans up the CSRF token on authentication to | ||
# avoid CSRF token fixation attacks. This means that, when using AJAX | ||
|
@@ -273,14 +273,14 @@ | |
# up on your models and hooks. | ||
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' | ||
|
||
config.omniauth :google_oauth2, ENV['GOOGLE_CLIENT_ID'], ENV['GOOGLE_CLIENT_SECRET'], | ||
config.omniauth :google_oauth2, ENV["GOOGLE_CLIENT_ID"], ENV["GOOGLE_CLIENT_SECRET"], | ||
{ | ||
name: 'google_oauth2', | ||
name: "google_oauth2", | ||
strategy_class: OmniAuth::Strategies::GoogleOauth2, | ||
access_type: 'offline' | ||
access_type: "offline" | ||
} | ||
|
||
config.omniauth :github, ENV['GITHUB_CLIENT_ID'], ENV['GITHUB_CLIENT_SECRET'], scope: 'user:email' | ||
config.omniauth :github, ENV["GITHUB_CLIENT_ID"], ENV["GITHUB_CLIENT_SECRET"], scope: "user:email" | ||
|
||
# ==> Warden configuration | ||
# If you want to use other strategies, that are not supported by Devise, or | ||
|
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,3 @@ | ||
Rails.application.config.generators do |g| | ||
g.orm :active_record, primary_key_type: :uuid | ||
end | ||
end |
Oops, something went wrong.