Class: Sorenson::ThreeSixty::Subaccount
- Defined in:
- lib/sorenson/threesixty/subaccount.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#account ⇒ Object
Attributes.
-
#accountId ⇒ Object
Attributes.
-
#dateRetrieved ⇒ Object
Attributes.
-
#email ⇒ Object
Attributes.
-
#id ⇒ Object
Attributes.
-
#status ⇒ Object
Attributes.
-
#username ⇒ Object
Attributes.
Instance Method Summary collapse
- #activate! ⇒ Object
- #deactivate! ⇒ Object
-
#initialize(account, data) ⇒ Subaccount
constructor
Instance Methods.
Methods inherited from Base
debug=, debug?, host, #post_to, post_to, protocol, token_for, use_ssl=, use_ssl?
Constructor Details
#initialize(account, data) ⇒ Subaccount
Instance Methods
12 13 14 15 16 17 18 19 20 |
# File 'lib/sorenson/threesixty/subaccount.rb', line 12 def initialize(account, data) self.account = account self.username = data['username'] self.id = data['id'] self.status = data['status'] self.accountId = data['accountId'] self.email = data['email'] self.dateRetrieved = data['dateRetrieved'] end |
Instance Attribute Details
#account ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/subaccount.rb', line 6 def account @account end |
#accountId ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/subaccount.rb', line 6 def accountId @accountId end |
#dateRetrieved ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/subaccount.rb', line 6 def dateRetrieved @dateRetrieved end |
#email ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/subaccount.rb', line 6 def email @email end |
#id ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/subaccount.rb', line 6 def id @id end |
#status ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/subaccount.rb', line 6 def status @status end |
#username ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/subaccount.rb', line 6 def username @username end |
Instance Method Details
#activate! ⇒ Object
22 23 24 25 |
# File 'lib/sorenson/threesixty/subaccount.rb', line 22 def activate! data = post_to("/api/setSubaccountStatus?subaccountId=#{id}&status=Live&sessionId=#{account.sessionId}") data['success'] == 1 end |
#deactivate! ⇒ Object
27 28 29 30 |
# File 'lib/sorenson/threesixty/subaccount.rb', line 27 def deactivate! data = post_to("/api/setSubaccountStatus?subaccountId=#{id}&status=Retired&sessionId=#{account.sessionId}") data['success'] == 1 end |