Class: Ubiquitously::Service::Account
- Includes:
- Account::Authorizable, Account::Loggable, Account::Restful
- Defined in:
- lib/ubiquitously/models/service/account.rb
Direct Known Subclasses
BloggerDen::Account, Chetzit::Account, CodeProject::Account, Delicious::Account, DesignBump::Account, Designgizer::Account, DesignrFix::Account, Digg::Account, Digzign::Account, Diigo::Account, Dzone::Account, DzoneSnippets::Account, Facebook::Account, Faves::Account, Favshare::Account, Flikode::Account, Friendfeed::Account, Gist::Account, GoogleBuzz::Account, Identica::Account, JumpTags::Account, Kailoon::Account, MetaFilter::Account, Mixx::Account, Mmo::Account, MvcForge::Account, MySpace::Account, Nestdev::Account, Newsvine::Account, PixelGroovy::Account, Posterous::Account, ProgrammersHeaven::Account, Propeller::Account, Queness::Account, Reddit::Account, Ubiquitously::Scribd::Account, Ubiquitously::ScriptAndStyle::Account, Ubiquitously::Sharebrain::Account, Ubiquitously::Shoutwire::Account, Ubiquitously::Slideshare::Account, Ubiquitously::Smipple::Account, Ubiquitously::Snipplr::Account, Ubiquitously::Snipt::Account, Ubiquitously::Sphinn::Account, Ubiquitously::StumbleUpon::Account, Ubiquitously::Stumpedia::Account, Tumblr::Account, Tweako::Account, Twitter::Account, WebBlend::Account, Webdev5::Account, WhoFreelance::Account, Wordtaps::Account, YahooBuzz::Account, Youblr::Account, Zabox::Account
Instance Attribute Summary collapse
-
#credentials ⇒ Object
Returns the value of attribute credentials.
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#logged_in ⇒ Object
Returns the value of attribute logged_in.
-
#password ⇒ Object
Returns the value of attribute password.
-
#user ⇒ Object
Returns the value of attribute user.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #access_token ⇒ Object
- #agent ⇒ Object
- #cookies? ⇒ Boolean
- #credentials? ⇒ Boolean
-
#initialize(attributes = {}) ⇒ Account
constructor
A new instance of Account.
Methods included from Account::Authorizable
Methods included from Account::Loggable
Methods included from Account::Restful
Methods inherited from Base
Methods included from SubclassableCallbacks
Constructor Details
#initialize(attributes = {}) ⇒ Account
Returns a new instance of Account.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ubiquitously/models/service/account.rb', line 13 def initialize(attributes = {}) attributes = attributes.symbolize_keys attributes[:username] = Ubiquitously.key("#{service}.key") if attributes[:username].blank? attributes[:password] = Ubiquitously.key("#{service}.secret") if attributes[:password].blank? if attributes[:username].blank? || attributes[:password].blank? raise "Where is the username and password for #{service}?" end @logged_in = false apply attributes end |
Instance Attribute Details
#credentials ⇒ Object
Returns the value of attribute credentials.
10 11 12 |
# File 'lib/ubiquitously/models/service/account.rb', line 10 def credentials @credentials end |
#ip ⇒ Object
Returns the value of attribute ip.
11 12 13 |
# File 'lib/ubiquitously/models/service/account.rb', line 11 def ip @ip end |
#logged_in ⇒ Object
Returns the value of attribute logged_in.
11 12 13 |
# File 'lib/ubiquitously/models/service/account.rb', line 11 def logged_in @logged_in end |
#password ⇒ Object
Returns the value of attribute password.
10 11 12 |
# File 'lib/ubiquitously/models/service/account.rb', line 10 def password @password end |
#user ⇒ Object
Returns the value of attribute user.
11 12 13 |
# File 'lib/ubiquitously/models/service/account.rb', line 11 def user @user end |
#username ⇒ Object
Returns the value of attribute username.
10 11 12 |
# File 'lib/ubiquitously/models/service/account.rb', line 10 def username @username end |
Instance Method Details
#access_token ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ubiquitously/models/service/account.rb', line 44 def access_token if uses?(:oauth) && @access_token.blank? @access_token = "#{service.camelize}Token".constantize.new @access_token.token = credentials["token"] @access_token.secret = credentials["secret"] @access_token.key = credentials["key"] end @access_token end |
#agent ⇒ Object
32 33 34 |
# File 'lib/ubiquitously/models/service/account.rb', line 32 def agent user.agent end |
#cookies? ⇒ Boolean
36 37 38 |
# File 'lib/ubiquitously/models/service/account.rb', line 36 def user.(service) end |
#credentials? ⇒ Boolean
40 41 42 |
# File 'lib/ubiquitously/models/service/account.rb', line 40 def credentials? !self.credentials.blank? end |