Class: Rapleaf::Marketo::AuthenticationHeader
- Inherits:
-
Object
- Object
- Rapleaf::Marketo::AuthenticationHeader
- Defined in:
- lib/marketo/authentication_header.rb
Overview
This class exists only to encapsulate the authentication header part of a soap request to marketo Marketo requires a somewhat complex calculation of an encrypted signature and so it seemed sensible to pull this code out here
Constant Summary collapse
- DIGEST =
OpenSSL::Digest::Digest.new('sha1')
Instance Method Summary collapse
- #get_mktows_user_id ⇒ Object
- #get_request_signature ⇒ Object
- #get_request_timestamp ⇒ Object
-
#initialize(access_key, secret_key, time = DateTime.now) ⇒ AuthenticationHeader
constructor
A new instance of AuthenticationHeader.
-
#set_time(time) ⇒ Object
time should be a DateTime instance.
- #to_hash ⇒ Object
Constructor Details
#initialize(access_key, secret_key, time = DateTime.now) ⇒ AuthenticationHeader
Returns a new instance of AuthenticationHeader.
8 9 10 11 12 |
# File 'lib/marketo/authentication_header.rb', line 8 def initialize(access_key, secret_key, time = DateTime.now) @access_key = access_key @secret_key = secret_key @time = time end |
Instance Method Details
#get_mktows_user_id ⇒ Object
20 21 22 |
# File 'lib/marketo/authentication_header.rb', line 20 def get_mktows_user_id @access_key end |
#get_request_signature ⇒ Object
24 25 26 |
# File 'lib/marketo/authentication_header.rb', line 24 def get_request_signature calculate_signature end |
#get_request_timestamp ⇒ Object
28 29 30 |
# File 'lib/marketo/authentication_header.rb', line 28 def @time.to_s end |
#set_time(time) ⇒ Object
time should be a DateTime instance
16 17 18 |
# File 'lib/marketo/authentication_header.rb', line 16 def set_time(time) @time = time end |
#to_hash ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/marketo/authentication_header.rb', line 32 def to_hash { "mktowsUserId" => get_mktows_user_id, "requestSignature" => get_request_signature, "requestTimestamp" => } end |