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
Returns a new instance of AuthorizationHeader.
14 15 16 17 |
# File 'lib/shmac/authorization_header.rb', line 14 def initialize value @value = value self.parts = value end |
Instance Attribute Details
#parts ⇒ Object
Returns the value of attribute parts.
8 9 10 |
# File 'lib/shmac/authorization_header.rb', line 8 def parts @parts end |
Class Method Details
.generate(organization:, access_key:, signature:) ⇒ Object
10 11 12 |
# File 'lib/shmac/authorization_header.rb', line 10 def self.generate organization:, access_key:, signature: new("%s %s:%s" % [organization, access_key, signature]) end |
Instance Method Details
#==(other) ⇒ Object
19 20 21 |
# File 'lib/shmac/authorization_header.rb', line 19 def == other other.is_a?(self.class) && self.to_s == other.to_s end |
#access_key_id ⇒ Object
40 41 42 |
# File 'lib/shmac/authorization_header.rb', line 40 def access_key_id parts[2] end |
#organization ⇒ Object
36 37 38 |
# File 'lib/shmac/authorization_header.rb', line 36 def organization parts[1] end |
#signature ⇒ Object
44 45 46 |
# File 'lib/shmac/authorization_header.rb', line 44 def signature parts[3] end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/shmac/authorization_header.rb', line 23 def to_s @value end |