Sha256: 8844b1c898c55976303773bc03085d3ff092e72dcbf9c9e817ebea6c722e55b9

Contents?: true

Size: 741 Bytes

Versions: 44

Compression:

Stored size: 741 Bytes

Contents

# frozen_string_literal: true

module FinApps
  module REST
    class OperatorsPasswordResets < FinAppsCore::REST::Resources
      def create(params, path = nil)
        not_blank(params, :params)
        validates_email(params) if path.nil?

        path ||= 'operators/password/forgot'

        super params, path
      end

      def update(params)
        not_blank(params, :params)

        path = 'operators/password/reset'
        create params, path
      end

      private

      def validates_email(params)
        raise FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless email_exists? params
      end

      def email_exists?(params)
        params.key?(:email) && params[:email]
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
finapps-5.0.32 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.31 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.30 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.29 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.28 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.27 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.26 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.25 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.24 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.23 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.22 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.21 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.20 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.19 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.17 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.16 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.15 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.14 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.13 lib/finapps/rest/operators_password_resets.rb
finapps-5.0.12 lib/finapps/rest/operators_password_resets.rb