Class: Authentication
- Inherits:
-
Object
- Object
- Authentication
- Defined in:
- lib/default.rb
Overview
http://mxmaster.net/campaign/0.1Authentication
user - SOAP::SOAPString
- SOAP::SOAPDateTime
signature - SOAP::SOAPString
Instance Attribute Summary collapse
-
#signature ⇒ Object
Returns the value of attribute signature.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user, password) ⇒ Authentication
constructor
A new instance of Authentication.
- #makeSignature ⇒ Object
Constructor Details
#initialize(user, password) ⇒ Authentication
Returns a new instance of Authentication.
17 18 19 20 21 22 23 24 |
# File 'lib/default.rb', line 17 def initialize(user, password) @user = user @password= password t = Time.now t = t.utc @timestamp = t.xmlschema makeSignature() end |
Instance Attribute Details
#signature ⇒ Object
Returns the value of attribute signature.
15 16 17 |
# File 'lib/default.rb', line 15 def signature @signature end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
14 15 16 |
# File 'lib/default.rb', line 14 def @timestamp end |
#user ⇒ Object
Returns the value of attribute user.
13 14 15 |
# File 'lib/default.rb', line 13 def user @user end |
Instance Method Details
#makeSignature ⇒ Object
26 27 28 29 30 31 |
# File 'lib/default.rb', line 26 def makeSignature() sign = ::HMAC::SHA256.new() sign.set_key(@password) sign.update("http://mxmaster.net/campaign/0.1#doCampaign" + @user + @timestamp) @signature = sign.hexdigest() end |