Class: Sorenson::ThreeSixty::Subaccount

Inherits:
Base
  • Object
show all
Defined in:
lib/sorenson/threesixty/subaccount.rb

Constant Summary

Constants inherited from Base

Base::TOKEN_SALT

Instance Attribute Summary collapse

Instance Method Summary collapse

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(, data)
  self.                  = 
  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

#accountObject

Attributes



6
7
8
# File 'lib/sorenson/threesixty/subaccount.rb', line 6

def 
  @account
end

#accountIdObject

Attributes



6
7
8
# File 'lib/sorenson/threesixty/subaccount.rb', line 6

def accountId
  @accountId
end

#dateRetrievedObject

Attributes



6
7
8
# File 'lib/sorenson/threesixty/subaccount.rb', line 6

def dateRetrieved
  @dateRetrieved
end

#emailObject

Attributes



6
7
8
# File 'lib/sorenson/threesixty/subaccount.rb', line 6

def email
  @email
end

#idObject

Attributes



6
7
8
# File 'lib/sorenson/threesixty/subaccount.rb', line 6

def id
  @id
end

#statusObject

Attributes



6
7
8
# File 'lib/sorenson/threesixty/subaccount.rb', line 6

def status
  @status
end

#usernameObject

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=#{.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=#{.sessionId}")
  data['success'] == 1
end