class Textmagic::REST::Subaccounts

Public Instance Methods

create(params={}) click to toggle source

Invite new subaccount. Returns True if success.

The following params keys are supported:

email

Subaccount email. Required.

role

Subaccount role: `A` for administrator or `U` for regular user. Required.

Example:

@subaccount = client.subaccounts.create {:email => 'sub_email@gmail.com', :role => 'A'}
   # File lib/textmagic-ruby/rest/subaccounts.rb
55 def create(params={})
56   self.send_invite params
57 end
delete(uid) click to toggle source

Close the subaccount. Returns true if success.

uid

Subaccount ID. Required.

Example:

r = client.subaccounts.delete 123123
Calls superclass method Textmagic::REST::ListResource#delete
   # File lib/textmagic-ruby/rest/subaccounts.rb
93 def delete(uid)
94   super uid
95 end
get(uid) click to toggle source

Get subaccount by ID. Returns Subaccount object.

uid

Subaccount ID. Required.

Example:

@subaccount = client.subaccounts.get 123131
Calls superclass method Textmagic::REST::ListResource#get
   # File lib/textmagic-ruby/rest/subaccounts.rb
15 def get(uid)
16   super uid
17 end
list(params={}) click to toggle source

Get all user subaccounts. Returns PaginateResource object, contains array of Subaccount objects.

The following params keys are supported:

page

Fetch specified results page. Defaults 1

limit

How many results on page. Defaults 10

Example:

@subaccounts = client.subaccounts.list
Calls superclass method Textmagic::REST::ListResource#list
   # File lib/textmagic-ruby/rest/subaccounts.rb
33 def list(params={})
34   [:search, 'search'].each do |search|
35     params.delete search
36   end
37   super params
38 end
send_invite(params={}) click to toggle source

Invite new subaccount. Alias for 'create' method. Returns True if success.

The following params keys are supported:

email

Subaccount email. Required.

role

Subaccount role: `A` for administrator or `U` for regular user. Required.

Example:

@subaccount = client.subaccounts.send_invite {:email => 'sub_email@gmail.com', :role => 'A'}
   # File lib/textmagic-ruby/rest/subaccounts.rb
73 def send_invite(params={})
74   response = @client.post "#{@path}", params
75 end
update(uid, params={}) click to toggle source

Updating is not supported.

   # File lib/textmagic-ruby/rest/subaccounts.rb
80 def update(uid, params={})
81   raise '`update` method is not supported for this resource.'
82 end