Class: ZombieFans::Robot
- Inherits:
-
Object
- Object
- ZombieFans::Robot
- 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
Constants included from Actions::Confirm
Actions::Confirm::CONFIRMABLE_EMAIL
Instance Attribute Summary collapse
-
#agent ⇒ Object
readonly
Returns the value of attribute agent.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Robot
constructor
A new instance of Robot.
Methods included from Actions::Persist::ClassMethods
Methods included from Actions::Query::ClassMethods
Methods included from Actions::Persist
Methods included from Actions::User
Methods included from Actions::Repo
#create_repo, #make_repo_private, #make_repo_public, #star_repo, #toggle_permission
Methods included from Actions::Avatar
Methods included from Actions::Confirm
#add_confirmable_email, #follow_confirm_link, #set_email_private
Methods included from Actions::Auth
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
#agent ⇒ Object (readonly)
Returns the value of attribute agent.
39 40 41 |
# File 'lib/zombie_fans/robot.rb', line 39 def agent @agent end |