Class: Inforouter::Client

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

Overview

A Client communicates with the Inforouter service.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Inforouter::Client

Initializes a new Client object

Parameters:

  • options (Hash) (defaults to: {})


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/inforouter/client.rb', line 10

def initialize(options = {})
  options = {
    :log => false,
    :logger => Logger.new($stdout),
    :log_level => :info
  }.merge(options)

  @wsdl = options[:wsdl] || File.dirname(__FILE__) + '/../../resources/inforouter.wsdl'

  @client = Savon.client(
    :wsdl => @wsdl,
    :convert_request_keys_to => :camelcase,
    :pretty_print_xml => true,
    :log => options[:log],
    :logger => options[:logger],
    :log_level => options[:log_level]
  )

  @ticket = nil
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/inforouter/client.rb', line 4

def client
  @client
end

#ticketString (readonly)

Returns the client ticket.

Returns:

  • (String)


39
40
41
# File 'lib/inforouter/client.rb', line 39

def ticket
  @ticket
end

#wsdlObject (readonly)

Returns the value of attribute wsdl.



4
5
6
# File 'lib/inforouter/client.rb', line 4

def wsdl
  @wsdl
end

Instance Method Details

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

Make a safe SOAP call. Will raise a Inforouter::Errors::SOAPError on error.

Parameters:

  • method (Symbol)
  • message (Hash) (defaults to: {})


49
50
51
52
53
# File 'lib/inforouter/client.rb', line 49

def call(method, message = {})
  safe do
    super method, :message => message.merge(authentication_params)
  end
end

#operationsArray

Returns:

  • (Array)


32
33
34
# File 'lib/inforouter/client.rb', line 32

def operations
  @client.operations
end