active-campaign-simple 0.2.0 → 0.2.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
  SHA256:
3
- metadata.gz: a683730c14f52f5159cc744229637c557389f1ffb79dbde5a703864dd2dff90e
4
- data.tar.gz: b0981016a9d3423546aff9534070a2788d0c99481dbda2fbe33e771c345441d9
3
+ metadata.gz: 2e56a728f497b1f0ff61f013d442a5e6439e80fb853f8bdb448526beedbf3a47
4
+ data.tar.gz: 985056dd5a8e2b0df6a9e6922ca29991c050f20c680a2919909009ba1fd9db15
5
5
  SHA512:
6
- metadata.gz: a328b8e85c53228c4a51df55dab6aed6a59f24f9e06da45bc81fd126da20f3bfabaa417a42e6e8bc94aa460c8ea2851218530d503c5c3f93085cbe7647f205c8
7
- data.tar.gz: 5b3a82742fb362b2e0eac9524858bf6eecd81188874d129a0ea8f12a5d1a08f08c33cc67104893f42727eb536929f5d1221631fe3157dd385b958bf6a580fb2b
6
+ metadata.gz: 29658c69085579ee47af003fcf4889b6659de669cbb7164a7ed8e8a50bf451f185174c1a3fcb94584e4ca47e3770f7bf734d48242eaa4a087b3af75af511021b
7
+ data.tar.gz: dfc2da00c8c554628becd7b2e1c6a7125ccc4546acca8be5942849ca104a5be12274fb120d290af0f0f39f64b3c67134b19da99981b967d0c0e7e4ebc147a52a
data/README.md CHANGED
@@ -60,6 +60,9 @@ ActiveCampaign.put('/contacts/' + id, payload: {
60
60
  # Delete a contact
61
61
  ActiveCampaign.delete('/contacts/' + id)
62
62
 
63
+ # Search for a contact
64
+ ActiveCampaign.get('/contacts', query: { email: 'test@test.com' })
65
+
63
66
  # Event Tracking
64
67
  # See: https://developers.activecampaign.com/reference#track-event
65
68
  # NOTE - The tracking API is different from all other calls as it changes the arguments a little to simplify.
@@ -5,8 +5,8 @@ require 'active-campaign-simple/event'
5
5
  module ActiveCampaign
6
6
  module Request
7
7
  # Perform an GET request
8
- def get(path)
9
- request(:get, path)
8
+ def get(path, query: {})
9
+ request(:get, path, {}, query)
10
10
  end
11
11
 
12
12
  # Perform an HTTP POST request
@@ -37,12 +37,13 @@ module ActiveCampaign
37
37
  private
38
38
 
39
39
  # Perform request
40
- def request(method, path, payload={})
40
+ def request(method, path, payload={}, query={})
41
41
  path = "/#{path}" unless path.start_with?('/')
42
+ path += "?#{URI::encode_www_form(query)}" unless query.empty?
42
43
  header = {
43
44
  'Api-Token': api_key,
44
45
  content_type: :json,
45
- accept: :json,
46
+ accept: :json
46
47
  }
47
48
  opts = {
48
49
  method: method,
@@ -1,4 +1,4 @@
1
1
  module ActiveCampaign
2
2
  # The version of the gem
3
- VERSION = '0.2.0'.freeze unless defined?(::ActiveCampaign::VERSION)
3
+ VERSION = '0.2.1'.freeze unless defined?(::ActiveCampaign::VERSION)
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-campaign-simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Leavitt