class Textmagic::REST::Subaccounts
Public Instance Methods
Invite new subaccount. Returns True if success.
The following params keys are supported:
-
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
Close the subaccount. Returns true if success.
- uid
-
Subaccount
ID. Required.
Example:
r = client.subaccounts.delete 123123
Textmagic::REST::ListResource#delete
# File lib/textmagic-ruby/rest/subaccounts.rb 93 def delete(uid) 94 super uid 95 end
Get subaccount by ID. Returns Subaccount
object.
- uid
-
Subaccount
ID. Required.
Example:
@subaccount = client.subaccounts.get 123131
Textmagic::REST::ListResource#get
# File lib/textmagic-ruby/rest/subaccounts.rb 15 def get(uid) 16 super uid 17 end
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
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
Invite new subaccount. Alias for 'create' method. Returns True if success.
The following params keys are supported:
-
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
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