Sha256: d2d24aa63a8c18655545516c50a4f6165bc4b885aeb95128597c9d41468af7ae

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

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

    def create
      create_resource
    end

    def activate
      Ribose::Request.post(
        "api/v2/auth",
        custom_option.merge(
          user: attributes,
          auth_header: false,
          client: Ribose::Client.new
        ),
      )
    end

    # Activate a user
    #
    # @param email [String] The registering user email
    # @param password [String] A strong password for login
    # @param edata [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:, edata:, **attributes)
      new(attributes.merge(email: email, password: password, edata: edata)).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

2 entries across 2 versions & 1 rubygems

Version Path
ribose-0.5.0 lib/ribose/user.rb
ribose-0.4.1 lib/ribose/user.rb