Class: Ubiquitously::Base::User
- Inherits:
-
Object
- Object
- Ubiquitously::Base::User
- Includes:
- ActiveModel::Serialization, ActiveModel::Validations, Resourceful
- Defined in:
- lib/ubiquitously/base.rb
Direct Known Subclasses
Dzone::User, Faves::User, Mixx::User, Newsvine::User, Propeller::User, Reddit::User, StumbleUpon::User
Instance Attribute Summary collapse
-
#agent ⇒ Object
Returns the value of attribute agent.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ User
constructor
A new instance of User.
- #logged_in? ⇒ Boolean
Methods included from Resourceful
Constructor Details
#initialize(attributes = {}) ⇒ User
Returns a new instance of User.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ubiquitously/base.rb', line 12 def initialize(attributes = {}) attributes = attributes.symbolize_keys attributes[:username] ||= Ubiquitously.key("#{service_name}.key") attributes[:password] ||= Ubiquitously.key("#{service_name}.secret") @logged_in = false super(attributes) self.agent = Mechanize.new # self.agent.log = Logger.new(STDOUT) self.agent.user_agent = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; ru-ru) AppleWebKit/533.2+ (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10" end |
Instance Attribute Details
#agent ⇒ Object
Returns the value of attribute agent.
8 9 10 |
# File 'lib/ubiquitously/base.rb', line 8 def agent @agent end |
#password ⇒ Object
Returns the value of attribute password.
8 9 10 |
# File 'lib/ubiquitously/base.rb', line 8 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
8 9 10 |
# File 'lib/ubiquitously/base.rb', line 8 def username @username end |
Instance Method Details
#logged_in? ⇒ Boolean
27 28 29 |
# File 'lib/ubiquitously/base.rb', line 27 def logged_in? @logged_in == true end |