class Textmagic::REST::CustomFields

Public Instance Methods

create(params={}) click to toggle source

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

The following params keys are supported:

name

Name of custom field. Required.

Example:

@custom_field = client.custom_fields.create {:name => 'Birthday'}
Calls superclass method
   # File lib/textmagic-ruby/rest/custom_fields.rb
31 def create(params={})
32   super params
33 end
delete(uid) click to toggle source

Delete CustomField by ID. Returns true if success.

uid

CustomField ID. Required.

Example:

r = client.custom_fields.delete 987
Calls superclass method
   # File lib/textmagic-ruby/rest/custom_fields.rb
83 def delete(uid)
84   super uid
85 end
get(uid) click to toggle source

Get CustomField by ID. Returns CustomField object.

uid

Custom Field ID. Required.

Example:

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

Get all user custom fields. Returns PaginateResource object, contains array of CustomField objects.

The following params keys are supported:

page

Fetch specified results page. Defaults 1

limit

How many results on page. Defaults 10

Example:

@custom_fields = client.custom_fields.list
Calls superclass method
   # File lib/textmagic-ruby/rest/custom_fields.rb
49 def list(params={})
50   [:search, 'search'].each do |search|
51     params.delete search
52   end
53   super params
54 end
update(uid, params={}) click to toggle source

Updates the existing CustomField for the given unique id. Returns CustomField object contains id and link to updated CustomField.

uid

Custom field ID. Required.

The following params keys are supported:

name

Name of custom field. Required.

Example:

@custom_field = client.custom_fields.update 123, {:name => 'Updated'}
Calls superclass method
   # File lib/textmagic-ruby/rest/custom_fields.rb
70 def update(uid, params={})
71   super uid, params
72 end
update_value(uid, params={}) click to toggle source

Updates contact's custom field value. Returns Contact object contains id and link to updated Contact.

uid

Custom field ID. Required.

The following params keys are supported:

contact_id

The unique id of the Contact to update value. Required.

value

Value of CustomField. Required.

Example:

@custom_field = client.custom_fields.update 123, {:name => 'Updated'}
    # File lib/textmagic-ruby/rest/custom_fields.rb
103 def update_value(uid, params={})
104   response = @client.put("#{@path}/#{uid}/update", params)
105   Textmagic::REST::Contact.new @client, @path, response
106 end