Class: HTTP::TokenAuth::Credentials
- Inherits:
-
Object
- Object
- HTTP::TokenAuth::Credentials
- Defined in:
- lib/http/token_auth/credentials.rb
Instance Attribute Summary collapse
-
#auth ⇒ Object
readonly
Returns the value of attribute auth.
-
#coverage ⇒ Object
readonly
Returns the value of attribute coverage.
-
#nonce ⇒ Object
readonly
Returns the value of attribute nonce.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(token:, coverage: nil, nonce: nil, auth: nil, timestamp: nil) ⇒ Credentials
constructor
A new instance of Credentials.
- #to_header ⇒ Object
Constructor Details
#initialize(token:, coverage: nil, nonce: nil, auth: nil, timestamp: nil) ⇒ Credentials
Returns a new instance of Credentials.
9 10 11 12 13 14 15 16 |
# File 'lib/http/token_auth/credentials.rb', line 9 def initialize(token:, coverage: nil, nonce: nil, auth: nil, timestamp: nil) @token = token @coverage = coverage.nil? ? :none : coverage @nonce = nonce @auth = auth = validate_itself end |
Instance Attribute Details
#auth ⇒ Object (readonly)
Returns the value of attribute auth.
7 8 9 |
# File 'lib/http/token_auth/credentials.rb', line 7 def auth @auth end |
#coverage ⇒ Object (readonly)
Returns the value of attribute coverage.
7 8 9 |
# File 'lib/http/token_auth/credentials.rb', line 7 def coverage @coverage end |
#nonce ⇒ Object (readonly)
Returns the value of attribute nonce.
7 8 9 |
# File 'lib/http/token_auth/credentials.rb', line 7 def nonce @nonce end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
7 8 9 |
# File 'lib/http/token_auth/credentials.rb', line 7 def end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/http/token_auth/credentials.rb', line 7 def token @token end |
Instance Method Details
#to_header ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/http/token_auth/credentials.rb', line 18 def to_header attributes = [] attributes << %(token="#{@token}") unless coverage == :none attributes << %(coverage="#{coverage_name}") attributes << %(nonce="#{@nonce}") attributes << %(auth="#{@auth}") attributes << %(timestamp="#{@timestamp}") end "Token #{attributes.join(', ')}" end |