Class: Sorenson::Services::Account
- Defined in:
- lib/sorenson/services/account.rb
Instance Attribute Summary collapse
-
#customer_id ⇒ Object
Returns the value of attribute customer_id.
-
#date_last_modified ⇒ Object
Returns the value of attribute date_last_modified.
-
#date_retrieved ⇒ Object
Returns the value of attribute date_retrieved.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_login_time ⇒ Object
Returns the value of attribute last_login_time.
-
#rate_plan ⇒ Object
Returns the value of attribute rate_plan.
-
#rate_plan_expiration_date ⇒ Object
Returns the value of attribute rate_plan_expiration_date.
-
#session_id ⇒ Object
Returns the value of attribute session_id.
-
#status ⇒ Object
Returns the value of attribute status.
-
#subaccount_id ⇒ Object
Returns the value of attribute subaccount_id.
-
#token ⇒ Object
Returns the value of attribute token.
-
#total_asset_count ⇒ Object
Returns the value of attribute total_asset_count.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #create_subaccount(username_email, password) ⇒ Object
- #empty_trash ⇒ Object
- #get_subaccounts ⇒ Object
-
#initialize(data) ⇒ Account
constructor
A new instance of Account.
- #overage_action ⇒ Object
- #set_password(password, old_password) ⇒ Object
Methods inherited from Base
delete_from, get_from, host, login_no_resource, parse_response, post_to, put_to, verify_account_settings
Constructor Details
#initialize(data) ⇒ Account
Returns a new instance of Account.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/sorenson/services/account.rb', line 46 def initialize(data) self.username = data['username'] self.status = data['status'] self.customer_id = data['id'] self.id = data['id'] self.subaccount_id = data['subaccount_id'] self.session_id = data['session_id'] self.rate_plan_expiration_date = data['rate_plan_expiration_date'] self.date_last_modified = data['date_last_modified'] self.last_login_time = data['last_login_time'] self.date_retrieved = data['date_retrieved'] self.total_asset_count = data['total_asset_count'] self.token = data['token'] self.id = data['account_id'] if data['account_id'] end |
Instance Attribute Details
#customer_id ⇒ Object
Returns the value of attribute customer_id.
4 5 6 |
# File 'lib/sorenson/services/account.rb', line 4 def customer_id @customer_id end |
#date_last_modified ⇒ Object
Returns the value of attribute date_last_modified.
4 5 6 |
# File 'lib/sorenson/services/account.rb', line 4 def date_last_modified @date_last_modified end |
#date_retrieved ⇒ Object
Returns the value of attribute date_retrieved.
4 5 6 |
# File 'lib/sorenson/services/account.rb', line 4 def date_retrieved @date_retrieved end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/sorenson/services/account.rb', line 4 def id @id end |
#last_login_time ⇒ Object
Returns the value of attribute last_login_time.
4 5 6 |
# File 'lib/sorenson/services/account.rb', line 4 def last_login_time @last_login_time end |
#rate_plan ⇒ Object
Returns the value of attribute rate_plan.
4 5 6 |
# File 'lib/sorenson/services/account.rb', line 4 def rate_plan @rate_plan end |
#rate_plan_expiration_date ⇒ Object
Returns the value of attribute rate_plan_expiration_date.
4 5 6 |
# File 'lib/sorenson/services/account.rb', line 4 def rate_plan_expiration_date @rate_plan_expiration_date end |
#session_id ⇒ Object
Returns the value of attribute session_id.
4 5 6 |
# File 'lib/sorenson/services/account.rb', line 4 def session_id @session_id end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/sorenson/services/account.rb', line 4 def status @status end |
#subaccount_id ⇒ Object
Returns the value of attribute subaccount_id.
4 5 6 |
# File 'lib/sorenson/services/account.rb', line 4 def subaccount_id @subaccount_id end |
#token ⇒ Object
Returns the value of attribute token.
4 5 6 |
# File 'lib/sorenson/services/account.rb', line 4 def token @token end |
#total_asset_count ⇒ Object
Returns the value of attribute total_asset_count.
4 5 6 |
# File 'lib/sorenson/services/account.rb', line 4 def total_asset_count @total_asset_count end |
#username ⇒ Object
Returns the value of attribute username.
4 5 6 |
# File 'lib/sorenson/services/account.rb', line 4 def username @username end |
Class Method Details
.get_account ⇒ Object
Get Accout
17 18 19 |
# File 'lib/sorenson/services/account.rb', line 17 def self.get_account new(get_from("/accounts/#{account_id}")) end |
.login(username, password) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/sorenson/services/account.rb', line 8 def self.login(username, password) data = JSON.parse(login_no_resource(username, password)) account = Account.new(data) self.account_token = account.token self.account_id = account.id return account if account.token end |
Instance Method Details
#create_subaccount(username_email, password) ⇒ Object
41 42 43 |
# File 'lib/sorenson/services/account.rb', line 41 def create_subaccount(username_email, password) Base.post_to("/subaccounts", :subaccount => {:username => username_email, :email => username_email, :password => password}) end |
#empty_trash ⇒ Object
33 34 35 |
# File 'lib/sorenson/services/account.rb', line 33 def empty_trash Base.post_to("/accounts/#{account_id}/empty_trash")['status'] end |
#get_subaccounts ⇒ Object
37 38 39 |
# File 'lib/sorenson/services/account.rb', line 37 def get_subaccounts Base.get_from("/subaccounts") end |