Module: Bithavoc::Identity::SignUp

Included in:
Client
Defined in:
lib/bithavoc/identity/operations/signup.rb

Constant Summary collapse

SIGNUP_PASSTHROUGH =
['email', 'fullname', 'password']

Instance Method Summary collapse

Instance Method Details

#sign_up(options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/bithavoc/identity/operations/signup.rb', line 3

def (options)
    options = Hash[(options.select {|k,v| .include?(k.to_s) }.merge!({:password_confirmation=> options['password'] || options[:password]})).sort]
    res = self.class.post("/apps/#{app_id}/sign-up", body: options)
    case res.code
    when 200
        nil
    when 422
        raise Bithavoc::Identity::IdentityError.new, res['message']
    else
        raise Bithavoc::Identity::IdentityError.new, "Something went wrong while validating your credentials"
    end
end