class Textmagic::REST::Contacts
Public Instance Methods
Create new Contact
. Returns Contact
object contains id and link to new Contact
.
The following params keys are supported:
- first_name
- last_name
- phone
- last_name
-
Contact's phone number. Required.
- email
- company_name
- country
- company_name
-
2-letter ISO country code.
- lists
-
String of
Lists
separated by commas to assign contact. Required.
Example:
@contact = client.contacts.create {:phone => '9999999', :lists => '123, 456'}
# File lib/textmagic-ruby/rest/contacts.rb 42 def create(params={}) 43 super params 44 end
Delete contact by ID. Returns true if success.
- uid
-
Contact
ID. Required.
Example:
r = client.contacts.delete 987
# File lib/textmagic-ruby/rest/contacts.rb 113 def delete(uid) 114 super uid 115 end
Get all user contacts. Returns PaginateResource
object, contains array of Contact
objects.
The following params keys are supported:
- search
-
If true then search contacts using `query`, `ids` and/or `group_id`. Defaults false.
- page
-
Fetch specified results page. Defaults 1
- limit
-
How many results on page. Defaults 10
- shared
-
Should contacts in shared lists to be included. Defaults 0
- ids
-
Find contact by ID(s). Using with `search`=true.
- list_id
-
Find contact by
List
ID. Using with `search`=true. - query
-
Find contact by specified search query. Using with `search`=true..
Example:
@contacts = client.contacts.list
# File lib/textmagic-ruby/rest/contacts.rb 70 def list(params={}) 71 super params 72 end
Fetch lists which contact belongs to. Returns PaginateResource
object, contains array of List
objects.
- uid
-
Contact
ID. Required.
The following params keys are supported:
- page
-
Fetch specified results page. Defaults 1
- limit
-
How many results on page. Defaults 10
Example:
@contact = client.contacts.lists 123
# File lib/textmagic-ruby/rest/contacts.rb 133 def lists(uid, params={}) 134 response = @client.get "#{@path}/#{uid}/lists", params 135 PaginateResource.new "#{@path}", @client, response, Textmagic::REST::List 136 end
Updates the existing Contact
for the given unique id. Returns Contact
object contains id and link to updated Contact
.
- uid
-
Contact
ID. Required.
The following params keys are supported:
- first_name
- last_name
- phone
- last_name
-
Contact's phone number. Required.
- email
- company_name
- country
- company_name
-
2-letter ISO country code.
- lists
-
String of
Lists
separated by commas to assign contact. Required.
Example:
@contact = client.contacts.update 123, {:phone => '9999999', :lists => '123, 456'}
# File lib/textmagic-ruby/rest/contacts.rb 100 def update(uid, params={}) 101 super uid, params 102 end