class Textmagic::REST::Contacts

Public Instance Methods

create(params={}) click to toggle source

Create new Contact. Returns Contact object contains id and link to new Contact.

The following params keys are supported:

first_name
last_name
phone

Contact's phone number. Required.

email
company_name
country

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'}
Calls superclass method
   # File lib/textmagic-ruby/rest/contacts.rb
42 def create(params={})
43   super params
44 end
delete(uid) click to toggle source

Delete contact by ID. Returns true if success.

uid

Contact ID. Required.

Example:

r = client.contacts.delete 987
Calls superclass method
    # File lib/textmagic-ruby/rest/contacts.rb
113 def delete(uid)
114   super uid
115 end
get(uid) click to toggle source

Get contact by ID. Returns Contact object.

uid

Contact ID. Required.

Example:

@contact = client.contacts.get 987
Calls superclass method
   # File lib/textmagic-ruby/rest/contacts.rb
14 def get(uid)
15   super uid
16 end
list(params={}) click to toggle source

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
Calls superclass method
   # File lib/textmagic-ruby/rest/contacts.rb
70 def list(params={})
71   super params
72 end
lists(uid, params={}) click to toggle source

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
update(uid, params={}) click to toggle source

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

Contact's phone number. Required.

email
company_name
country

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'}
Calls superclass method
    # File lib/textmagic-ruby/rest/contacts.rb
100 def update(uid, params={})
101   super uid, params
102 end