Class: Akamai::Core::Client::Authority
- Inherits:
-
Object
- Object
- Akamai::Core::Client::Authority
- Defined in:
- lib/akamai/core/client/authority.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #authorization_seed ⇒ Object
-
#initialize(params) ⇒ Authority
constructor
A new instance of Authority.
- #publish_authorization ⇒ Object
- #signature ⇒ Object
Constructor Details
#initialize(params) ⇒ Authority
Returns a new instance of Authority.
9 10 11 12 |
# File 'lib/akamai/core/client/authority.rb', line 9 def initialize(params) @params = params.with_indifferent_access @client = @params[:client] end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/akamai/core/client/authority.rb', line 8 def client @client end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
8 9 10 |
# File 'lib/akamai/core/client/authority.rb', line 8 def params @params end |
Instance Method Details
#authorization_seed ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/akamai/core/client/authority.rb', line 24 def "EG1-HMAC-SHA256 " + [].tap do |arr| %w(client_token access_token).each do |k| arr << "#{k}=#{client.send(k)}" end %w(timestamp nonce).each do |k| arr << "#{k}=#{send(k)}" end end.join(";") + ";" end |
#publish_authorization ⇒ Object
14 15 16 |
# File 'lib/akamai/core/client/authority.rb', line 14 def + "signature=#{signature}" end |
#signature ⇒ Object
18 19 20 21 22 |
# File 'lib/akamai/core/client/authority.rb', line 18 def signature @signature ||= Base64.strict_encode64( OpenSSL::HMAC.digest(OpenSSL::Digest.new("sha256"), encryption_key, encryption_seed) ) end |