Class: Horoshop::Authorization
- Defined in:
- lib/horoshop/authorization.rb
Overview
Class for user authorization
Constant Summary collapse
- AUTH_URL =
'/api/auth/'
- EXPIRATION_TIME =
600
Constants included from Connection
Instance Method Summary collapse
Methods inherited from Base
Methods included from Connection
#connection, #mixin_token!, #post
Constructor Details
This class inherits a constructor from Horoshop::Base
Instance Method Details
#authorize ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/horoshop/authorization.rb', line 11 def response = post(horoshop: horoshop, url: AUTH_URL, body: body) return response unless response['status'] == 'OK' horoshop.token = response.dig('response', 'token') horoshop. = Time.now + EXPIRATION_TIME response end |