Class: Plivo::Resources::Subaccount

Inherits:
Base::Resource show all
Defined in:
lib/plivo/resources/accounts.rb

Constant Summary

Constants included from Utils

Utils::TYPE_WHITELIST

Instance Attribute Summary

Attributes inherited from Base::Resource

#id

Instance Method Summary collapse

Methods included from Utils

GetSortedQueryParamString?, compute_signatureV3?, expected_type?, expected_value?, generate_url?, getMapFromQueryString?, is_one_among_string_url?, multi_valid_param?, raise_invalid_request, valid_account?, valid_date_format?, valid_mainaccount?, valid_multiple_destination_integers?, valid_multiple_destination_nos?, valid_param?, valid_range?, valid_signature?, valid_signatureV3?, valid_subaccount?, valid_url?

Constructor Details

#initialize(client, options = nil) ⇒ Subaccount

Returns a new instance of Subaccount.



5
6
7
8
9
# File 'lib/plivo/resources/accounts.rb', line 5

def initialize(client, options = nil)
  @_name = 'Subaccount'
  @_identifier_string = 'auth_id'
  super
end

Instance Method Details

#delete(cascade = false) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/plivo/resources/accounts.rb', line 23

def delete(cascade = false)
  valid_param?(:cascade, cascade, [TrueClass, FalseClass],
    false, [true, false])
  
  params = {
    :cascade => cascade
  }
    
  perform_delete(params)
end

#to_sObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/plivo/resources/accounts.rb', line 34

def to_s
  {
    account: @account,
    api_id: @api_id,
    auth_id: @auth_id,
    auth_token: @auth_token,
    new_auth_token: @new_auth_token,
    created: @created,
    enabled: @enabled,
    modified: @modified,
    name: @name,
    resource_uri: @resource_uri
  }.to_s
end

#update(name, enabled = false) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/plivo/resources/accounts.rb', line 11

def update(name, enabled = false)
  valid_param?(:name, name, [String, Symbol], true)
  valid_param?(:enabled, enabled, [TrueClass, FalseClass],
               true, [true, false])

  params = {
    name: name,
    enabled: enabled
  }
  perform_update(params)
end