Module: IContact::Api::CustomFields

Included in:
IContact::Api
Defined in:
lib/icontact/api/custom_fields.rb

Instance Method Summary collapse

Instance Method Details

#create_custom_field(data) ⇒ Object



16
17
18
19
# File 'lib/icontact/api/custom_fields.rb', line 16

def create_custom_field(data)
  response = post(custom_fields_path, wrap(data))
  resource(response, 'customfields', true)
end

#create_custom_fields(data) ⇒ Object



21
22
23
24
# File 'lib/icontact/api/custom_fields.rb', line 21

def create_custom_fields(data)
  response = post(custom_fields_path, data)
  resource(response, 'customfields')
end

#delete_custom_field(id) ⇒ Object



43
44
45
46
47
# File 'lib/icontact/api/custom_fields.rb', line 43

def delete_custom_field(id)
  ensure_valid_id(id)
  response = delete(custom_fields_path + id)
  resource(response, 'status')
end

#get_custom_field(id) ⇒ Object



5
6
7
8
9
# File 'lib/icontact/api/custom_fields.rb', line 5

def get_custom_field(id)
  ensure_valid_id(id)
  response = get(custom_fields_path + id)
  resource(response, 'customfield')
end

#get_custom_fields(limit = 10000) ⇒ Object



11
12
13
14
# File 'lib/icontact/api/custom_fields.rb', line 11

def get_custom_fields(limit = 10000)
  response = get(custom_fields_path + query(limit: limit))
  resource(response, 'customfields')
end

#update_custom_field(id, data) ⇒ Object



26
27
28
29
30
# File 'lib/icontact/api/custom_fields.rb', line 26

def update_custom_field(id, data)
  ensure_valid_id(id)
  response = post(custom_fields_path + id, data)
  resource(response, 'customfield')
end

#update_custom_field!(id, data) ⇒ Object



32
33
34
35
36
# File 'lib/icontact/api/custom_fields.rb', line 32

def update_custom_field!(id, data)
  ensure_valid_id(id)
  response = put(custom_fields_path + id, data)
  resource(response, 'customfield')
end

#update_custom_fields(data) ⇒ Object



38
39
40
41
# File 'lib/icontact/api/custom_fields.rb', line 38

def update_custom_fields(data)
  response = post(custom_fields_path, data)
  resource(response, 'customfields')
end