Class: YDIM::Client
- Inherits:
-
Object
- Object
- YDIM::Client
- Includes:
- DRb::DRbUndumped
- Defined in:
- lib/ydim/client.rb,
lib/ydim/config.rb
Constant Summary collapse
- CONFIG =
config
Instance Attribute Summary collapse
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Instance Method Summary collapse
-
#initialize(config) ⇒ Client
constructor
A new instance of Client.
- #login(server, private_key) ⇒ Object
- #logout ⇒ Object
- #method_missing(meth, *args, &block) ⇒ Object
Constructor Details
#initialize(config) ⇒ Client
Returns a new instance of Client.
10 11 12 13 |
# File 'lib/ydim/client.rb', line 10 def initialize(config) @config = config DRb.start_service(config.client_url) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
25 26 27 |
# File 'lib/ydim/client.rb', line 25 def method_missing(meth, *args, &block) @session.send(meth, *args, &block) end |
Instance Attribute Details
#session ⇒ Object (readonly)
Returns the value of attribute session.
9 10 11 |
# File 'lib/ydim/client.rb', line 9 def session @session end |
Instance Method Details
#login(server, private_key) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/ydim/client.rb', line 14 def login(server, private_key) @server = server @session = @server.login(self, @config.user) { |challenge| if(private_key.respond_to?(:syssign)) private_key.syssign(challenge) end } end |
#logout ⇒ Object
22 23 24 |
# File 'lib/ydim/client.rb', line 22 def logout @server.logout(@session) if(@server) end |