lib/finapps/rest/operators_password_resets.rb in finapps-4.0.3 vs lib/finapps/rest/operators_password_resets.rb in finapps-4.0.4
- old
+ new
@@ -1,11 +1,11 @@
# frozen_string_literal: true
module FinApps
module REST
class OperatorsPasswordResets < FinAppsCore::REST::Resources
- def create(params, path=nil)
+ def create(params, path = nil)
not_blank(params, :params)
validates_email(params) if path.nil?
path ||= 'operators/password/forgot'
@@ -20,12 +20,14 @@
end
private
def validates_email(params)
- unless params.key?(:email) && params[:email]
- raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params.'
- end
+ raise FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless email_exists? params
+ end
+
+ def email_exists?(params)
+ params.key?(:email) && params[:email]
end
end
end
end