Class: ML_ruby::ML_client
- Inherits:
-
Object
- Object
- ML_ruby::ML_client
- Defined in:
- lib/ml-ruby/ml_client.rb
Constant Summary collapse
- PROTOCOL_VERSION =
41- MAX_OPCODE_SENT =
59- MAX_OPCODE_RCVD =
68- TIME_OUT =
10
Instance Method Summary collapse
- #get_current_downloads ⇒ Object
- #get_finished_downloads ⇒ Object
-
#initialize(host = 'localhost', port = 4001, user = nil, password = nil) ⇒ ML_client
constructor
public methods.
- #start_download(url) ⇒ Object
Constructor Details
#initialize(host = 'localhost', port = 4001, user = nil, password = nil) ⇒ ML_client
public methods
33 34 35 36 37 38 39 40 |
# File 'lib/ml-ruby/ml_client.rb', line 33 def initialize host='localhost', port=4001, user=nil, password=nil @listener= [] @send_queue= [] # ML_payload_handler::Types.keys.each do |opcode| # add_listener opcode, self, :log # end connect host, port, user, password end |
Instance Method Details
#get_current_downloads ⇒ Object
42 43 44 45 46 |
# File 'lib/ml-ruby/ml_client.rb', line 42 def get_current_downloads send_payload= ML_S_get_downloading_files.new( {} ) recv_payload= ML_R_downloading_files send_and_wait_for send_payload, recv_payload end |
#get_finished_downloads ⇒ Object
48 49 50 51 52 |
# File 'lib/ml-ruby/ml_client.rb', line 48 def get_finished_downloads send_payload= ML_S_get_downloaded_files.new( {} ) recv_payload= ML_R_downloaded_files send_and_wait_for send_payload, recv_payload end |
#start_download(url) ⇒ Object
54 55 56 57 58 |
# File 'lib/ml-ruby/ml_client.rb', line 54 def start_download url send_opcode= ML_S_download_url.class.opcode sd= .new send_opcode, ML_S_download_url.new( :url=> url ) add_to_send_queue sd end |