Sha256: 120bc9d38cf2da7ad951e71459a278748418616f08d1f7a466c451f9e1a9885b

Contents?: true

Size: 546 Bytes

Versions: 3

Compression:

Stored size: 546 Bytes

Contents

module SecondAmendmentWholesale
  class User < Base

    include SecondAmendmentWholesale::API

    def initialize(options = {})
      requires!(options, :token)

      @options = options
    end

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

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

      response.body.present?
    rescue SecondAmendmentWholesale::Error::NotAuthorized => e
      false
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
second_amendment_wholesale-1.0.5 lib/second_amendment_wholesale/user.rb
second_amendment_wholesale-1.0.3 lib/second_amendment_wholesale/user.rb
second_amendment_wholesale-1.0.2 lib/second_amendment_wholesale/user.rb