<commit_before>module FinApps
  module REST
    class OperatorsPasswordResets < FinAppsCore::REST::Resources
      def create(params, path=nil)
        not_blank(params, :params)

        path ||= "operators/password/forgot"

        super params, path
      end
    end
  end
end<commit_msg>Add Operator Password Reset Endpoints<commit_after>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)
        unless params.key?(:email) && params[:email]
          raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params.'
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08275174476570289, 'fraction_numerical': 0.0, 'mean_word_length': 2.598566308243728, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2003035', 'n_tokens_mistral': 298, 'n_tokens_neox': 283, 'n_words': 71}