ontraport_api 0.2.2 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a97839aad56c249eb9661a4ee7f65adc278de476
4
- data.tar.gz: 2d4062e746e2874c17707e0e6a43ca81610629bc
3
+ metadata.gz: 50858291d18ca45568187334332eeb3ebae2f273
4
+ data.tar.gz: 1fd0b967adbda2e007532c8fbcbafb4da5d2aee5
5
5
  SHA512:
6
- metadata.gz: 9b5af05ad83b261edf5c501b179c887062910f8735c1eadc4ad67ce61d4959cc605e207f0a558145e49f22ffc385a7e30e41589818cf7e241ef15d53f481621d
7
- data.tar.gz: 281a1d41909463b532310537777e39fc1572bbf5660d5931c6e506062b6cd7775d9d5b0eb72f62949604f7eac47577a75939f2231bdadedb5d40d3ba147cd352
6
+ metadata.gz: 2906f58101d748efcd566ebb6653c08ce99bd4964f3c6a8823305e84d74e34bc1842e82e630b8a6e95002502f350e6f8f8965677e0b2097b31d6ccbbe2d45827
7
+ data.tar.gz: ac5d3fd413ef37b14720bc0ef651f672ace6323fc8b94b844ede68554cc52d22f2d101602a029b7364e094f8e3ce09b81305ff0ad7ec73d98140723d9be0023b
data/README.md CHANGED
@@ -41,13 +41,15 @@ client.get_contact(id) # Get a Contact's
41
41
  client.new_contact(contact_params) # Create new Contact
42
42
  client.update_contact(id, contact_params) # Update Contact Details
43
43
  client.contact_fields(format) # Fetch Contact Meta Fields
44
- client.add_tags_to_contacts(tag_ids, contacts_criteria) # Add Tags to Selected Contacts
44
+ client.add_sequences_to_contact(id, sequence_ids) # Add Sequences (Array / String) to Contact
45
+ client.add_tags_to_contact(id, tag_ids) # Add Tags (Array / String) to Contact
46
+ client.add_tags_to_contacts(tag_ids, contacts_criteria) # Add Tags (Array / String) to Selected Contacts
45
47
  client.remove_tags_from_contacts(tag_ids, contacts_criteria) # Remove Tags from Selected Contacts
46
48
  client.get_contacts(search_criteria) # Get List of Contacts based on Search Criteria
47
49
  client.get_contacts_by_<field_name>(value) # Wildcard alias to client.get_contacts("<field_name> = 'value'")
48
50
  ```
49
51
 
50
- ### Tags (experimental)
52
+ ### Tags
51
53
 
52
54
  ```ruby
53
55
  client.get_tags(conditions) # Get Tags by condition
@@ -55,19 +57,13 @@ client.new_tag(tag_name) # Create new Tag with tag_name
55
57
  client.get_tags_by_<field_name>(value) # Wildcard alias to client.get_tags("<field_name> = 'value'")
56
58
  ```
57
59
 
58
- ### Sequences (experimental)
60
+ ### Sequences
59
61
 
60
62
  ```ruby
61
63
  client.get_sequences(conditions) # Get all sequences
62
64
  client.get_sequences_by_<field_name>(value) # Wildcard alias to client.get_sequences("<field_name> = 'value'")
63
65
  ```
64
66
 
65
- ### Contact Sequences (experimental)
66
-
67
- ```ruby
68
- client.add_sequence_to_contact(sequence_drip_id, contact_id) # Add Sequence to Contact
69
- ```
70
-
71
67
  See https://api.ontraport.com/doc/ on details of parameters.
72
68
 
73
69
 
@@ -126,7 +122,7 @@ Adding Sequence to Contact:
126
122
 
127
123
  ```ruby
128
124
  sequence = client.get_sequences_by_name('Sales Funnel')
129
- result = client.add_sequence_to_contact(sequence['drip_id'], contact['id'])
125
+ result = client.add_sequences_to_contact(contact['id'], sequence['drip_id'])
130
126
  puts 'Success' if result['error'].nil?
