Class: SmbCloud::Auth::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/auth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment:, app_id:, app_secret:) ⇒ Client

Returns a new instance of Client.



30
31
32
33
34
# File 'lib/auth.rb', line 30

def initialize(environment:, app_id:, app_secret:)
  @environment = environment
  @app_id = app_id
  @app_secret = app_secret
end

Instance Attribute Details

#app_idObject (readonly)

Returns the value of attribute app_id.



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

def app_id
  @app_id
end

#app_secretObject (readonly)

Returns the value of attribute app_secret.



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

def app_secret
  @app_secret
end

#environmentObject (readonly)

Returns the value of attribute environment.



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

def environment
  @environment
end

Instance Method Details

#login(email:, password:) ⇒ Object



42
43
44
45
46
# File 'lib/auth.rb', line 42

def (email:, password:)
  Auth.send(:parse_json, Auth.(environment, app_id, app_secret, email, password))
rescue RuntimeError => e
  raise Auth.send(:normalize_error, e)
end

#logout(access_token:) ⇒ Object



54
55
56
57
58
# File 'lib/auth.rb', line 54

def logout(access_token:)
  Auth.__logout_with_client(environment, app_id, app_secret, access_token)
rescue RuntimeError => e
  raise Auth.send(:normalize_error, e)
end

#me(access_token:) ⇒ Object



48
49
50
51
52
# File 'lib/auth.rb', line 48

def me(access_token:)
  Auth.send(:parse_json, Auth.__me_with_client(environment, app_id, app_secret, access_token))
rescue RuntimeError => e
  raise Auth.send(:normalize_error, e)
end

#remove(access_token:) ⇒ Object



60
61
62
63
64
# File 'lib/auth.rb', line 60

def remove(access_token:)
  Auth.__remove_with_client(environment, app_id, app_secret, access_token)
rescue RuntimeError => e
  raise Auth.send(:normalize_error, e)
end

#signup(email:, password:) ⇒ Object



36
37
38
39
40
# File 'lib/auth.rb', line 36

def (email:, password:)
  Auth.send(:parse_json, Auth.(environment, app_id, app_secret, email, password))
rescue RuntimeError => e
  raise Auth.send(:normalize_error, e)
end