1- # Drip Ruby Bindings
1+ # Drip Ruby Client
22
33A Ruby toolkit for the [ Drip] ( https://www.getdrip.com/ ) API.
44
55## Installation
66
77Add this line to your application's Gemfile:
88
9- gem 'drip-ruby', : require => 'drip'
9+ gem 'drip-ruby', require: 'drip'
1010
1111And then execute:
1212
@@ -16,9 +16,7 @@ Or install it yourself as:
1616
1717 $ gem install drip-ruby
1818
19- ## Usage
20-
21- Your account ID can be found [ here] ( https://www.getdrip.com/settings/site ) .
19+ ## Authentication
2220
2321For private integrations, you may use your personal API key (found
2422[ here] ( https://www.getdrip.com/user/edit ) ) via the ` api_key ` setting:
@@ -40,11 +38,27 @@ client = Drip::Client.new do |c|
4038end
4139```
4240
41+ You may also pass client options in an argument hash:
42+
43+ ``` ruby
44+ client = Drip ::Client .new (
45+ access_token: " YOUR_ACCESS_TOKEN"
46+ account_id: " YOUR_ACCOUNT_ID"
47+ )
48+ ```
49+
50+ Your account ID can be found [ here] ( https://www.getdrip.com/settings/site ) .
51+ Most API actions require an account ID, with the exception of methods like
52+ the "list accounts" endpoint.
53+
54+ ## Usage
55+
4356Since the Drip client is a flat API client, most API actions are available
4457as methods on the client object. The following methods are currently available:
4558
4659| Action | Method |
4760| :------------------------- | :--------------------------------------------------- |
61+ | List accounts | ` #accounts ` |
4862| Create/update a subscriber | ` #create_or_update_subscriber(email, options = {}) ` |
4963| Create/update a batch of subscribers | ` #create_or_update_subscribers(subscribers) ` |
5064| Fetch a subscriber | ` #subscriber(id_or_email) ` |
@@ -61,15 +75,17 @@ that you need to use in your application, please file an issue and/or open a
6175pull request. [ See the official REST API docs] ( https://www.getdrip.com/docs/rest-api )
6276for a complete API reference.
6377
64- ## Examples
78+ ## Use Cases
6579
66- ``` ruby
67- client = Drip ::Client .new do |c |
68- c.api_key = " YOUR_API_TOKEN"
69- c.account_id = " YOUR_ACCOUNT_ID"
70- end
80+ Here are some common use cases for the API client.
81+
82+ ### Fetching subscriber data
7183
72- # Fetch a subscriber
84+ Subscribers can be looked up by their email address or by their Drip subscriber
85+ ID. Most of the time you will want to look up subscribers by their email address,
86+ unless you've already stored this ID in your database.
87+
88+ ``` ruby
7389resp = client.subscriber(" foo@example.com" )
7490# => <Drip::Response ...>
7591
0 commit comments