Class: Neoway::Auth::Authentication
- Inherits:
-
Object
- Object
- Neoway::Auth::Authentication
- Defined in:
- lib/neoway/auth/authentication.rb
Instance Method Summary collapse
-
#initialize(connection: Connection.new, application_name: Neoway.configuration.application_name, application_secret: Neoway.configuration.application_secret) ⇒ Authentication
constructor
A new instance of Authentication.
- #login(body: login_body) ⇒ Object
Constructor Details
#initialize(connection: Connection.new, application_name: Neoway.configuration.application_name, application_secret: Neoway.configuration.application_secret) ⇒ Authentication
Returns a new instance of Authentication.
6 7 8 9 10 11 12 |
# File 'lib/neoway/auth/authentication.rb', line 6 def initialize(connection: Connection.new, application_name: Neoway.configuration.application_name, application_secret: Neoway.configuration.application_secret) @application_name = application_name @application_secret = application_secret @connection = connection end |
Instance Method Details
#login(body: login_body) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/neoway/auth/authentication.rb', line 14 def login(body: login_body) res = @connection.post(url: Neoway::Auth::AUTH_ENDPOINT, body: body) return parse_result(res) if res.status == 200 raise_error_by_status(res.status) end |