Class: XMLRPC::Client

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(host = nil, path = nil, port = nil, proxy_host = nil, proxy_port = nil, user = nil, password = nil, use_ssl = nil, timeout = nil) ⇒ Client

:nodoc:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/fotolia.rb', line 40

def initialize(host=nil, path=nil, port=nil, proxy_host=nil, proxy_port=nil,
    user=nil, password=nil, use_ssl=nil, timeout=nil)

  @http_header_extra = nil
  @http_last_response = nil
  @cookie = nil

  @host       = host || "localhost"
  @path       = path || "/RPC2"
  @proxy_host = proxy_host
  @proxy_port = proxy_port
  @proxy_host ||= 'localhost' if @proxy_port != nil
  @proxy_port ||= 8080 if @proxy_host != nil
  @use_ssl    = use_ssl || false
  @timeout    = timeout || 30

  @port = port || (use_ssl ? 443 : 80)

  @user, @password = user, password

  # convert ports to integers
  @port = @port.to_i unless @port.nil?
  @proxy_port = @proxy_port.to_i unless @proxy_port.nil?

  # HTTP object for synchronous calls
  @http = build_http_client
  @http.handle_cookies

  @parser = nil
  @create = nil
end

Instance Method Details

#timeout=(new_timeout) ⇒ Object



72
73
74
75
# File 'lib/fotolia.rb', line 72

def timeout=(new_timeout)
  @timeout = new_timeout
  @http.timeout = @timeout
end