class Emarsys::Client

Attributes

account[RW]

Public Class Methods

new(account = nil) click to toggle source
# File lib/emarsys/client.rb, line 6
def initialize(account = nil)
  self.account = account
end

Public Instance Methods

calculated_digest() click to toggle source
# File lib/emarsys/client.rb, line 40
def calculated_digest
  Digest::SHA1.hexdigest(header_nonce + header_created + password)
end
endpoint() click to toggle source
# File lib/emarsys/client.rb, line 10
def endpoint
  Emarsys::Configuration.for(account).api_endpoint
end
header_created() click to toggle source
# File lib/emarsys/client.rb, line 36
def header_created
  @header_created ||= Time.now.utc.iso8601
end
header_nonce() click to toggle source
# File lib/emarsys/client.rb, line 32
def header_nonce
  @header_nonce ||= SecureRandom::random_bytes(16).each_byte.map { |b| sprintf("%02X",b) }.join
end
header_password_digest() click to toggle source
# File lib/emarsys/client.rb, line 28
def header_password_digest
  Base64.strict_encode64(calculated_digest).strip
end
open_timeout() click to toggle source
# File lib/emarsys/client.rb, line 44
def open_timeout
  Emarsys::Configuration.for(account).open_timeout
end
password() click to toggle source
# File lib/emarsys/client.rb, line 18
def password
  Emarsys::Configuration.for(account).api_password
end
read_timeout() click to toggle source
# File lib/emarsys/client.rb, line 48
def read_timeout
  Emarsys::Configuration.for(account).read_timeout
end
username() click to toggle source
# File lib/emarsys/client.rb, line 14
def username
  Emarsys::Configuration.for(account).api_username
end
x_wsse_string() click to toggle source
# File lib/emarsys/client.rb, line 22
    def x_wsse_string
      <<-STRING.strip
      UsernameToken Username="#{username}", PasswordDigest="#{header_password_digest}", Nonce="#{header_nonce}", Created="#{header_created}"
      STRING
    end