Class: OpenX::XmlrpcClient
- Inherits:
-
Object
- Object
- OpenX::XmlrpcClient
- Defined in:
- lib/openx/xmlrpc_client.rb
Direct Known Subclasses
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
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #call(method, *args) ⇒ Object
-
#initialize(url) ⇒ XmlrpcClient
constructor
A new instance of XmlrpcClient.
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
#client ⇒ Object (readonly)
Returns the value of attribute client.
17 18 19 |
# File 'lib/openx/xmlrpc_client.rb', line 17 def client @client end |
#url ⇒ Object (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 |