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