drip-ruby 3.3.1 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +1 -1
- data/.travis.yml +0 -1
- data/CHANGELOG.md +11 -1
- data/Gemfile +2 -0
- data/README.md +6 -0
- data/Rakefile +2 -0
- data/drip-ruby.gemspec +2 -1
- data/lib/drip.rb +2 -0
- data/lib/drip/client.rb +6 -2
- data/lib/drip/client/accounts.rb +2 -0
- data/lib/drip/client/broadcasts.rb +2 -0
- data/lib/drip/client/campaign_subscriptions.rb +2 -0
- data/lib/drip/client/campaigns.rb +2 -0
- data/lib/drip/client/configuration.rb +3 -1
- data/lib/drip/client/conversions.rb +2 -0
- data/lib/drip/client/custom_fields.rb +2 -0
- data/lib/drip/client/events.rb +2 -0
- data/lib/drip/client/forms.rb +2 -0
- data/lib/drip/client/http_client.rb +2 -0
- data/lib/drip/client/orders.rb +2 -0
- data/lib/drip/client/shopper_activity.rb +3 -1
- data/lib/drip/client/subscribers.rb +2 -0
- data/lib/drip/client/tags.rb +2 -0
- data/lib/drip/client/users.rb +17 -0
- data/lib/drip/client/webhooks.rb +2 -0
- data/lib/drip/client/workflow_triggers.rb +2 -0
- data/lib/drip/client/workflows.rb +2 -0
- data/lib/drip/collection.rb +2 -0
- data/lib/drip/collections.rb +2 -0
- data/lib/drip/collections/accounts.rb +2 -0
- data/lib/drip/collections/broadcasts.rb +2 -0
- data/lib/drip/collections/campaign_subscriptions.rb +2 -0
- data/lib/drip/collections/campaigns.rb +2 -0
- data/lib/drip/collections/errors.rb +2 -0
- data/lib/drip/collections/orders.rb +2 -0
- data/lib/drip/collections/purchases.rb +2 -0
- data/lib/drip/collections/subscribers.rb +2 -0
- data/lib/drip/collections/tags.rb +2 -0
- data/lib/drip/collections/webhooks.rb +2 -0
- data/lib/drip/collections/workflow_triggers.rb +2 -0
- data/lib/drip/collections/workflows.rb +2 -0
- data/lib/drip/errors.rb +2 -0
- data/lib/drip/request.rb +2 -0
- data/lib/drip/resource.rb +2 -0
- data/lib/drip/resources.rb +2 -0
- data/lib/drip/resources/account.rb +2 -0
- data/lib/drip/resources/broadcast.rb +2 -0
- data/lib/drip/resources/campaign.rb +2 -0
- data/lib/drip/resources/campaign_subscription.rb +2 -0
- data/lib/drip/resources/error.rb +2 -0
- data/lib/drip/resources/order.rb +2 -0
- data/lib/drip/resources/purchase.rb +2 -0
- data/lib/drip/resources/subscriber.rb +2 -0
- data/lib/drip/resources/tag.rb +2 -0
- data/lib/drip/resources/webhook.rb +2 -0
- data/lib/drip/resources/workflow.rb +2 -0
- data/lib/drip/resources/workflow_trigger.rb +2 -0
- data/lib/drip/response.rb +2 -0
- data/lib/drip/version.rb +3 -1
- data/test/drip/client/accounts_test.rb +2 -0
- data/test/drip/client/broadcasts_test.rb +2 -0
- data/test/drip/client/campaign_subscriptions_test.rb +2 -0
- data/test/drip/client/campaigns_test.rb +2 -0
- data/test/drip/client/configuration_test.rb +2 -0
- data/test/drip/client/conversions_test.rb +2 -0
- data/test/drip/client/custom_fields_test.rb +2 -0
- data/test/drip/client/events_test.rb +2 -0
- data/test/drip/client/forms_test.rb +2 -0
- data/test/drip/client/http_client_test.rb +2 -0
- data/test/drip/client/orders_test.rb +2 -0
- data/test/drip/client/shopper_activity_test.rb +14 -0
- data/test/drip/client/subscribers_test.rb +2 -0
- data/test/drip/client/tags_test.rb +2 -0
- data/test/drip/client/users_test.rb +24 -0
- data/test/drip/client/webhooks_test.rb +2 -0
- data/test/drip/client/workflow_triggers_test.rb +2 -0
- data/test/drip/client/workflows_test.rb +2 -0
- data/test/drip/client_test.rb +2 -0
- data/test/drip/collection_test.rb +2 -0
- data/test/drip/collections/account_test.rb +2 -0
- data/test/drip/collections/broadcasts_test.rb +2 -0
- data/test/drip/collections/campaign_subscriptions_test.rb +2 -0
- data/test/drip/collections/campaigns_test.rb +2 -0
- data/test/drip/collections/errors_test.rb +2 -0
- data/test/drip/collections/orders_test.rb +2 -0
- data/test/drip/collections/purchases_test.rb +2 -0
- data/test/drip/collections/tags_test.rb +2 -0
- data/test/drip/collections/webhooks_test.rb +2 -0
- data/test/drip/collections/workflow_triggers_test.rb +2 -0
- data/test/drip/collections/workflows_test.rb +2 -0
- data/test/drip/collections_test.rb +2 -0
- data/test/drip/request_test.rb +2 -0
- data/test/drip/resource_test.rb +2 -0
- data/test/drip/resources/account_test.rb +2 -0
- data/test/drip/resources/order_test.rb +2 -0
- data/test/drip/resources/subscriber_test.rb +2 -0
- data/test/drip/resources/tag_test.rb +2 -0
- data/test/drip/resources_test.rb +2 -0
- data/test/drip/response_test.rb +2 -0
- data/test/test_helper.rb +2 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1d6b905e4408493869bc0195b63096d82b56e5a3d321e07fd65922b85e436fe8
|
4
|
+
data.tar.gz: 178de71bc5d233c44700fe3a2e4749b50a105416b3660b27138f566241b2483f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe7e16838b2e41df4e7f21437b97dd9d98c11d4d050333de9a774ea681c1bebb406b76aaf1f9d341c3b050a31507723b33482b0deacd24ae7d8ad6fcf97fcf59
|
7
|
+
data.tar.gz: fa9abac2ca22886a0dc27476c8ece0cddf585197703d3a08b39b63978fc57377aa59369c9db434ba25e4ebea250f5a41a51a21364e2daf5fb34043e678e8052f
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,10 +6,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
-
[master]: https://github.com/DripEmail/drip-ruby/compare/v3.
|
9
|
+
[master]: https://github.com/DripEmail/drip-ruby/compare/v3.4.0...HEAD
|
10
10
|
|
11
11
|
- Your contribution here!
|
12
12
|
|
13
|
+
## [3.4.0] - 2020-04-21
|
14
|
+
|
15
|
+
[3.4.0]: https://github.com/DripEmail/drip-ruby/compare/v3.3.1...v3.4.0
|
16
|
+
|
17
|
+
### Added
|
18
|
+
- Support for the user endpoint in the REST API
|
19
|
+
|
20
|
+
### Changed
|
21
|
+
- `Drip::Client#create_cart_activity_event` can be used with visitor UUID
|
22
|
+
|
13
23
|
## [3.3.1] - 2019-05-28
|
14
24
|
|
15
25
|
[3.3.1]: https://github.com/DripEmail/drip-ruby/compare/v3.3.0...v3.3.1
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -150,6 +150,12 @@ as methods on the client object. The following methods are currently available:
|
|
150
150
|
| Apply a tag | `#apply_tag(email, tag)` |
|
151
151
|
| Remove a tag | `#remove_tag(email, tag)` |
|
152
152
|
|
153
|
+
|
154
|
+
#### Users
|
155
|
+
| Actions | Methods |
|
156
|
+
| :------------------------- | :--------------------------------------------------- |
|
157
|
+
| Fetch user | `#user` |
|
158
|
+
|
153
159
|
#### Webhooks
|
154
160
|
|
155
161
|
| Actions | Methods |
|
data/Rakefile
CHANGED
data/drip-ruby.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
lib = File.expand_path('../lib', __FILE__)
|
4
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
@@ -19,5 +20,5 @@ Gem::Specification.new do |spec|
|
|
19
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
21
|
spec.require_paths = ["lib"]
|
21
22
|
|
22
|
-
spec.required_ruby_version = '>= 2.
|
23
|
+
spec.required_ruby_version = '>= 2.3'
|
23
24
|
end
|
data/lib/drip.rb
CHANGED
data/lib/drip/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "drip/errors"
|
2
4
|
require "drip/request"
|
3
5
|
require "drip/response"
|
@@ -15,6 +17,7 @@ require "drip/client/orders"
|
|
15
17
|
require "drip/client/shopper_activity"
|
16
18
|
require "drip/client/subscribers"
|
17
19
|
require "drip/client/tags"
|
20
|
+
require "drip/client/users"
|
18
21
|
require "drip/client/webhooks"
|
19
22
|
require "drip/client/workflows"
|
20
23
|
require "drip/client/workflow_triggers"
|
@@ -36,6 +39,7 @@ module Drip
|
|
36
39
|
include ShopperActivity
|
37
40
|
include Subscribers
|
38
41
|
include Tags
|
42
|
+
include Users
|
39
43
|
include Webhooks
|
40
44
|
include Workflows
|
41
45
|
include WorkflowTriggers
|
@@ -52,10 +56,10 @@ module Drip
|
|
52
56
|
end
|
53
57
|
end
|
54
58
|
|
55
|
-
JSON_API_CONTENT_TYPE = "application/vnd.api+json"
|
59
|
+
JSON_API_CONTENT_TYPE = "application/vnd.api+json"
|
56
60
|
private_constant :JSON_API_CONTENT_TYPE
|
57
61
|
|
58
|
-
JSON_CONTENT_TYPE = "application/json"
|
62
|
+
JSON_CONTENT_TYPE = "application/json"
|
59
63
|
private_constant :JSON_CONTENT_TYPE
|
60
64
|
|
61
65
|
def initialize(options = {})
|
data/lib/drip/client/accounts.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Drip
|
2
4
|
class Client
|
3
5
|
class Configuration
|
4
|
-
DEFAULT_URL_PREFIX = "https://api.getdrip.com/"
|
6
|
+
DEFAULT_URL_PREFIX = "https://api.getdrip.com/"
|
5
7
|
private_constant :DEFAULT_URL_PREFIX
|
6
8
|
|
7
9
|
CONFIGURATION_FIELDS = %i[access_token api_key account_id url_prefix http_open_timeout http_timeout].freeze
|
data/lib/drip/client/events.rb
CHANGED
data/lib/drip/client/forms.rb
CHANGED
data/lib/drip/client/orders.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Drip
|
2
4
|
class Client
|
3
5
|
module ShopperActivity
|
@@ -9,7 +11,7 @@ module Drip
|
|
9
11
|
# Returns a Drip::Response.
|
10
12
|
# See https://developer.drip.com/#cart-activity
|
11
13
|
def create_cart_activity_event(data = {})
|
12
|
-
raise ArgumentError, 'email
|
14
|
+
raise ArgumentError, 'email:, person_id:, or :visitor_uuid parameter required' if !data.key?(:email) && !data.key?(:person_id) && !data.key?(:visitor_uuid)
|
13
15
|
|
14
16
|
%i[provider action cart_id cart_url].each do |key|
|
15
17
|
raise ArgumentError, "#{key}: parameter required" unless data.key?(key)
|
data/lib/drip/client/tags.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "cgi"
|
4
|
+
|
5
|
+
module Drip
|
6
|
+
class Client
|
7
|
+
module Users
|
8
|
+
# Public: Fetch the authenticated user
|
9
|
+
#
|
10
|
+
# Returns a Drip::Response.
|
11
|
+
# See https://developer.drip.com/#users
|
12
|
+
def user
|
13
|
+
make_json_api_request :get, "v2/user"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/drip/client/webhooks.rb
CHANGED
data/lib/drip/collection.rb
CHANGED
data/lib/drip/collections.rb
CHANGED
data/lib/drip/errors.rb
CHANGED
data/lib/drip/request.rb
CHANGED
data/lib/drip/resource.rb
CHANGED
data/lib/drip/resources.rb
CHANGED
data/lib/drip/resources/error.rb
CHANGED
data/lib/drip/resources/order.rb
CHANGED
data/lib/drip/resources/tag.rb
CHANGED
data/lib/drip/response.rb
CHANGED
data/lib/drip/version.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require File.dirname(__FILE__) + '/../../test_helper.rb'
|
2
4
|
|
3
5
|
class Drip::Client::ShopperActivityTest < Drip::TestCase
|
@@ -41,6 +43,18 @@ class Drip::Client::ShopperActivityTest < Drip::TestCase
|
|
41
43
|
@options.delete(:cart_id)
|
42
44
|
assert_raises(ArgumentError) { @client.create_cart_activity_event(@options) }
|
43
45
|
end
|
46
|
+
|
47
|
+
should "return error when missing person identifier" do
|
48
|
+
@options.delete(:email)
|
49
|
+
assert_raises(ArgumentError) { @client.create_cart_activity_event(@options) }
|
50
|
+
|
51
|
+
@options[:person_id] = "acd123"
|
52
|
+
@client.create_cart_activity_event(@options)
|
53
|
+
|
54
|
+
@options.delete(:person_id)
|
55
|
+
@options[:visitor_uuid] = "v1234"
|
56
|
+
@client.create_cart_activity_event(@options)
|
57
|
+
end
|
44
58
|
end
|
45
59
|
|
46
60
|
context "#create_order_activity_event" do
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../../test_helper.rb'
|
4
|
+
|
5
|
+
class Drip::Client::UsersTest < Drip::TestCase
|
6
|
+
def setup
|
7
|
+
@client = Drip::Client.new { |c| c.account_id = "12345" }
|
8
|
+
end
|
9
|
+
|
10
|
+
context "#user" do
|
11
|
+
setup do
|
12
|
+
@response_status = 200
|
13
|
+
@response_body = "{}"
|
14
|
+
|
15
|
+
stub_request(:get, "https://api.getdrip.com/v2/user").
|
16
|
+
to_return(status: @response_status, body: @response_body, headers: {})
|
17
|
+
end
|
18
|
+
|
19
|
+
should "send the right request" do
|
20
|
+
expected = Drip::Response.new(@response_status, JSON.parse(@response_body))
|
21
|
+
assert_equal expected, @client.user
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/test/drip/client_test.rb
CHANGED
data/test/drip/request_test.rb
CHANGED
data/test/drip/resource_test.rb
CHANGED
data/test/drip/resources_test.rb
CHANGED
data/test/drip/response_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drip-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Drip
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple wrapper for the Drip API
|
14
14
|
email:
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- lib/drip/client/shopper_activity.rb
|
44
44
|
- lib/drip/client/subscribers.rb
|
45
45
|
- lib/drip/client/tags.rb
|
46
|
+
- lib/drip/client/users.rb
|
46
47
|
- lib/drip/client/webhooks.rb
|
47
48
|
- lib/drip/client/workflow_triggers.rb
|
48
49
|
- lib/drip/client/workflows.rb
|
@@ -92,6 +93,7 @@ files:
|
|
92
93
|
- test/drip/client/shopper_activity_test.rb
|
93
94
|
- test/drip/client/subscribers_test.rb
|
94
95
|
- test/drip/client/tags_test.rb
|
96
|
+
- test/drip/client/users_test.rb
|
95
97
|
- test/drip/client/webhooks_test.rb
|
96
98
|
- test/drip/client/workflow_triggers_test.rb
|
97
99
|
- test/drip/client/workflows_test.rb
|
@@ -132,15 +134,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
134
|
requirements:
|
133
135
|
- - ">="
|
134
136
|
- !ruby/object:Gem::Version
|
135
|
-
version: '2.
|
137
|
+
version: '2.3'
|
136
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
139
|
requirements:
|
138
140
|
- - ">="
|
139
141
|
- !ruby/object:Gem::Version
|
140
142
|
version: '0'
|
141
143
|
requirements: []
|
142
|
-
|
143
|
-
rubygems_version: 2.5.2
|
144
|
+
rubygems_version: 3.1.2
|
144
145
|
signing_key:
|
145
146
|
specification_version: 4
|
146
147
|
summary: A Ruby gem for interacting with the Drip API
|
@@ -159,6 +160,7 @@ test_files:
|
|
159
160
|
- test/drip/client/shopper_activity_test.rb
|
160
161
|
- test/drip/client/subscribers_test.rb
|
161
162
|
- test/drip/client/tags_test.rb
|
163
|
+
- test/drip/client/users_test.rb
|
162
164
|
- test/drip/client/webhooks_test.rb
|
163
165
|
- test/drip/client/workflow_triggers_test.rb
|
164
166
|
- test/drip/client/workflows_test.rb
|