Class: CloudApp::Account
Overview
An ActiveResource-like interface through which to interract with CloudApp accounts.
Instance Attribute Summary collapse
-
#activated_at ⇒ Object
readonly
Returns the value of attribute activated_at.
-
#alpha ⇒ Object
readonly
Returns the value of attribute alpha.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#domain_home_page ⇒ Object
readonly
Returns the value of attribute domain_home_page.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#private_items ⇒ Object
readonly
Returns the value of attribute private_items.
-
#subscribed ⇒ Object
readonly
Returns the value of attribute subscribed.
-
#subscription_expires_at ⇒ Object
readonly
Returns the value of attribute subscription_expires_at.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Attributes inherited from Base
Class Method Summary collapse
-
.create(opts = {}) ⇒ CloudApp::Account
Create a CloudApp account.
-
.find ⇒ CloudApp::Account
Get the basic details of the authenticated account.
-
.reset(opts = {}) ⇒ Boolean
Dispatch an email containing a link to reset the account’s password.
-
.stats ⇒ Hash
Get the total number of drops created and total views for all drops.
-
.update(opts = {}) ⇒ CloudApp::Account
Modify the authenticated accounts details.
Instance Method Summary collapse
-
#reset ⇒ Boolean
Dispatch an email containing a link to reset the account’s password.
-
#stats ⇒ Hash
Get the total number of drops created and total views for all drops.
-
#update(opts = {}) ⇒ CloudApp::Account
Modify the authenticated accounts details.
Methods inherited from Base
authenticate, bad_response, #initialize
Constructor Details
This class inherits a constructor from CloudApp::Base
Instance Attribute Details
#activated_at ⇒ Object (readonly)
Returns the value of attribute activated_at.
117 118 119 |
# File 'lib/cloudapp/account.rb', line 117 def activated_at @activated_at end |
#alpha ⇒ Object (readonly)
Returns the value of attribute alpha.
117 118 119 |
# File 'lib/cloudapp/account.rb', line 117 def alpha @alpha end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
117 118 119 |
# File 'lib/cloudapp/account.rb', line 117 def created_at @created_at end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
117 118 119 |
# File 'lib/cloudapp/account.rb', line 117 def domain @domain end |
#domain_home_page ⇒ Object (readonly)
Returns the value of attribute domain_home_page.
117 118 119 |
# File 'lib/cloudapp/account.rb', line 117 def domain_home_page @domain_home_page end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
117 118 119 |
# File 'lib/cloudapp/account.rb', line 117 def email @email end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
117 118 119 |
# File 'lib/cloudapp/account.rb', line 117 def id @id end |
#private_items ⇒ Object (readonly)
Returns the value of attribute private_items.
117 118 119 |
# File 'lib/cloudapp/account.rb', line 117 def private_items @private_items end |
#subscribed ⇒ Object (readonly)
Returns the value of attribute subscribed.
117 118 119 |
# File 'lib/cloudapp/account.rb', line 117 def subscribed @subscribed end |
#subscription_expires_at ⇒ Object (readonly)
Returns the value of attribute subscription_expires_at.
117 118 119 |
# File 'lib/cloudapp/account.rb', line 117 def subscription_expires_at @subscription_expires_at end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
117 118 119 |
# File 'lib/cloudapp/account.rb', line 117 def updated_at @updated_at end |
Class Method Details
.create(opts = {}) ⇒ CloudApp::Account
Create a CloudApp account.
71 72 73 74 |
# File 'lib/cloudapp/account.rb', line 71 def self.create(opts = {}) res = post "/register", :body => {:user => opts} res.ok? ? Account.new(res) : bad_response(res) end |
.find ⇒ CloudApp::Account
Get the basic details of the authenticated account.
Requires authentication.
59 60 61 62 |
# File 'lib/cloudapp/account.rb', line 59 def self.find res = get "/account", :digest_auth => @@auth res.ok? ? Account.new(res) : bad_response(res) end |
.reset(opts = {}) ⇒ Boolean
Dispatch an email containing a link to reset the account’s password.
102 103 104 105 |
# File 'lib/cloudapp/account.rb', line 102 def self.reset(opts = {}) res = post "/reset", :body => {:user => opts} res.ok? ? true : bad_response(res) end |
.stats ⇒ Hash
Get the total number of drops created and total views for all drops.
Requires authentication.
112 113 114 115 |
# File 'lib/cloudapp/account.rb', line 112 def self.stats res = get "/account/stats", :digest_auth => @@auth res.ok? ? res.symbolize_keys! : bad_response(res) end |
.update(opts = {}) ⇒ CloudApp::Account
Modify the authenticated accounts details. Can change the default security of newly created drops, the accounts email address, password, and custom domain details.
Note that when changing email address or password, the current password is required. Also note that to change custom domains requires an account with a Pro subscription.
Requires authentication
92 93 94 95 |
# File 'lib/cloudapp/account.rb', line 92 def self.update(opts = {}) res = put "/account", {:body => {:user => opts}, :digest_auth => @@auth} res.ok? ? Account.new(res) : bad_response(res) end |
Instance Method Details
#reset ⇒ Boolean
Dispatch an email containing a link to reset the account’s password.
144 145 146 |
# File 'lib/cloudapp/account.rb', line 144 def reset self.class.reset :email => self.email end |
#stats ⇒ Hash
Get the total number of drops created and total views for all drops.
151 152 153 |
# File 'lib/cloudapp/account.rb', line 151 def stats self.class.stats end |
#update(opts = {}) ⇒ CloudApp::Account
Modify the authenticated accounts details. Can change the default security of newly created drops, the accounts email address, password, and custom domain details.
Note that when changing email address or password, the current password is required. Also note that to change custom domains requires an account with a Pro subscription.
135 136 137 |
# File 'lib/cloudapp/account.rb', line 135 def update(opts = {}) self.class.update opts end |