Class: ProjectHoneypot::Url

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ip_address, honeypot_response) ⇒ Url

Returns a new instance of Url.



4
5
6
7
8
# File 'lib/project_honeypot/url.rb', line 4

def initialize(ip_address, honeypot_response)
  @ip_address = ip_address
  @safe = honeypot_response.nil?
  process_score(honeypot_response)
end

Instance Attribute Details

#ip_addressObject (readonly)

Returns the value of attribute ip_address.



3
4
5
# File 'lib/project_honeypot/url.rb', line 3

def ip_address
  @ip_address
end

#last_activityObject (readonly)

Returns the value of attribute last_activity.



3
4
5
# File 'lib/project_honeypot/url.rb', line 3

def last_activity
  @last_activity
end

#offensesObject (readonly)

Returns the value of attribute offenses.



3
4
5
# File 'lib/project_honeypot/url.rb', line 3

def offenses
  @offenses
end

#scoreObject (readonly)

Returns the value of attribute score.



3
4
5
# File 'lib/project_honeypot/url.rb', line 3

def score
  @score
end

Instance Method Details

#comment_spammer?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/project_honeypot/url.rb', line 14

def comment_spammer?
  @offenses.include?(:comment_spammer)
end

#harvester?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/project_honeypot/url.rb', line 18

def harvester?
  @offenses.include?(:harvester)
end

#safe?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/project_honeypot/url.rb', line 10

def safe?
  @safe
end

#suspicious?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/project_honeypot/url.rb', line 22

def suspicious?
  @offenses.include?(:suspicious)
end