New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release - 0.3.0 #50
Release - 0.3.0 #50
Conversation
# frozen_string_literal: true | ||
|
||
module API | ||
module V1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has the name 'v1' |
private | ||
|
||
# helper method to access the current user from the token | ||
def current_user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused methods (api::v1::applicationcontroller#current_user) |
# frozen_string_literal: true | ||
|
||
module API | ||
module V1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has the name 'v1' |
include ErrorHandlerConcern | ||
|
||
# Overridden from doorkeeper as the doorkeeper revoke action does not return response according to json-api spec | ||
def revoke |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused methods (api::v1::tokenscontroller#revoke) |
# The authorization server responds with HTTP status code 200 if the client | ||
# submitted an invalid token or the token has been revoked successfully. | ||
if token.blank? | ||
render json: token_revoke_response, status: :ok |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calls 'render json: token_revoke_response, status: :ok' 2 times |
# of the error by the authorization server as described below. | ||
elsif authorized? | ||
revoke_token | ||
render json: token_revoke_response, status: :ok |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calls 'render json: token_revoke_response, status: :ok' 2 times |
} | ||
end | ||
|
||
def token_revoke_response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't depend on instance state (maybe move it to another class?) |
# frozen_string_literal: true | ||
|
||
module API | ||
module V1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has the name 'v1' |
# frozen_string_literal: true | ||
|
||
module API | ||
module V1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has the name 'v1' |
render json: { errors: jsonapi_errors }, status: status | ||
end | ||
|
||
def build_error(detail:, source: nil, code: nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't depend on instance state (maybe move it to another class?) |
protected | ||
|
||
def update_allowed_parameters | ||
devise_parameter_sanitizer.permit(:sign_up) do |u| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has the variable name 'u' |
devise_parameter_sanitizer.permit(:sign_up) do |u| | ||
u.permit(:first_name, :last_name, :email, :password, :password_confirmation) | ||
end | ||
devise_parameter_sanitizer.permit(:account_update) do |u| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has the variable name 'u' |
@@ -11,4 +11,25 @@ def self.authenticate(email, password) | |||
user = User.find_for_authentication(email: email) | |||
user&.valid_password?(password) ? user : nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is controlled by argument 'password' |
end | ||
|
||
def as_json(_options = nil) | ||
{ errors: @errors.errors.map { |e| { detail: e.full_message, source: e.attribute } } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refers to 'e' more than self (maybe move it to another class?) |
end | ||
|
||
def as_json(_options = nil) | ||
{ errors: @errors.errors.map { |e| { detail: e.full_message, source: e.attribute } } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has the variable name 'e' |
@uri = URI("#{BASE_SEARCH_URL}?q=#{@escaped_keyword}&hl=#{lang}&gl=#{lang}") | ||
end | ||
|
||
def call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has approx 6 statements |
return false unless valid_result? result | ||
|
||
result | ||
rescue HTTParty::Error, Timeout::Error, SocketError => e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has the variable name 'e' |
</a> | ||
</div> | ||
<div class="collapse" id="newPassword"> | ||
<% if @minimum_password_length %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace instance variable with local variable |
</div> | ||
<div class="collapse" id="newPassword"> | ||
<% if @minimum_password_length %> | ||
<em>(<%= "#{@minimum_password_length} #{t('min_char')}" %>)</em> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace instance variable with local variable |
</div> | ||
<div class="form-group"> | ||
<%= f.label :password %><br/> | ||
<% if @minimum_password_length %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace instance variable with local variable |
Generated by 🚫 Danger |
<div class="form-group"> | ||
<%= f.label :password %><br/> | ||
<% if @minimum_password_length %> | ||
<em>(<%= "#{@minimum_password_length} #{t('min_char')}" %>)</em> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace instance variable with local variable |
Features
Chores
Bugs
N/A