Class: SmbCloud::Auth::Client
- Inherits:
-
Object
- Object
- SmbCloud::Auth::Client
- Defined in:
- lib/auth.rb
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#app_secret ⇒ Object
readonly
Returns the value of attribute app_secret.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
Instance Method Summary collapse
-
#initialize(environment:, app_id:, app_secret:) ⇒ Client
constructor
A new instance of Client.
- #login(email:, password:) ⇒ Object
- #logout(access_token:) ⇒ Object
- #me(access_token:) ⇒ Object
- #remove(access_token:) ⇒ Object
- #signup(email:, password:) ⇒ Object
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_id ⇒ Object (readonly)
Returns the value of attribute app_id.
28 29 30 |
# File 'lib/auth.rb', line 28 def app_id @app_id end |
#app_secret ⇒ Object (readonly)
Returns the value of attribute app_secret.
28 29 30 |
# File 'lib/auth.rb', line 28 def app_secret @app_secret end |
#environment ⇒ Object (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 login(email:, password:) Auth.send(:parse_json, Auth.__login_with_client(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 |