Class: OpenX::XmlrpcClient

Inherits:
Object
  • Object
show all
Defined in:
lib/openx/xmlrpc_client.rb

Direct Known Subclasses

XmlrpcSessionClient

Constant Summary collapse

EXCEPTION_CLASSES =
[
  ::Timeout::Error,
  ::Errno::EINVAL,
  ::Errno::EPIPE,
  ::Errno::ECONNRESET,
  ::EOFError,
  ::Net::HTTPBadResponse,
  ::Net::HTTPHeaderSyntaxError,
  ::Net::ProtocolError
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ XmlrpcClient

Returns a new instance of XmlrpcClient.



19
20
21
22
23
# File 'lib/openx/xmlrpc_client.rb', line 19

def initialize(url)
  @url     = url
  @retries = 0
  init_client!
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



17
18
19
# File 'lib/openx/xmlrpc_client.rb', line 17

def client
  @client
end

#urlObject (readonly)

Returns the value of attribute url.



17
18
19
# File 'lib/openx/xmlrpc_client.rb', line 17

def url
  @url
end

Instance Method Details

#call(method, *args) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/openx/xmlrpc_client.rb', line 25

def call(method, *args)
  @client.call(method, *(convert(args)))
rescue *EXCEPTION_CLASSES => e
  cycle = (cycle || 0) + 1
  raise(e) if cycle > 10 || OpenX.configuration['retry'] == false
  init_client!
  retry
end