Class: DineroMail::Client

Inherits:
Object
  • Object
show all
Includes:
Operations
Defined in:
lib/dinero_mail/client.rb

Constant Summary

Constants included from Operations

Operations::KEYS_FOR_ACTION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Operations

#do_payment_with_credit_card, #do_payment_with_reference, #do_with_draw, #get_balance, #get_operations, #get_payment_ticket, #send_money

Methods included from Security

#encrypt_with, #md5

Constructor Details

#initialize(credentials = {}, secret = nil) ⇒ Client

Returns a new instance of Client.



11
12
13
14
15
16
# File 'lib/dinero_mail/client.rb', line 11

def initialize(credentials = {}, secret = nil)
  url = DineroMail.configuration.test? ? 'https://sandboxapi.dineromail.com/DMAPI.asmx?WSDL' : 'https://api.dineromail.com/dmapi.asmx?WSDL'
  @credential = { 'APIUserName' => DineroMail.configuration.username, 'APIPassword' => DineroMail.configuration.password  }
  @secret = DineroMail.configuration.secret || Digest::SHA2.hexdigest(Time.now.to_s)
  @client = Savon::Client.new(url)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



9
10
11
# File 'lib/dinero_mail/client.rb', line 9

def client
  @client
end

#credentialObject (readonly)

Returns the value of attribute credential.



9
10
11
# File 'lib/dinero_mail/client.rb', line 9

def credential
  @credential
end

#responseObject (readonly)

Returns the value of attribute response.



9
10
11
# File 'lib/dinero_mail/client.rb', line 9

def response
  @response
end

#secretObject (readonly)

Returns the value of attribute secret.



9
10
11
# File 'lib/dinero_mail/client.rb', line 9

def secret
  @secret
end