Class: Velocify::Model::Client
- Inherits:
-
Object
- Object
- Velocify::Model::Client
- Defined in:
- lib/velocify/model.rb
Constant Summary collapse
- WSDL =
'http://service.leads360.com/ClientService.asmx?WSDL'
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(request, username: nil, password: nil) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(request, username: nil, password: nil) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 |
# File 'lib/velocify/model.rb', line 8 def initialize request, username: nil, password: nil @request = request @username = username @password = password @soap_client = Savon.client wsdl: WSDL end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
6 7 8 |
# File 'lib/velocify/model.rb', line 6 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
6 7 8 |
# File 'lib/velocify/model.rb', line 6 def username @username end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/velocify/model.rb', line 15 def call if request.requires_auth? request.authenticate username: @username, password: @password end raw_response = soap_client.call(request.operation, request.payload).body response_tag = "#{request.operation.to_s}_response".to_sym result_tag = "#{request.operation.to_s}_result".to_sym response = raw_response[response_tag][result_tag] request.transform.call response end |