Class: SecondAmendmentWholesale::User

Inherits:
Base
  • Object
show all
Includes:
API
Defined in:
lib/second_amendment_wholesale/user.rb

Constant Summary

Constants included from API

API::ROOT_API_URL

Instance Method Summary collapse

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(options = {})
  requires!(options, :token)

  @options = options
end

Instance Method Details

#authenticated?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/second_amendment_wholesale/user.rb', line 12

def authenticated?
  headers = [
    *auth_header(@options[:token]),
    *content_type_header('application/json'),
  ].to_h

  response = get_request(
    'token/validate',
    headers
  )

  response.body.present?
end