11# Drip Ruby Bindings
22
3- TODO: Write a gem description
3+ A Ruby toolkit for the [ Drip ] ( https://www.getdrip.com/ ) API.
44
55## Installation
66
@@ -18,7 +18,55 @@ Or install it yourself as:
1818
1919## Usage
2020
21- TODO: Write usage instructions here
21+ To begin making requests, spin up a new Drip client:
22+
23+ ``` ruby
24+ client = Drip ::Client .new do |c |
25+ c.api_key = " YOUR_API_TOKEN"
26+ c.account_id = " YOUR_ACCOUNT_ID"
27+ end
28+ ```
29+
30+ You can find your API key [ here] ( https://www.getdrip.com/settings/general )
31+ and your account ID [ here] ( https://www.getdrip.com/settings/site ) .
32+
33+ Since the Drip client is a flat API client, most API actions are available
34+ as methods on the client object. The following methods are currently available:
35+
36+ | Action | Method |
37+ | :------------------------- | :--------------------------------------------------- |
38+ | Create/update a subscriber | ` #create_or_update_subscriber(email, options = {}) ` |
39+ | Fetch a subscriber | ` #subscriber(id_or_email) ` |
40+ | Subscribe to a campaign | ` #subscribe(email, campaign_id, options = {}) ` |
41+ | Unsubscribe | ` #unsubscribe(id_or_email, options = {}) ` |
42+ | Apply a tag | ` #apply_tag(email, tag) ` |
43+ | Remove a tag | ` #remove_tag(email, tag) ` |
44+ | Track an event | ` #track_event(email, action, properties = {}) ` |
45+
46+
47+ ** Note:** We do not yet have complete API coverage. If we are missing an API method
48+ that you need to use in your application, please file an issue and/or open a
49+ pull request.
50+
51+ ## Examples
52+
53+ ``` ruby
54+ client = Drip ::Client .new do |c |
55+ c.api_key = " YOUR_API_TOKEN"
56+ c.account_id = " YOUR_ACCOUNT_ID"
57+ end
58+
59+ # Fetch a subscriber
60+ resp = client.subscriber(" foo@example.com" )
61+ # => <Drip::Response ...>
62+
63+ resp.success?
64+ # => true
65+
66+ subscriber = resp.subscribers.first
67+ subscriber.email
68+ # => "foo@example.com"
69+ ```
2270
2371## Contributing
2472
0 commit comments