Class: Authentication

Inherits:
Object
  • Object
show all
Defined in:
lib/default.rb

Overview

http://mxmaster.net/campaign/0.1Authentication

user - SOAP::SOAPString
timestamp - SOAP::SOAPDateTime
signature - SOAP::SOAPString

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#signatureObject

Returns the value of attribute signature.



15
16
17
# File 'lib/default.rb', line 15

def signature
  @signature
end

#timestampObject

Returns the value of attribute timestamp.



14
15
16
# File 'lib/default.rb', line 14

def timestamp
  @timestamp
end

#userObject

Returns the value of attribute user.



13
14
15
# File 'lib/default.rb', line 13

def user
  @user
end

Instance Method Details

#makeSignatureObject



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