Class: ShopExpress::Authorization
- Defined in:
- lib/shop_express/authorization.rb
Overview
Class for user authorization
Constant Summary collapse
- AUTH_URL =
'/api/auth/'- EXPIRATION_TIME =
600
Constants inherited from Base
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 ShopExpress::Base
Instance Method Details
#authorize ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/shop_express/authorization.rb', line 11 def response = post(shop_express: shop_express, url: AUTH_URL, body: body) return response unless response['status'] == 'OK' shop_express.token = response.dig('response', 'token') shop_express. = Time.now + EXPIRATION_TIME response end |