Class: Ribose::User

Inherits:
Base
  • Object
show all
Includes:
Actions::Create
Defined in:
lib/ribose/user.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Actions::Base

#included

Methods inherited from Base

#initialize

Methods included from ResourceHelper

#resource_id, #resource_key, #resource_path, #resources

Constructor Details

This class inherits a constructor from Ribose::Base

Class Method Details

.activate(email:, password:, edata:, **attributes) ⇒ Sawyer::Resoruce

Activate a user

Parameters:

  • email (String)

    The registering user email

  • password (String)

    A strong password for login

  • edata (String)

    The OTP received via the email

  • attributes (Hash)

    The other attributes as Hash.

Returns:

  • (Sawyer::Resoruce)

    The newly activated user



28
29
30
# File 'lib/ribose/user.rb', line 28

def self.activate(email:, password:, edata:, **attributes)
  new(attributes.merge(email: email, password: password, edata: edata)).activate
end

Instance Method Details

#activateObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/ribose/user.rb', line 9

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

#createObject



5
6
7
# File 'lib/ribose/user.rb', line 5

def create
  create_resource
end