Sha256: 25c84465df82248abed2e69c80b24e09d1593044a7283df5f6511fe5b09c36d8

Contents?: true

Size: 954 Bytes

Versions: 5

Compression:

Stored size: 954 Bytes

Contents

module Ribose
  class User < Ribose::Base
    include Ribose::Actions::Create

    def create
      create_resource
    end

    def activate
      Ribose::Request.post(
        "signup.user",
        custom_option.merge(user: attributes, auth_header: false),
      )
    end

    # Activate a user
    #
    # @param email [String] The registering user email
    # @param password [String] A strong password for login
    # @param otp [String] The OTP received via the email
    # @param attributes [Hash] The other attributes as Hash.
    # @return [Sawyer::Resoruce] The newly activated user
    #
    def self.activate(email:, password:, otp:, **attributes)
      new(attributes.merge(email: email, password: password, otp: otp)).activate
    end

    private

    def resource
      "user"
    end

    def resources_path
      "signup_requests"
    end

    def validate(email:, **attributes)
      attributes.merge(email: email)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ribose-0.4.0 lib/ribose/user.rb
ribose-0.3.2 lib/ribose/user.rb
ribose-0.3.1 lib/ribose/user.rb
ribose-0.3.0 lib/ribose/user.rb
ribose-0.2.0 lib/ribose/user.rb