Class: AriaCoreSoapClient

Inherits:
Object
  • Object
show all
Includes:
Savon
Defined in:
lib/aria_sdk/aria_core_soap_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_no, auth_key, version, prod = false) ⇒ AriaCoreSoapClient

Returns a new instance of AriaCoreSoapClient.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/aria_sdk/aria_core_soap_client.rb', line 8

def initialize(client_no, auth_key, version, prod = false)
    self.client_no = client_no
    self.auth_key = auth_key

    if prod
        wsdl = "https://secure.ariasystems.net/api/Advanced/wsdl/#{version}/complete-doc_literal_wrapped.wsdl"
    else
        wsdl = "https://secure.future.stage.ariasystems.net/api/Advanced/wsdl/#{version}/complete-doc_literal_wrapped.wsdl"
    end

    @client = Savon.client(wsdl: wsdl) do
        convert_request_keys_to :none
    end
end

Instance Attribute Details

#auth_keyObject

Returns the value of attribute auth_key.



6
7
8
# File 'lib/aria_sdk/aria_core_soap_client.rb', line 6

def auth_key
  @auth_key
end

#client_noObject

Returns the value of attribute client_no.



6
7
8
# File 'lib/aria_sdk/aria_core_soap_client.rb', line 6

def client_no
  @client_no
end

Instance Method Details

#call(api_name, message = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/aria_sdk/aria_core_soap_client.rb', line 23

def call(api_name, message = {})

    defaults = {
        output_format: 'json',
        client_no: self.client_no,
        auth_key: self.auth_key,
    }

    message.merge!(defaults)
    response = @client.call(api_name.to_sym, message: message)

    #response = @client.call(api_name.to_sym, message: message )
    response_name = api_name << '_response_element'

    body = response.body[response_name.to_sym]

    return body
end