Class: ZombieFans::Robot

Inherits:
Object
  • Object
show all
Extended by:
Actions::Persist::ClassMethods, Actions::Query::ClassMethods
Includes:
Actions::Auth, Actions::Avatar, Actions::Confirm, Actions::Logger, Actions::Persist, Actions::Repo, Actions::User
Defined in:
lib/zombie_fans/robot.rb

Constant Summary collapse

AGENT_ALIASES =
[
  'Linux Firefox', 'Linux Konqueror', 'Linux Mozilla', 'Mac Firefox', 'Mac Mozilla', 'Mac Safari 4', 'Mac Safari', 'Windows Chrome', 'Windows IE 6', 'Windows IE 7', 'Windows IE 8', 'Windows IE 9', 'Windows IE 10', 'Windows IE 11', 'Windows Edge', 'Windows Mozilla', 'Windows Firefox'
]

Constants included from Actions::Persist

Actions::Persist::ATTRIBUTES

Constants included from Actions::Confirm

Actions::Confirm::CONFIRMABLE_EMAIL

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Actions::Persist::ClassMethods

init_attributes, sample

Methods included from Actions::Query::ClassMethods

find

Methods included from Actions::Persist

dump, load, #save

Methods included from Actions::User

#follow_user, #update_profile

Methods included from Actions::Repo

#create_repo, #make_repo_private, #make_repo_public, #star_repo, #toggle_permission

Methods included from Actions::Avatar

#upload_avatar

Methods included from Actions::Confirm

#add_confirmable_email, #follow_confirm_link, #set_email_private

Methods included from Actions::Auth

#sign_in, #sign_up

Methods included from Actions::Logger

#debug_page, #log_action, #log_error

Constructor Details

#initialize(attributes = {}) ⇒ Robot

Returns a new instance of Robot.



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/zombie_fans/robot.rb', line 45

def initialize attributes = {}
  # assign attributes
  attributes.each do |key, value|
    instance_variable_set(:"@#{key}", value)
  end

  @agent = Mechanize.new do |agent|
    agent.user_agent_alias = AGENT_ALIASES.sample
    agent.agent.allowed_error_codes = [500]
  end
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



39
40
41
# File 'lib/zombie_fans/robot.rb', line 39

def agent
  @agent
end