Skip to content

Commit 1673021

Browse files
authored
Merge pull request #34 from DripEmail/rebrand-updates
Complete API coverage
2 parents 18b3380 + bee6035 commit 1673021

53 files changed

Lines changed: 1525 additions & 62 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.rubocop.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
inherit_from: .rubocop_todo.yml
2+
3+
AllCops:
4+
Exclude:
5+
- 'test/fixtures/**/*'
6+
7+
Layout/AlignParameters:
8+
EnforcedStyle: with_fixed_indentation
9+
10+
Layout/ClosingParenthesisIndentation:
11+
Enabled: false
12+
13+
Layout/DotPosition:
14+
EnforcedStyle: trailing
15+
16+
Style/BracesAroundHashParameters:
17+
Enabled: false

.rubocop_todo.yml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2017-12-22 12:38:29 -0600 using RuboCop version 0.49.1.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 2
10+
# Cop supports --auto-correct.
11+
# Configuration parameters: SupportedStyles, IndentationWidth.
12+
# SupportedStyles: outdent, indent
13+
Layout/AccessModifierIndentation:
14+
EnforcedStyle: outdent
15+
16+
# Offense count: 1
17+
# Cop supports --auto-correct.
18+
Layout/ElseAlignment:
19+
Exclude:
20+
- 'lib/drip/response.rb'
21+
22+
# Offense count: 1
23+
# Cop supports --auto-correct.
24+
Layout/EmptyLineAfterMagicComment:
25+
Exclude:
26+
- 'drip-ruby.gemspec'
27+
28+
# Offense count: 2
29+
# Cop supports --auto-correct.
30+
# Configuration parameters: SupportedStyles, IndentationWidth.
31+
# SupportedStyles: special_inside_parentheses, consistent, align_braces
32+
Layout/IndentHash:
33+
EnforcedStyle: consistent
34+
35+
# Offense count: 1
36+
# Cop supports --auto-correct.
37+
# Configuration parameters: Width, IgnoredPatterns.
38+
Layout/IndentationWidth:
39+
Exclude:
40+
- 'lib/drip/response.rb'
41+
42+
# Offense count: 1
43+
# Cop supports --auto-correct.
44+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
45+
# SupportedStyles: aligned, indented, indented_relative_to_receiver
46+
Layout/MultilineMethodCallIndentation:
47+
Exclude:
48+
- 'lib/drip/collection.rb'
49+
50+
# Offense count: 1
51+
# Cop supports --auto-correct.
52+
# Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith, AutoCorrect.
53+
# SupportedStylesAlignWith: keyword, variable, start_of_line
54+
Lint/EndAlignment:
55+
Exclude:
56+
- 'lib/drip/response.rb'
57+
58+
# Offense count: 1
59+
Lint/ScriptPermission:
60+
Exclude:
61+
- 'Rakefile'
62+
63+
# Offense count: 1
64+
# Cop supports --auto-correct.
65+
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
66+
Lint/UnusedBlockArgument:
67+
Exclude:
68+
- 'lib/drip/response.rb'
69+
70+
# Offense count: 2
71+
# Cop supports --auto-correct.
72+
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
73+
Lint/UnusedMethodArgument:
74+
Exclude:
75+
- 'lib/drip/client.rb'
76+
- 'lib/drip/collection.rb'
77+
78+
# Offense count: 7
79+
# Configuration parameters: CountComments, ExcludedMethods.
80+
Metrics/BlockLength:
81+
Max: 48
82+
83+
# Offense count: 2
84+
# Configuration parameters: CountComments.
85+
Metrics/ClassLength:
86+
Max: 189
87+
88+
# Offense count: 78
89+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
90+
# URISchemes: http, https
91+
Metrics/LineLength:
92+
Max: 108
93+
94+
# Offense count: 4
95+
# Configuration parameters: CountComments.
96+
Metrics/MethodLength:
97+
Max: 16
98+
99+
# Offense count: 22
100+
# Configuration parameters: EnforcedStyle, SupportedStyles.
101+
# SupportedStyles: nested, compact
102+
Style/ClassAndModuleChildren:
103+
Enabled: false
104+
105+
# Offense count: 42
106+
Style/Documentation:
107+
Enabled: false
108+
109+
# Offense count: 2
110+
Style/MethodMissing:
111+
Exclude:
112+
- 'lib/drip/resource.rb'
113+
- 'lib/drip/response.rb'
114+
115+
# Offense count: 9
116+
# Cop supports --auto-correct.
117+
# Configuration parameters: Strict.
118+
Style/NumericLiterals:
119+
MinDigits: 8
120+
121+
# Offense count: 494
122+
# Cop supports --auto-correct.
123+
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
124+
# SupportedStyles: single_quotes, double_quotes
125+
Style/StringLiterals:
126+
Enabled: false
127+
128+
# Offense count: 1
129+
# Cop supports --auto-correct.
130+
# Configuration parameters: EnforcedStyle, SupportedStyles.
131+
# SupportedStyles: single_quotes, double_quotes
132+
Style/StringLiteralsInInterpolation:
133+
Exclude:
134+
- 'test/drip/client_test.rb'

