Class: Markety::AuthenticationHeader
- Inherits:
-
Object
- Object
- Markety::AuthenticationHeader
- Defined in:
- lib/markety/authentication_header.rb
Overview
This class exists only to encapsulate the authentication header part of a soap request to Marketo.
Constant Summary collapse
- DIGEST =
OpenSSL::Digest::SHA1.new
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.
6 7 8 9 10 |
# File 'lib/markety/authentication_header.rb', line 6 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
18 19 20 |
# File 'lib/markety/authentication_header.rb', line 18 def get_mktows_user_id @access_key end |
#get_request_signature ⇒ Object
22 23 24 |
# File 'lib/markety/authentication_header.rb', line 22 def get_request_signature calculate_signature end |
#get_request_timestamp ⇒ Object
26 27 28 |
# File 'lib/markety/authentication_header.rb', line 26 def @time.to_s end |
#set_time(time) ⇒ Object
time should be a DateTime instance
14 15 16 |
# File 'lib/markety/authentication_header.rb', line 14 def set_time(time) @time = time end |
#to_hash ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/markety/authentication_header.rb', line 30 def to_hash { "ns1:AuthenticationHeader" => { "mktowsUserId" => get_mktows_user_id, "requestSignature" => get_request_signature, "requestTimestamp" => } } end |