Class: Shmac::AuthorizationHeader
- Inherits:
-
Object
- Object
- Shmac::AuthorizationHeader
- Includes:
- Comparable
- Defined in:
- lib/shmac/authorization_header.rb
Defined Under Namespace
Classes: FormatError
Constant Summary collapse
- AUTH_HEADER_PATTERN =
/(.+) (.+):(.+)$/
Instance Attribute Summary collapse
-
#parts ⇒ Object
Returns the value of attribute parts.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #access_key_id ⇒ Object
-
#initialize(value) ⇒ AuthorizationHeader
constructor
A new instance of AuthorizationHeader.
- #organization ⇒ Object
- #signature ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ AuthorizationHeader
16 17 18 19 |
# File 'lib/shmac/authorization_header.rb', line 16 def initialize value @value = value self.parts = value end |
Instance Attribute Details
#parts ⇒ Object
Returns the value of attribute parts.
10 11 12 |
# File 'lib/shmac/authorization_header.rb', line 10 def parts @parts end |
Class Method Details
.generate(organization:, access_key:, signature:) ⇒ Object
12 13 14 |
# File 'lib/shmac/authorization_header.rb', line 12 def self.generate organization:, access_key:, signature: new("%s %s:%s" % [organization, access_key, signature]) end |
Instance Method Details
#==(other) ⇒ Object
21 22 23 24 25 |
# File 'lib/shmac/authorization_header.rb', line 21 def == other return false unless other.is_a?(self.class) Security.secure_compare self.to_s, other.to_s end |
#access_key_id ⇒ Object
44 45 46 |
# File 'lib/shmac/authorization_header.rb', line 44 def access_key_id parts[2] end |
#organization ⇒ Object
40 41 42 |
# File 'lib/shmac/authorization_header.rb', line 40 def organization parts[1] end |
#signature ⇒ Object
48 49 50 |
# File 'lib/shmac/authorization_header.rb', line 48 def signature parts[3] end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/shmac/authorization_header.rb', line 27 def to_s @value end |