active_campaign_wrapper 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +7 -0
  2. data/.env.sample +2 -0
  3. data/.gitignore +20 -0
  4. data/.rspec +4 -0
  5. data/.rubocop.yml +6 -0
  6. data/.travis.yml +10 -0
  7. data/CODE_OF_CONDUCT.md +74 -0
  8. data/Gemfile +6 -0
  9. data/LICENSE +21 -0
  10. data/README.md +539 -0
  11. data/Rakefile +21 -0
  12. data/active_campaign_wrapper.gemspec +48 -0
  13. data/bin/console +14 -0
  14. data/bin/setup +8 -0
  15. data/lib/active_campaign_wrapper.rb +21 -0
  16. data/lib/active_campaign_wrapper/api/contact/arguments.rb +18 -0
  17. data/lib/active_campaign_wrapper/api/custom_field/arguments.rb +15 -0
  18. data/lib/active_campaign_wrapper/api/list/arguments.rb +19 -0
  19. data/lib/active_campaign_wrapper/client.rb +73 -0
  20. data/lib/active_campaign_wrapper/configuration.rb +59 -0
  21. data/lib/active_campaign_wrapper/core/contact_automation_gateway.rb +16 -0
  22. data/lib/active_campaign_wrapper/core/contact_gateway.rb +66 -0
  23. data/lib/active_campaign_wrapper/core/contact_score_value_gateway.rb +16 -0
  24. data/lib/active_campaign_wrapper/core/contact_tag_gateway.rb +32 -0
  25. data/lib/active_campaign_wrapper/core/custom_field_gateway.rb +46 -0
  26. data/lib/active_campaign_wrapper/core/custom_field_option_gateway.rb +30 -0
  27. data/lib/active_campaign_wrapper/core/custom_field_value_gateway.rb +44 -0
  28. data/lib/active_campaign_wrapper/core/email_activity_gateway.rb +16 -0
  29. data/lib/active_campaign_wrapper/core/list_gateway.rb +46 -0
  30. data/lib/active_campaign_wrapper/core/tag_gateway.rb +40 -0
  31. data/lib/active_campaign_wrapper/helpers.rb +88 -0
  32. data/lib/active_campaign_wrapper/version.rb +5 -0
  33. metadata +288 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1644a0094a6302f78117f2de1f93d72494bc0d9f612c22fca8d4b3998b2a9e03
