Class: SecondAmendmentWholesale::User
- Includes:
- API
- Defined in:
- lib/second_amendment_wholesale/user.rb
Constant Summary
Constants included from API
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
-
#initialize(options = {}) ⇒ User
constructor
A new instance of User.
Methods included from API
#delete_request, #get_request, #post_request, #put_request
Constructor Details
#initialize(options = {}) ⇒ User
Returns a new instance of User.
6 7 8 9 10 |
# File 'lib/second_amendment_wholesale/user.rb', line 6 def initialize( = {}) requires!(, :token) = end |
Instance Method Details
#authenticated? ⇒ Boolean
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/second_amendment_wholesale/user.rb', line 12 def authenticated? headers = [ *auth_header([:token]), *content_type_header('application/json'), ].to_h response = get_request( 'token/validate', headers ) response.body.present? rescue SecondAmendmentWholesale::Error::NotAuthorized => e false end |