Class: SerwerSMS::Resources::Subaccounts

Inherits:
Object
  • Object
show all
Defined in:
lib/serwersms/resources/subaccounts.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Subaccounts

Returns a new instance of Subaccounts.



4
5
6
# File 'lib/serwersms/resources/subaccounts.rb', line 4

def initialize(client)
  @client = client
end

Instance Method Details

#add(subaccount_username, subaccount_password, subaccount_id, params = {}) ⇒ Hash

Create new subaccount

Parameters:

  • subaccount_username (String)
  • subaccount_password (String)
  • subaccount_id (Integer)

    Subaccount ID used as permissions template

  • params (Hash) (defaults to: {})

    @option params [String] :name @option params [String] :phone @option params [String] :email

Returns:

  • (Hash)

    @option return [Boolean] :success @option return [Integer] :id



20
21
22
23
24
25
# File 'lib/serwersms/resources/subaccounts.rb', line 20

def add(subaccount_username, subaccount_password, subaccount_id, params = {})
  params['subaccount_username'] = subaccount_username
  params['subaccount_password'] = subaccount_password
  params['subaccount_id']       = subaccount_id
  @client.call('subaccounts/add', params)
end

#delete(id) ⇒ Hash

Delete a subaccount

Parameters:

  • id (Integer)

Returns:

  • (Hash)

    @option return [Boolean] :success



67
68
69
# File 'lib/serwersms/resources/subaccounts.rb', line 67

def delete(id)
  @client.call('subaccounts/delete', 'id' => id)
end

#index(params = {}) ⇒ Hash

List of subaccounts

Returns:

  • (Hash)

    @option return [Array] :items @option item [Integer] :id @option item [String] :username



33
34
35
# File 'lib/serwersms/resources/subaccounts.rb', line 33

def index(params = {})
  @client.call('subaccounts/index', params)
end

#limit(id, type, value) ⇒ Hash

Set limit on subaccount

Parameters:

  • id (Integer)
  • type (String)

    eco|full|voice|mms|hlr

  • value (Integer)

Returns:

  • (Hash)

    @option return [Boolean] :success @option return [Integer] :id



58
59
60
# File 'lib/serwersms/resources/subaccounts.rb', line 58

def limit(id, type, value)
  @client.call('subaccounts/limit', 'id' => id, 'type' => type, 'value' => value)
end

#view(id) ⇒ Hash

View subaccount details

Parameters:

  • id (Integer)

Returns:

  • (Hash)

    @option return [Integer] :id @option return [String] :username @option return [String] :name @option return [String] :phone @option return [String] :email



46
47
48
# File 'lib/serwersms/resources/subaccounts.rb', line 46

def view(id)
  @client.call('subaccounts/view', 'id' => id)
end