README.md

Lines changed: 106 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,30 +61,124 @@ the "list accounts" endpoint.
6161
Since the Drip client is a flat API client, most API actions are available
6262
as methods on the client object. The following methods are currently available:
6363

64-
| Action | Method |
64+
#### Accounts
65+
66+
| Actions | Methods |
6567
| :------------------------- | :--------------------------------------------------- |
6668
| List accounts | `#accounts` |
69+
| Fetch an account | `#account(id)` |
70+
71+
#### Broadcasts
72+
73+
| Actions | Methods |
74+
| :------------------------- | :--------------------------------------------------- |
75+
| List broadcasts | `#broadcasts` |
76+
| Fetch a broadcast | `#broadcast(id)` |
77+
78+
#### Campaigns
79+
80+
| Actions | Methods |
81+
| :------------------------- | :--------------------------------------------------- |
82+
| List campaigns | `#campaigns(options = {})` |
83+
| Fetch a campaign | `#campaign(id)` |
84+
| Activate a campaign | `#activate_campaign(id)` |
85+
| Pause a campaign | `#pause_campaign(id)` |
86+
| List campaign subscribers | `#campaign_subscribers(id)` |
87+
| Subscribe to a campaign | See the `#subscribe` method on "Subscribers" below |
88+
89+
#### Campaign Subscriptions
90+
91+
| Actions | Methods |
92+
| :------------------------- | :--------------------------------------------------- |
93+
| List subscriber subscriptions | `#campaign_subscriptions(subscriber_id)` |
94+
95+
#### Conversions
96+
97+
| Actions | Methods |
98+
| :------------------------- | :--------------------------------------------------- |
99+
| List all conversions | `#conversions(options = {})` |
100+
| Fetch a conversion | `#conversion(id)` |
101+
102+
#### Custom Fields
103+
104+
| Actions | Methods |
105+
| :------------------------- | :--------------------------------------------------- |
106+
| List all custom fields | `#custom_fields` |
107+
108+
#### Events
109+
110+
| Actions | Methods |
111+
| :------------------------- | :--------------------------------------------------- |
112+
| Track an event | `#track_event(email, action, properties = {})` |
113+
| Track a batch of events | `#track_events(events)` |
114+
| List all custom event actions | `#event_actions` |
115+
116+
#### Forms
117+
118+
| Actions | Methods |
119+
| :------------------------- | :--------------------------------------------------- |
120+
| List all forms | `#forms` |
121+
| Fetch a form | `#form(id)` |
122+
123+
#### Purchases
124+
125+
| Actions | Methods |
126+
| :------------------------- | :--------------------------------------------------- |
127+
| List purchases for a subscriber | `#purchases(email)` |
128+
| Create a purchase         | `#create_purchase(email, amount, options = {})` |
129+
| Fetch a purchase | `#purchase(email, id)` |
130+
131+
#### Subscribers
132+
133+
| Actions | Methods |
134+
| :------------------------- | :--------------------------------------------------- |
67135
| List subscribers | `#subscribers(options = {})` |
68136
| Create/update a subscriber | `#create_or_update_subscriber(email, options = {})` |
69137
| Create/update a batch of subscribers | `#create_or_update_subscribers(subscribers)` |
138+
| Unsubscribe a batch of subscribers | `#unsubscribe_subscribers(subscribers)` |
70139
| Fetch a subscriber | `#subscriber(id_or_email)` |
140+
| Delete | `#delete_subscriber(id_or_email)` |
71141
| Subscribe to a campaign | `#subscribe(email, campaign_id, options = {})` |
142+
| Unsubscribe from all mailings | `#unsubscribe_from_all(id_or_email)` |
72143
| Unsubscribe | `#unsubscribe(id_or_email, options = {})` |
73-
| Delete | `#delete_subscriber(id_or_email)` |
144+
145+
#### Tags
146+
147+
| Actions | Methods |
148+
| :------------------------- | :--------------------------------------------------- |
74149
| List tags | `#tags` |
75150
| Apply a tag | `#apply_tag(email, tag)` |
76151
| Remove a tag | `#remove_tag(email, tag)` |
77-
| Track an event | `#track_event(email, action, properties = {})` |
78-
| Track a batch of events | `#track_events(events)` |
79-
| List campaigns | `#campaigns` |
80-
| Create a purchase         | `#create_purchase(email, amount, options = {})` |
81-
| List purchases for a subscriber | `#purchases(email)` |
82-
| Fetch a purchase | `#purchase(email, id)` |
83152

