Class: Soap::Webservice::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/soap/webservice/client.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.endpointObject



10
11
12
# File 'lib/soap/webservice/client.rb', line 10

def endpoint
  "#{namespace}#{action}"
end

Instance Method Details

#clientObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/soap/webservice/client.rb', line 15

def client
  @client ||=
    Savon.client(
      endpoint: self.class.endpoint,
      namespace: self.class.namespace,
      convert_request_keys_to: :none,
      pretty_print_xml: true,
      follow_redirects: true,
      headers: {
        "User-Agent" =>
          "Ruby Wrapper for pagoPA (#{PagoPA::SOAP::VERSION})",
        "Cache-Control" => "no-cache",
        "Accept-Encoding" => "gzip, deflate"
      }
    )
end

#send(request) ⇒ Object



32
33
34
35
36
# File 'lib/soap/webservice/client.rb', line 32

def send(request)
  response.new(
    client.call(Soap.to_snakecase(self.class.action), request.to_message)
  )
end