Class: Polar::Authentication::CustomerAuth
- Inherits:
-
Object
- Object
- Polar::Authentication::CustomerAuth
- Defined in:
- lib/polar/authentication.rb
Overview
Customer Access Token authentication
Instance Attribute Summary collapse
-
#customer_session ⇒ Object
readonly
Returns the value of attribute customer_session.
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize(customer_session) ⇒ CustomerAuth
constructor
A new instance of CustomerAuth.
- #valid? ⇒ Boolean
Constructor Details
#initialize(customer_session) ⇒ CustomerAuth
Returns a new instance of CustomerAuth.
44 45 46 47 |
# File 'lib/polar/authentication.rb', line 44 def initialize(customer_session) @customer_session = customer_session validate_token! end |
Instance Attribute Details
#customer_session ⇒ Object (readonly)
Returns the value of attribute customer_session.
42 43 44 |
# File 'lib/polar/authentication.rb', line 42 def customer_session @customer_session end |
Instance Method Details
#headers ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/polar/authentication.rb', line 49 def headers { 'Authorization' => "Bearer #{customer_session}", 'Content-Type' => 'application/json', 'Accept' => 'application/json' } end |
#valid? ⇒ Boolean
57 58 59 |
# File 'lib/polar/authentication.rb', line 57 def valid? !customer_session.nil? && !customer_session.empty? end |