84-
**Note:** We do not have complete API coverage yet. If we are missing an API method
85-
that you need to use in your application, please file an issue and/or open a
86-
pull request. [See the official REST API docs](https://www.getdrip.com/docs/rest-api)
87-
for a complete API reference.
153+
#### Webhooks
154+
155+
| Actions | Methods |
156+
| :------------------------- | :--------------------------------------------------- |
157+
| List webhooks | `#webhooks` |
158+
| Fetch a webhook | `#webhook(id)` |
159+
| Create a new webhook | `#create_webhook(post_url, include_received_email, events)` |
160+
| Delete a webhook | `#delete_webhook(id)` |
161+
162+
#### Workflows
163+
164+
| Actions | Methods |
165+
| :------------------------- | :--------------------------------------------------- |
166+
| List workflows | `#workflows` |
167+
| Fetch a workflow | `#workflow(id)` |
168+
| Activate a workflow | `#activate_workflow(id)` |
169+
| Pause a workflow | `#pause_workflow(id)` |
170+
| Start a subscriber on a workflow | `#start_subscriber_workflow(id, options = {})` |
171+
| Remove a subscriber from a workflow | `#remove_subscriber_workflow(workflow_id, id_or_email)` |
172+
173+
#### Workflow Triggers
174+
175+
| Actions | Methods |
176+
| :------------------------- | :--------------------------------------------------- |
177+
| List workflow triggers | `#workflow_triggers(id)` |
178+
| Create a workflow trigger | `#create_workflow_trigger(id, options = {})` |
179+
| Update a workflow trigger | `#update_workflow_trigger(id, options = {}` |
180+
181+
[See the official REST API docs](https://www.getdrip.com/docs/rest-api) for a complete API reference and explanations.
88182

89183
## Use Cases
90184

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ Rake::TestTask.new do |t|
99
end
1010

1111
desc "Run tests"
12-
task :default => :test
12+
task default: :test

drip-ruby.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
88
spec.version = Drip::VERSION
99
spec.authors = ["Derrick Reimer"]
1010
spec.email = ["derrickreimer@gmail.com"]
11-
spec.summary = %q{A Ruby gem for interacting with the Drip API}
12-
spec.description = %q{A simple wrapper for the Drip API}
11+
spec.summary = 'A Ruby gem for interacting with the Drip API'
12+
spec.description = 'A simple wrapper for the Drip API'
1313
spec.homepage = "http://github.com/DripEmail/drip-ruby"
1414
spec.license = "MIT"
1515

lib/drip/client.rb

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,38 @@
11
require "drip/response"
22
require "drip/client/accounts"
3-
require "drip/client/subscribers"
4-
require "drip/client/tags"
5-
require "drip/client/events"
3+
require "drip/client/broadcasts"
64
require "drip/client/campaigns"
5+
require "drip/client/campaign_subscriptions"
6+
require "drip/client/conversions"
7+
require "drip/client/custom_fields"
8+
require "drip/client/events"
9+
require "drip/client/forms"
710
require "drip/client/purchases"
11+
require "drip/client/subscribers"
12+
require "drip/client/tags"
13+
require "drip/client/webhooks"
14+
require "drip/client/workflows"
15+
require "drip/client/workflow_triggers"
816
require "faraday"
917
require "faraday_middleware"
1018
require "json"
1119

1220
module Drip
1321
class Client
1422
include Accounts
15-
include Subscribers
16-
include Tags
17-
include Events
23+
include Broadcasts
1824
include Campaigns
25+
include CampaignSubscriptions
26+
include Conversions
27+
include CustomFields
28+
include Events
29+
include Forms
1930
include Purchases
31+
include Subscribers
32+
include Tags
33+
include Webhooks
34+
include Workflows
35+
include WorkflowTriggers
2036

2137
attr_accessor :access_token, :api_key, :account_id
2238

@@ -83,7 +99,7 @@ def connection
8399
f.basic_auth api_key, ""
84100
end
85101

86-
f.response :json, :content_type => /\bjson$/
102+
f.response :json, content_type: /\bjson$/
87103
f.adapter :net_http
88104
end
89105
end

lib/drip/client/accounts.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ module Accounts
88
def accounts
99
get "accounts"
1010
end
11+
12+
# Public: Fetch an account.
13+
#
14+
# id - Required. The String id of the account.
15+
#
16+
# Returns a Drip::Response.
17+
# See https://www.getdrip.com/docs/rest-api#accounts
18+
def account(id)
19+
get "accounts/#{id}"
20+
end
1121
end
1222
end
1323
end

0 commit comments

Comments
 (0)