4
+ data.tar.gz: 3276a2d8d3cd37cfc0cc9913c7f7afc6c25805e20a170e7b5246eebd0d98de5d
5
+ SHA512:
6
+ metadata.gz: 5777d3e25b2425ebe0a831da6e1195bd5e608929c377d22e5c38135f2e4568b05f70112b1b987323b70571f10ed19913caca282757cbdfeafff597b6cc88090e
7
+ data.tar.gz: 784401487b377b973748b1aa672b7bd7d9d8f45649eb287abd0a3eb68bb9d2eda5d008c8febb5dfda7cb3166b45b7f16aafbc5a8436e089cc6d07ecbbb80f2ec
data/.env.sample ADDED
@@ -0,0 +1,2 @@
1
+ ACTIVE_CAMPAIGN_API_KEY=123abc
2
+ ACTIVE_CAMPAIGN_API_HOST=https://dummy.api-us1.com
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ coverage/*
10
+ *~
11
+ .rvmrc
12
+ log/*
13
+ measurement/*
14
+ .DS_Store
15
+ .env
16
+ *.gem
17
+ spec/dummy/tmp/*
18
+ spec/dummy/log/*.log
19
+ .rspec_status
20
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --require spec_helper
3
+ --order rand
4
+ --format doc
data/.rubocop.yml ADDED
@@ -0,0 +1,6 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rspec
4
+
5
+ Style/Documentation:
6
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.5.8
6
+ - 2.6.6
7
+ - 2.7.1
8
+ install: bundle install --retry=3
9
+ before_install:
10
+ - gem install bundler -v 2.1.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at anmolyousaf94@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in active_campaign_wrapper.gemspec
6
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Anmol Yousaf
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,539 @@
1
+ # ActiveCampaignWrapper
2
+
3
+ [![Build Status](https://travis-ci.com/anmol-yousaf/active_campaign_wrapper.svg?branch=main)](https://travis-ci.com/anmol-yousaf/active_campaign_wrapper)
4
+ [![Test Coverage](https://codecov.io/gh/anmol-yousaf/active_campaign_wrapper/graph/badge.svg)](https://codecov.io/gh/anmol-yousaf/active_campaign_wrapper)
5
+
6
+ This library is designed to help ruby/rails based applications communicate with the publicly available REST API for ActiveCampaign.
7
+
8
+ If you are unfamiliar with the ActiveCampaign REST API, you should first read the documentation located at https://developers.activecampaign.com/reference.
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'active_campaign_wrapper'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle install
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install active_campaign_wrapper
25
+
26
+ ## Usage
27
+
28
+ ##### Table of Contents
29
+
30
+ * [Initialize](#initialize)
31
+ * [Tags](#tags)
32
+ * [Lists](#lists)
33
+ * [Contacts](#tags)
34
+ * [Contact Tags](#contact-tags)
35
+ * [Contact Automations](#contact-automations)
36
+ * [Contact Score Values](#contact-score-values)
37
+ * [Custom Fields](#custom-fields)
38
+ * [Custom Field Options](#custom-field-options)
39
+ * [Custom Field Values](#custom-field-values)
40
+ * [Email Activities](#email-activities)
41
+
42
+
43
+ <a name="initialize"/>
44
+
45
+ ### Initialize
46
+
47
+ You can specify your Endpoint URL and API token in a config file looking like this.
48
+
49
+ ```ruby
50
+ ActiveCampaignWrapper.config do |config|
51
+ config.endpoint_url = 'your-url'
52
+ config.api_token = 'your-token'
53
+ end
54
+ ```
55
+ and then initialize the client like
56
+
57
+ ```ruby
58
+ client = ActiveCampaignWrapper::Client.new
59
+ ```
60
+ OR
61
+
62
+ You can pass the Endpoint URL and API token directly to the client.
63
+
64
+ ```ruby
65
+ client = ActiveCampaignWrapper::Client.new({
66
+ endpoint_url: 'your-url',
67
+ api_token: 'your-token'
68
+ })
69
+ ```
70
+ <a name="tags"/>
71
+
72
+ ### Tags - [Api Reference](https://developers.activecampaign.com/reference#tags)
73
+
74
+ #### Create a tag
75
+
76
+ ```ruby
77
+ client.tags.create({
78
+ tag: 'Tag Name',
79
+ tag_type: 'contact',
80
+ description: 'Tag description'
81
+ })
82
+ ```
83
+ **BODY PARAMS**
84
+ - tag (string) : Name of the new tag
85
+ - tag_type (string): Tag-type of the new tag. Possible Values: template, contact.
86
+ - description (string): Description of the new tag
87
+
88
+ #### Retrieve a tag
89
+
90
+ ```ruby
91
+ client.tags.find(tag_id)
92
+ ```
93
+
94
+ #### Update a tag
95
+
96
+ ```ruby
97
+ client.tags.update(tag_id, {
98
+ tag: 'Updated Tag Name'
99
+ })
100
+ ```
101
+
102
+ #### Delete a tag
103
+
104
+ ```ruby
105
+ client.tags.delete(tag_id)
106
+ ```
107
+
108
+ #### List all tags
109
+
110
+ ```ruby
111
+ client.tags.all
112
+ ```
113
+
114
+ **QUERY PARAMS** (Optional)
115
+ - search (string): Filter by name of tag(s)
116
+
117
+ <a name="lists"/>
118
+
119
+ ### Lists - [Api Reference](https://developers.activecampaign.com/reference#lists)
120
+
121
+ #### Create a list
122
+
123
+ ```ruby
124
+ client.lists.create({
125
+ name: 'New List',
126
+ stringid: 'new-list',
127
+ sender_url:'https://workytical.com',
128
+ sender_reminder: 'You are getting this notification as you have subscribed to our list.'
129
+ })
130
+ ```
131
+ **BODY PARAMS**
132
+ - name* (string): Name of the list to create
133
+ - stringid* (string): URL-safe list name. Example: 'list-name-sample'
134
+ - sender_url* (string): The website URL this list is for.
135
+ - sender_reminder* (string): A reminder for your contacts as to why they are on this list and you are messaging them.
136
+ - send_last_broadcast (boolean): Boolean value indicating whether or not to send the last sent campaign to this list to a new subscriber upon subscribing. 1 = yes, 0 = no
137
+ - carboncopy (string): Comma-separated list of email addresses to send a copy of all mailings to upon send
138
+ - subscription_notify (string): Comma-separated list of email addresses to notify when a new subscriber joins this list.
139
+ - unsubscription_notify (string): Comma-separated list of email addresses to notify when a subscriber unsubscribes from this list.
140
+ - user (integer): User Id of the list owner. A list owner is able to control campaign branding. A property of list.userid also exists on this object; both properties map to the same list owner field and are being maintained in the response object for backward compatibility. If you post values for both list.user and list.userid, the value of list.user will be used.
141
+
142
+ #### Retrieve a list
143
+
144
+ ```ruby
145
+ client.lists.find(list_id)
146
+ ```
147
+
148
+ #### Update a list
149
+
150
+ ```ruby
151
+ client.lists.update(list_id, {
152
+ name: 'Updated List Name'
153
+ })
154
+ ```
155
+
156
+ #### Delete a list
157
+
158
+ ```ruby
159
+ client.lists.delete(list_id)
160
+ ```
161
+
162
+ #### Retrieve all lists
163
+
164
+ ```ruby
165
+ client.lists.all
166
+ ```
167
+
168
+ **QUERY PARAMS** (Optional)
169
+ - filters[name] (string): Filter by the name of the list.
170
+
171
+ <a name="contacts"/>
172
+
173
+ #### Contacts - [Api Reference](https://developers.activecampaign.com/reference#contact)
174
+
175
+ #### Create a contact
176
+
177
+ ```ruby
178
+ client.contacts.create({
179
+ email: 'contact@email.com',
180
+ first_name:'first',
181
+ last_name: 'last'
182
+ })
183
+ ```
184
+
185
+ **BODY PARAMS**
186
+ - email* (string): Email address of the new contact. Example: 'test@example.com'
187
+ - status (integer) Status of your contact. Possible Values: -1..3
188
+ - -1 Any
189
+ - 0 Unconfirmed
190
+ - 1 Active
191
+ - 2 Unsubscribed
192
+ - 3 Bounced
193
+ - first_name (string): First name of the new contact.
194
+ - last_name (string): Last name of the new contact.
195
+ - phone (integer): Phone number of the contact.
196
+ - field_values (array): Array of contact's custom field values [{field, value}]
197
+
198
+ #### Create or update contact
199
+
200
+ ```ruby
201
+ client.contacts.sync({
202
+ email: 'contact@email.com',
203
+ first_name:'first',
204
+ last_name: 'last'
205
+ })
206
+ ```
207
+
208
+ #### Update list status for a contact
209
+
210
+ ```ruby
211
+ client.contacts.update_list_status({
212
+ list: list_id,
213
+ contact: contact_id,
214
+ status: 1
215
+ })
216
+ ```
217
+
218
+ **BODY PARAMS**
219
+ - list* (string/integer):ID of the list to subscribe the contact to
220
+ - contact* (string/integer): ID of the contact to subscribe to the list
221
+ - status* (string/integer): Set to "1" to subscribe the contact to the list. Set to "2" to unsubscribe the contact from the list. WARNING: If you change a status from unsubscribed to active, you can re-subscribe a contact to a list from which they had manually unsubscribed.
222
+ - sourceid (integer): Set to "4" when re-subscribing a contact to a list
223
+
224
+ #### Retrieve a contact
225
+
226
+ ```ruby
227
+ client.contacts.find(contact_id)
228
+ ```
229
+
230
+ #### Update a contact
231
+
232
+ ```ruby
233
+ client.contacts.update(contact_id, {
234
+ first_name: 'Updated Contact Name'
235
+ })
236
+ ```
237
+
238
+ #### Delete a contact
239
+
240
+ ```ruby
241
+ client.contacts.delete(contact_id)
242
+ ```
243
+
244
+ #### Retrieve all contacts
245
+
246
+ ```ruby
247
+ client.contacts.all
248
+ ```
249
+
250
+ **QUERY PARAMS** (Optional)
251
+ - ids (string): Filter contacts by ID.
252
+ - email (string): Email address of the contact you want to get
253
+ - email_like (string): Filter contacts that contain the given value in the email address
254
+ - exclude (integer): Exclude from the response the contact with the given ID
255
+ - formid (integer): Filter contacts associated with the given form
256
+ - id_greater (integer): Only include contacts with an ID greater than the given ID
257
+ - id_less (integer): Only include contacts with an ID less than the given ID
258
+ - listid (string): Filter contacts associated with the given list
259
+ - search (string): Filter contacts that match the given value in the contact names, organization, phone or email
260
+ - segmentid (integer): Return only contacts that match a list segment (this param initially returns segment information, when it is run a second time it will return contacts that match the segment)
261
+ - seriesid (integer): Filter contacts associated with the given automation
262
+ - status (integer): -1..3
263
+ - tagid (integer): Filter contacts associated with the given tag
264
+ - filters[created_before] (date) Filter contacts that were created prior to this date
265
+ - filters[created_after] (date): Filter contacts that were created after this date
266
+ - filters[updated_before] (date): Filter contacts that were updated before this date
267
+ - filters[updated_after] (date): Filter contacts that were updated after this date
268
+ - waitid (integer): Filter by contacts in the wait queue of an automation block
269
+ - orders[cdate] (string): Order contacts by creation date
270
+ - orders[email] (string): Order contacts by email
271
+ - orders[first_name] (string): Order contacts by first name
272
+ - orders[last_name] (string): Order contacts by last name
273
+ - orders[name] (string): Order contacts by full name
274
+ - orders[score] (string): Order contacts by score
275
+ - in_group_lists (string): Set this to "true" in order to return only contacts that the current user has permissions to see.
276
+
277
+ #### Bulk import contacts
278
+
279
+ ```ruby
280
+ client.contacts.bulk_import({
281
+ contacts: [
282
+ {
283
+ email: 'someone@somewhere.com',
284
+ first_name: 'Jane',
285
+ last_name: 'Doe',
286
+ phone: '123-456-7890',
287
+ customer_acct_name: 'ActiveCampaign',
288
+ tags: [
289
+ 'dictumst aliquam augue quam sollicitudin rutrum'
290
+ ]
291
+ }
292
+ ],
293
+ callback: {
294
+ url: "www.your_web_server.com",
295
+ request_type: "POST",
296
+ detailed_results: "true",
297
+ params: [
298
+ { "key": "", "value": "" }
299
+ ],
300
+ headers: [
301
+ { "key": "", "value": "" }
302
+ ]
303
+ }
304
+ })
305
+ ```
306
+
307
+ **BODY PARAMS**
308
+ - contacts* (array of objects): An array of objects containing information about a single contact. Up to 250 contacts may be included in a single request. The suggested minimum number of contacts is 10. If less than that, then contact/sync api request should be used.
309
+ - callback (object): Callback function to notify users when an import is complete.
310
+ - url (string): The URL endpoint which the importer will make a request to once the import has completed.
311
+ - request_type (string): Can be set to either “GET” or “POST”. Determines the type of HTTP request which will be sent to the specified endpoint.
312
+ - detailed_results (string): When set to “true” and the requestType parameter is set to “POST”, the callback will include the number of successes and failures in the originating request, as well as an array of error messages for each failed contact.
313
+ - params (array of objects): A list of parameters to include in the callback request. Add each parameter in the form of a key-value pair. For a GET request, each parameter will be appended to the end of the URL in a query string. For a POST request, parameters will be included in the body of the request.
314
+ - headers (array of objects): A list of headers to include in the callback request. Add each header in the form of a key-value pair.
315
+
316
+ <a name="#contact-tags"/>
317
+
318
+ ### Contact Tags - [Api Reference](https://developers.activecampaign.com/reference#contact-tags)
319
+
320
+ #### Retrieve all tags of a contact
321
+
322
+ ```ruby
323
+ client.contact_tags.all(contact_id)
324
+ ```
325
+
326
+ #### Add a tag to a contact
327
+
328
+ ```ruby
329
+ client.contact_tags.create({
330
+ contact: contact_id,
331
+ tag: tag_id
332
+ })
333
+ ```
334
+ **BODY PARAMS**
335
+ - contact* (integer): Contact's id
336
+ - tag* (integer): Tag's id
337
+
338
+ #### Retrieve a contact tag
339
+
340
+ ```ruby
341
+ client.contact_tags.find(contact_tag_id)
342
+ ```
343
+
344
+ #### Remove a tag from a contact
345
+
346
+ ```ruby
347
+ client.contact_tags.delete(contact_tag_id)
348
+ ```
349
+ <a name="#contact-automations"/>
350
+
351
+ ### Contact Automations - [Api Reference](https://developers.activecampaign.com/reference#list-all-contactautomations-for-contact)
352
+
353
+ #### List all automations the contact is in
354
+
355
+ ```ruby
356
+ client.contact_automations.all(contact_id)
357
+ ```
358
+
359
+ <a name="#contact-score-values"/>
360
+
361
+ ### Contact Score Values - [Api Reference](https://developers.activecampaign.com/reference#list-all-contactautomations-for-contact)
362
+
363
+ #### Retrieve a contact's score values
364
+
365
+ ```ruby
366
+ client.contact_score_values.all(contact_id)
367
+ ```
368
+
369
+ <a name="#email-activities"/>
370
+
371
+ ### Email Activities - [Api Reference](https://developers.activecampaign.com/reference#email-emailactivities)
372
+
373
+ #### Retrieve all email activities
374
+
375
+ ```ruby
376
+ client.email_activities.all
377
+ ```
378
+
379
+ **QUERY PARAMS** (Optional)
380
+ - filters[subscriberid] (integer): Set this parameter to return only email activities belonging to a given subscriber.
381
+ - filters[dealId] (integer): Set this parameter to return only email activities belonging to a given deal.
382
+
383
+ <a name="#custom-fields"/>
384
+
385
+ ### Custom Fields - [Api Reference](https://developers.activecampaign.com/reference#fields)
386
+
387
+ #### Create a custom field
388
+
389
+ ```ruby
390
+ client.custom_fields.create({
391
+ type: "textarea",
392
+ title: "Field Title",
393
+ descript: "Field description",
394
+ perstag: "Personalized Tag",
395
+ defval: "Defaut Value",
396
+ visible: 1,
397
+ ordernum: 1
398
+ })
399
+ ```
400
+
401
+ **BODY PARAMS**
402
+ - title* (string): Title of the field being created
403
+ - type* (string): Possible Values: dropdown, hidden, checkbox, date, text, datetime, textarea, NULL, listbox, radio
404
+ - descript (string): Description of field being created
405
+ - perstag (string): The perstag that represents the field being created
406
+ - defval (string): Default value of the field being created
407
+ - show_in_list (boolean): Show this field in the contact list view (Deprecated - no longer used)
408
+ - visible (boolean): Show or hide this field when using the Form Builder
409
+ - service (string): Possible Vales: nimble, contactually, mindbody, salesforce, highrise, google_spreadsheets, pipedrive, onepage, google_contacts, freshbooks, shopify, zendesk, etsy, NULL, bigcommerce, capsule, bigcommerce_oauth, sugarcrm, zohocrm, batchbook
410
+ - ordernum (integer): Order of appearance in ‘My Fields’ tab.
411
+
412
+ #### Retrieve a custom field
413
+
414
+ ```ruby
415
+ client.custom_fields.find(field_id)
416
+ ```
417
+
418
+ #### Update a custom field
419
+
420
+ ```ruby
421
+ client.custom_fields.update(field_id, {
422
+ title: 'Updated Field Title'
423
+ })
424
+ ```
425
+
426
+ #### Delete a custom field
427
+
428
+ ```ruby
429
+ client.custom_fields.delete(field_id)
430
+ ```
431
+
432
+ #### Retrieve all custom fields
433
+
434
+ ```ruby
435
+ client.custom_fields.all
436
+ ```
437
+
438
+ **QUERY PARAMS** (Optional)
439
+ - limit (integer): The number of fields returned per request.
440
+
441
+ <a name="#custom-field-options"/>
442
+
443
+ ### Custom Fields Options - [Api Reference](https://developers.activecampaign.com/reference#create-custom-field-options)
444
+
445
+ #### Create custom field options
446
+
447
+ ```ruby
448
+ client.custom_field_options.create([
449
+ {
450
+ field: custom_field_id,
451
+ label: option_1_title,
452
+ value: option_1_value
453
+ },
454
+ {
455
+ field: custom_field_id,
456
+ label: option_2_title,
457
+ value: option_2_value
458
+ }
459
+ ])
460
+ ```
461
+
462
+ **BODY PARAMS**
463
+ - field* (integer): ID of the custom field to add options to
464
+ - label (string): Name of the option
465
+ - value* (string): Value of the option
466
+ - orderid (integer): Order for displaying the custom field option
467
+ - isdefault: Whether or not this option is the default value
468
+
469
+ #### Retrieve a custom field option
470
+
471
+ ```ruby
472
+ client.custom_field_options.find(field_option_id)
473
+ ```
474
+
475
+ #### Delete a custom field option
476
+
477
+ ```ruby
478
+ client.custom_field_options.delete(field_option_id)
479
+ ```
480
+
481
+ <a name="#custom-field-values"/>
482
+
483
+ ### Custom Fields Values - [Api Reference](https://developers.activecampaign.com/reference#fieldvalues)
484
+
485
+ #### Create a custom field value
486
+
487
+ ```ruby
488
+ client.custom_field_values.create({
489
+ contact: contact_id,
490
+ field: field_id,
491
+ value: value
492
+ }, useDefaults: true)
493
+ ```
494
+
495
+ **BODY PARAMS**
496
+ - contact* (string/integer): ID of the contact whose field value you're updating
497
+ - field* (string/integer): ID of the custom field whose value you're updating for the contact
498
+ - value* (string): Value for the field that you're updating. For multi-select options this needs to be in the format of ||option1||option2||
499
+ - useDefaults: If true, this will populate the missing required fields for this contact with default values
500
+
501
+ #### Retrieve a custom field value
502
+
503
+ ```ruby
504
+ client.custom_field_values.find(field_value_id)
505
+ ```
506
+
507
+ #### Update a custom field value
508
+
509
+ ```ruby
510
+ client.custom_field_values.update(
511
+ field_value_id,
512
+ { value: value },
513
+ use_defaults: false
514
+ )
515
+ ```
516
+
517
+ #### Delete a custom field value
518
+
519
+ ```ruby
520
+ client.custom_field_values.delete(field_value_id)
521
+ ```
522
+
523
+ #### Retrieve all custom field values
524
+
525
+ ```ruby
526
+ client.custom_field_values.all
527
+ ```
528
+
529
+ ## Contributing
530
+
531
+ Bug reports and pull requests are welcome on GitHub at https://github.com/anmol-yousaf/active_campaign_wrapper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/anmol-yousaf/active_campaign_wrapper/blob/master/CODE_OF_CONDUCT.md).
532
+
533
+ ## License
534
+
535
+ See the [LICENSE](https://opensource.org/licenses/MIT) file for more info.
536
+
537
+ ## Code of Conduct
538
+
539
+ Everyone interacting in the ActiveCampaignWrapper project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/anmol-yousaf/active_campaign_wrapper/blob/master/CODE_OF_CONDUCT.md).