Class: Toaster::ToasterAppClient
- Inherits:
-
XMLRPC::Client
- Object
- XMLRPC::Client
- Toaster::ToasterAppClient
- Defined in:
- lib/toaster/api.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(host, port = 8385) ⇒ ToasterAppClient
constructor
A new instance of ToasterAppClient.
- #method_missing(name, *args, &block) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(host, port = 8385) ⇒ ToasterAppClient
Returns a new instance of ToasterAppClient.
421 422 423 424 425 426 427 |
# File 'lib/toaster/api.rb', line 421 def initialize(host, port=8385) @host = host.include?(":") ? host.gsub(/([^:]+):.*/, '\1') : host @port = host.include?(":") ? host.gsub(/([^:]+):(.+)/, '\2') : port @port = @port.to_i super(@host, "/", @port) self.timeout = 60*60 # timeout of 1h for RPC calls end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
428 429 430 |
# File 'lib/toaster/api.rb', line 428 def method_missing(name, *args, &block) call(name, *args, &block) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
419 420 421 |
# File 'lib/toaster/api.rb', line 419 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
419 420 421 |
# File 'lib/toaster/api.rb', line 419 def port @port end |
Instance Method Details
#to_s ⇒ Object
431 432 433 |
# File 'lib/toaster/api.rb', line 431 def to_s "ServiceProxy<#{host}:#{port}>" end |