class BlackStack::NextBot::RemoteCommand
The “remote” (or API class) that will be receive the data from an API call.
Attributes
:browser: is the browser where the bot will operate.
:id is the ID of the record in the “routine” table. :params is an array of RemoteParam objects. :steps is an array of RemoteSteps objects.
:id is the ID of the record in the “routine” table. :params is an array of RemoteParam objects. :steps is an array of RemoteSteps objects.
:id is the ID of the record in the “routine” table. :params is an array of RemoteParam objects. :steps is an array of RemoteSteps objects.
:id is the ID of the record in the “routine” table. :params is an array of RemoteParam objects. :steps is an array of RemoteSteps objects.
:id is the ID of the record in the “routine” table. :params is an array of RemoteParam objects. :steps is an array of RemoteSteps objects.
:id is the ID of the record in the “routine” table. :params is an array of RemoteParam objects. :steps is an array of RemoteSteps objects.
:id is the ID of the record in the “routine” table. :params is an array of RemoteParam objects. :steps is an array of RemoteSteps objects.
Public Class Methods
browser: is a browser created from the BrowserFactory class.
# File lib/remotecommand.rb, line 70 def initialize(the_browser=nil) self.browser = the_browser end
Public Instance Methods
generate all the hierarchy of the bot (routines, steps,
> params) from a hash descriptor. ¶ ↑
BlackStack::NextBot::BaseRemoteObject#build
# File lib/remotecommand.rb, line 23 def build(h) super(h) self.id = h['id'] self.id_worker = h['id_worker'] self.type = h['type'] # start command params self.param_start_id_lnuser = h['param_start_id_lnuser'] self.param_start_username = h['param_start_username'] # login command params self.param_login_id_domain = h['param_login_id_domain'] # goto command params self.param_goto_url = h['param_goto_url'] # traffic command params self.param_traffic_url = h['param_traffic_url'] self.param_traffic_id_proxy = h['param_traffic_id_proxy'] self.param_traffic_proxy_ip = h['param_traffic_proxy_ip'] self.param_traffic_proxy_port = h['param_traffic_proxy_port'] self.param_traffic_number_of_visits = h['param_traffic_number_of_visits'] self.param_traffic_visit_min_seconds = h['param_traffic_visit_min_seconds'] self.param_traffic_visit_random_additional_seconds = h['param_traffic_visit_random_additional_seconds'] # TODO: map here all the other attributes of the record in the "command" table, # regarding every one of the possible "type" of steps. end
based on the “type” attribute, create an instance of the
> regarding child class, to invoke the “run” method of ¶ ↑
> such child class. ¶ ↑
# File lib/remotecommand.rb, line 50 def create_child() return RemoteStepStartBot.new(self.browser).build(self.descritor) if self.type == TYPE_START_BOT return RemoteStepLogin.new(self.browser).build(self.descritor) if self.type == TYPE_LOGIN return RemoteStepGoto.new(self.browser).build(self.descritor) if self.type == TYPE_GOTO # TODO: add RemoteStepStartScraper # TODO: add RemoteStepTraffic #return RemoteStepFind.new(self.browser).build(self.descritor) if self.type == TYPE_FIND #return RemoteStepMouse.new(self.browser).build(self.descritor) if self.type == TYPE_MOUSE #return RemoteStepWrite.new(self.browser).build(self.descritor) if self.type == TYPE_WRITE #return RemoteStepDelay.new(self.browser).build(self.descritor) if self.type == TYPE_DELAY #return RemoteStepCall.new(self.browser).build(self.descritor) if self.type == TYPE_CALL #return RemoteStepIf.new(self.browser).build(self.descritor) if self.type == TYPE_IF #return RemoteStepExists.new(self.browser).build(self.descritor) if self.type == TYPE_EXISTS #return RemoteStepEach.new(self.browser).build(self.descritor) if self.type == TYPE_EACH return RemoteStepClose.new(self.browser).build(self.descritor) if self.type == TYPE_CLOSE end
run the specified operation for this “type” of “step”
# File lib/remotecommand.rb, line 75 def run() raise 'This is an abstract method. Each child of the RemoteCommand class will code its own "run" method.' end