131
127
  ```
132
128
 
@@ -157,6 +153,10 @@ Otherwise, they're missing because I haven't got to them yet. Check the TODO lis
157
153
 
158
154
  ## Release Notes
159
155
 
156
+ #### v0.3.1
157
+ - Deprecated #add_sequence_to_contact in favour of #add_sequences_to_contact since it did not trigger sequence immediately
158
+ - Breaks v0.2.2 implementation
159
+
160
160
  #### v0.2.2
161
161
  - Added generic Object query
162
162
 
@@ -6,8 +6,10 @@ module OntraportApi
6
6
  'get_contact' => [:get, '/object'],
7
7
  'new_contact' => [:post, '/objects'],
8
8
  'update_contact' => [:put, '/objects'],
9
+ 'add_sequences_to_contact' => [:put, '/objects'],
9
10
  'get_contacts' => [:get, '/objects'],
10
11
  'contact_fields' => [:get, '/objects/meta'],
12
+ 'add_tags_to_contact' => [:put, '/objects/tag'],
11
13
  'add_tags_to_contacts' => [:put, '/objects/tag'],
12
14
  'remove_tags_from_contacts' => [:delete, '/objects/tag']
13
15
  }
@@ -24,6 +26,15 @@ module OntraportApi
24
26
  query_contacts(payload.merge(id: id))
25
27
  end
26
28
 
29
+ def add_sequences_to_contact(id, sequence_ids)
30
+ sequence_ids = sequence_ids.is_a?(Array) ? sequence_ids.join('*/*') : sequence_ids
31
+ query_contacts({ id: id, updateSequence: "*/*#{sequence_ids}*/*" })
32
+ end
33
+
34
+ def add_tags_to_contact(id, tag_ids)
35
+ add_tags_to_contacts(tag_ids, "id = #{id}")
36
+ end
37
+
27
38
  def contact_fields(format = {})
28
39
  default_format = { format: 'byId' }
29
40
  format = default_format.merge(format)
@@ -1,6 +1,5 @@
1
1
  require 'httparty'
2
2
  require_relative 'apis/contacts'
3
- require_relative 'apis/contact_sequences'
4
3
  require_relative 'apis/forms'
5
4
  require_relative 'apis/messages'
6
5
  require_relative 'apis/objects'
@@ -16,7 +15,6 @@ module OntraportApi
16
15
  base_uri 'https://api.ontraport.com/1'
17
16
 
18
17
  include APIs::Contacts
19
- include APIs::ContactSequences
20
18
  include APIs::Products
21
19
  include APIs::Forms
22
20
  include APIs::Messages
@@ -1,3 +1,3 @@
1
1
  module OntraportApi
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ontraport_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Ngu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-16 00:00:00.000000000 Z
11
+ date: 2015-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -79,7 +79,6 @@ files:
79
79
  - README.md
80
80
  - Rakefile
81
81
  - lib/ontraport_api.rb
82
- - lib/ontraport_api/apis/contact_sequences.rb
83
82
  - lib/ontraport_api/apis/contacts.rb
84
83
  - lib/ontraport_api/apis/forms.rb
85
84
  - lib/ontraport_api/apis/messages.rb
@@ -1,20 +0,0 @@
1
- module OntraportApi
2
- module APIs
3
- module ContactSequences
4
- CONTACT_SEQUENCES_OBJECT_ID = 8
5
- CONTACT_SEQUENCES_API_METHODS_AND_PATHS = {
6
- 'add_sequence_to_contact' => [:post, '/objects']
7
- }
8
-
9
- def add_sequence_to_contact(sequence_id, contact_id)
10
- query_contact_sequences({ drip_id: sequence_id, contact_id: contact_id })
11
- end
12
-
13
- def query_contact_sequences(payload)
14
- method, path = CONTACT_SEQUENCES_API_METHODS_AND_PATHS[caller[0][/`.*'/][1..-2]]
15
- query(method, path, payload.merge({ objectID: CONTACT_SEQUENCES_OBJECT_ID }))
16
- end
17
-
18
- end
19
- end
20
- end