Class: BlackStack::Bots::Bot

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

Direct Known Subclasses

MechanizeBot, SeleniumBot

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(h) ⇒ Bot

Returns a new instance of Bot.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/base.rb', line 10

def initialize(h)
    # array of numbers from 4000 to 4249
    if h
        self.ip = h[:ip]
        self.user = h[:user]
        self.password = h[:password]
        self.ports = (h[:port_from]..h[:port_to]).to_a
    else
        self.ports = []
    end
    self.port_index = -1
end

Instance Attribute Details

#ipObject

ip address of proxy



4
5
6
# File 'lib/base.rb', line 4

def ip
  @ip
end

#passwordObject

password of proxy



6
7
8
# File 'lib/base.rb', line 6

def password
  @password
end

#port_indexObject

index of the port



8
9
10
# File 'lib/base.rb', line 8

def port_index
  @port_index
end

#portsObject

array of ports



7
8
9
# File 'lib/base.rb', line 7

def ports
  @ports
end

#userObject

user of proxy



5
6
7
# File 'lib/base.rb', line 5

def user
  @user
end

Instance Method Details

#proxy?Boolean

return true if the bot is using a proxy

Returns:

  • (Boolean)


24
25
26
# File 'lib/base.rb', line 24

def proxy?
    !self.ip.nil? 
end