Sha256: cd385e801c2773cc9c90a86b2cd90cbdc1991ba6bc98b4da7110c3ac99879a4c

Contents?: true

Size: 1.03 KB

Versions: 45

Compression:

Stored size: 1.03 KB

Contents

module PortaText
  module Command
    module Api
      # The me/password endpoint.
      # https://github.com/PortaText/docs/wiki/REST-API#api_me_password
      #
      # Author::    Marcelo Gornstein (mailto:marcelog@portatext.com)
      # Copyright:: Copyright (c) 2015 PortaText
      # License::   Apache-2.0
      class MyPassword < Base
        def reset
          set :reset, true
        end

        def for_email(email)
          set :email, email
        end

        def with_nonce(nonce, new_password)
          set :nonce, nonce
          set :new_password, new_password
        end

        def change(old_password, new_password)
          set :old_password, old_password
          set :new_password, new_password
        end

        def endpoint(_method)
          return 'me/password' if @args[:reset].nil?
          @args.delete :reset
          return 'me/password/reset' if @args[:nonce].nil?
          nonce = @args[:nonce]
          @args.delete :nonce
          "me/password/reset/#{nonce}"
        end
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
portatext-1.6.1 lib/portatext/command/api/my_password.rb
portatext-1.6.0 lib/portatext/command/api/my_password.rb
portatext-1.5.23 lib/portatext/command/api/my_password.rb
portatext-1.5.22 lib/portatext/command/api/my_password.rb
portatext-1.5.21 lib/portatext/command/api/my_password.rb
portatext-1.5.20 lib/portatext/command/api/my_password.rb
portatext-1.5.19 lib/portatext/command/api/my_password.rb
portatext-1.5.18 lib/portatext/command/api/my_password.rb
portatext-1.5.17 lib/portatext/command/api/my_password.rb
portatext-1.5.16 lib/portatext/command/api/my_password.rb
portatext-1.5.15 lib/portatext/command/api/my_password.rb
portatext-1.5.14 lib/portatext/command/api/my_password.rb
portatext-1.5.13 lib/portatext/command/api/my_password.rb
portatext-1.5.12 lib/portatext/command/api/my_password.rb
portatext-1.5.11 lib/portatext/command/api/my_password.rb
portatext-1.5.10 lib/portatext/command/api/my_password.rb
portatext-1.5.9 lib/portatext/command/api/my_password.rb
portatext-1.5.8 lib/portatext/command/api/my_password.rb
portatext-1.5.7 lib/portatext/command/api/my_password.rb
portatext-1.5.6 lib/portatext/command/api/my_password.rb