mailchimp_api_v3 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/lib/mailchimp_api_v3/client/remote.rb +12 -8
- data/lib/mailchimp_api_v3/collection.rb +1 -1
- data/lib/mailchimp_api_v3/collection/paging.rb +1 -1
- data/lib/mailchimp_api_v3/instance.rb +5 -1
- data/lib/mailchimp_api_v3/version.rb +1 -1
- data/spec/fixtures/cassettes/account.yml +92 -0
- data/spec/fixtures/cassettes/client.yml +223 -0
- data/spec/fixtures/cassettes/exception.yml +179 -0
- data/spec/fixtures/cassettes/interest.yml +384 -0
- data/spec/fixtures/cassettes/interest_categories.yml +637 -0
- data/spec/fixtures/cassettes/interest_category.yml +389 -0
- data/spec/fixtures/cassettes/interests.yml +723 -0
- data/spec/fixtures/cassettes/list.yml +176 -0
- data/spec/fixtures/cassettes/lists.yml +47 -0
- data/spec/fixtures/cassettes/mailchimp.yml +6 -886
- data/spec/fixtures/cassettes/member.yml +267 -0
- data/spec/fixtures/cassettes/members.yml +17 -6
- data/spec/mailchimp_api_v3/account_spec.rb +1 -1
- data/spec/mailchimp_api_v3/client_spec.rb +1 -1
- data/spec/mailchimp_api_v3/exception_spec.rb +1 -1
- data/spec/mailchimp_api_v3/interest_categories_spec.rb +21 -33
- data/spec/mailchimp_api_v3/interest_category_spec.rb +7 -7
- data/spec/mailchimp_api_v3/interest_spec.rb +9 -6
- data/spec/mailchimp_api_v3/interests_spec.rb +24 -28
- data/spec/mailchimp_api_v3/list_spec.rb +1 -1
- data/spec/mailchimp_api_v3/lists_spec.rb +1 -1
- data/spec/mailchimp_api_v3/member_spec.rb +4 -3
- data/spec/mailchimp_api_v3/members_spec.rb +1 -1
- data/spec/support/vcr_setup.rb +1 -1
- metadata +23 -4
@@ -0,0 +1,267 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists?count=500&exclude_fields=lists._links,_links&offset=0
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Authorization:
|
15
|
+
- apikey <%= ENV['MAILCHIMP_API_KEY'] %>
|
16
|
+
User-Agent:
|
17
|
+
- Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- nginx
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Content-Length:
|
28
|
+
- '1174'
|
29
|
+
X-Request-Id:
|
30
|
+
- 770c521d-61bc-4604-9d8e-30e489749996
|
31
|
+
Link:
|
32
|
+
- <https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Collection.json>; rel="describedBy"
|
33
|
+
Vary:
|
34
|
+
- Accept-Encoding
|
35
|
+
Date:
|
36
|
+
- Tue, 07 Jul 2015 12:05:36 GMT
|
37
|
+
Connection:
|
38
|
+
- keep-alive
|
39
|
+
body:
|
40
|
+
encoding: ASCII-8BIT
|
41
|
+
string: '{"lists":[{"id":"e73f5910ca","name":"My first list","contact":{"company":"InSite
|
42
|
+
Arts","address1":"300 Burdett Road","address2":"London","city":"London","state":"","zip":"E14
|
43
|
+
7DQ","country":"262","phone":"07917153555"},"permission_reminder":"Opt-in
|
44
|
+
only","use_archive_bar":true,"campaign_defaults":{"from_name":"Sam Sayers","from_email":"sam@sayers.cc","subject":"","language":"en"},"notify_on_subscribe":"","notify_on_unsubscribe":"","date_created":"2015-06-27T14:49:18+00:00","list_rating":0,"email_type_option":false,"subscribe_url_short":"http://eepurl.com/brGTO9","subscribe_url_long":"http://insitearts.us11.list-manage1.com/subscribe?u=1dbca289fd41b54838bcbb501&id=e73f5910ca","beamer_address":"us11-6692a2b3c3-bcd2a8b144@inbound.mailchimp.com","visibility":"pub","modules":[],"stats":{"member_count":2,"unsubscribe_count":0,"cleaned_count":0,"member_count_since_send":2,"unsubscribe_count_since_send":0,"cleaned_count_since_send":0,"campaign_count":0,"campaign_last_sent":"","merge_field_count":2,"avg_sub_rate":0,"avg_unsub_rate":0,"target_sub_rate":0,"open_rate":0,"click_rate":0,"last_sub_date":"2015-06-27T14:50:39+00:00","last_unsub_date":""}}],"total_items":1}'
|
45
|
+
http_version:
|
46
|
+
recorded_at: Tue, 07 Jul 2015 12:05:36 GMT
|
47
|
+
- request:
|
48
|
+
method: get
|
49
|
+
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members?count=500&exclude_fields=members._links,_links&offset=0
|
50
|
+
body:
|
51
|
+
encoding: US-ASCII
|
52
|
+
string: ''
|
53
|
+
headers:
|
54
|
+
Accept:
|
55
|
+
- "*/*; q=0.5, application/xml"
|
56
|
+
Accept-Encoding:
|
57
|
+
- gzip, deflate
|
58
|
+
Authorization:
|
59
|
+
- apikey <%= ENV['MAILCHIMP_API_KEY'] %>
|
60
|
+
User-Agent:
|
61
|
+
- Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
|
62
|
+
response:
|
63
|
+
status:
|
64
|
+
code: 200
|
65
|
+
message: OK
|
66
|
+
headers:
|
67
|
+
Server:
|
68
|
+
- nginx
|
69
|
+
Content-Type:
|
70
|
+
- application/json; charset=utf-8
|
71
|
+
Content-Length:
|
72
|
+
- '1248'
|
73
|
+
X-Request-Id:
|
74
|
+
- 03ee90f8-7198-40ac-b010-c942840ad34f
|
75
|
+
Link:
|
76
|
+
- <https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Collection.json>;
|
77
|
+
rel="describedBy"
|
78
|
+
Vary:
|
79
|
+
- Accept-Encoding
|
80
|
+
Date:
|
81
|
+
- Tue, 07 Jul 2015 12:05:36 GMT
|
82
|
+
Connection:
|
83
|
+
- keep-alive
|
84
|
+
body:
|
85
|
+
encoding: ASCII-8BIT
|
86
|
+
string: '{"members":[{"id":"140b91c107d2058dee730e75be0b1151","email_address":"ann@sayers.cc","unique_email_id":"37a55cdc48","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"Ann","LNAME":"Example"},"interests":{"ca7ab24b53":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"86.163.13.133","timestamp_opt":"2015-06-27
|
87
|
+
14:50:15","member_rating":2,"last_changed":"2015-07-07T11:29:25+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"e73f5910ca"},{"id":"a81216d35b4cbfa18632867228be02da","email_address":"bob@sayers.cc","unique_email_id":"3f73c23e26","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"Bob","LNAME":"Example"},"interests":{"ca7ab24b53":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"86.163.13.133","timestamp_opt":"2015-06-27
|
88
|
+
14:50:39","member_rating":2,"last_changed":"2015-06-27T14:50:39+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"e73f5910ca"}],"list_id":"e73f5910ca","total_items":2}'
|
89
|
+
http_version:
|
90
|
+
recorded_at: Tue, 07 Jul 2015 12:05:36 GMT
|
91
|
+
- request:
|
92
|
+
method: get
|
93
|
+
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members?count=500&exclude_fields=members._links,_links&offset=0
|
94
|
+
body:
|
95
|
+
encoding: US-ASCII
|
96
|
+
string: ''
|
97
|
+
headers:
|
98
|
+
Accept:
|
99
|
+
- "*/*; q=0.5, application/xml"
|
100
|
+
Accept-Encoding:
|
101
|
+
- gzip, deflate
|
102
|
+
Authorization:
|
103
|
+
- apikey <%= ENV['MAILCHIMP_API_KEY'] %>
|
104
|
+
User-Agent:
|
105
|
+
- Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
|
106
|
+
response:
|
107
|
+
status:
|
108
|
+
code: 200
|
109
|
+
message: OK
|
110
|
+
headers:
|
111
|
+
Server:
|
112
|
+
- nginx
|
113
|
+
Content-Type:
|
114
|
+
- application/json; charset=utf-8
|
115
|
+
Content-Length:
|
116
|
+
- '1248'
|
117
|
+
X-Request-Id:
|
118
|
+
- 7cac87e8-5ad6-4eb3-8d84-e17471a426f7
|
119
|
+
Link:
|
120
|
+
- <https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Collection.json>;
|
121
|
+
rel="describedBy"
|
122
|
+
Vary:
|
123
|
+
- Accept-Encoding
|
124
|
+
Date:
|
125
|
+
- Tue, 07 Jul 2015 12:05:37 GMT
|
126
|
+
Connection:
|
127
|
+
- keep-alive
|
128
|
+
body:
|
129
|
+
encoding: ASCII-8BIT
|
130
|
+
string: '{"members":[{"id":"140b91c107d2058dee730e75be0b1151","email_address":"ann@sayers.cc","unique_email_id":"37a55cdc48","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"Ann","LNAME":"Example"},"interests":{"ca7ab24b53":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"86.163.13.133","timestamp_opt":"2015-06-27
|
131
|
+
14:50:15","member_rating":2,"last_changed":"2015-07-07T11:29:25+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"e73f5910ca"},{"id":"a81216d35b4cbfa18632867228be02da","email_address":"bob@sayers.cc","unique_email_id":"3f73c23e26","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"Bob","LNAME":"Example"},"interests":{"ca7ab24b53":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"86.163.13.133","timestamp_opt":"2015-06-27
|
132
|
+
14:50:39","member_rating":2,"last_changed":"2015-06-27T14:50:39+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"e73f5910ca"}],"list_id":"e73f5910ca","total_items":2}'
|
133
|
+
http_version:
|
134
|
+
recorded_at: Tue, 07 Jul 2015 12:05:37 GMT
|
135
|
+
- request:
|
136
|
+
method: patch
|
137
|
+
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151
|
138
|
+
body:
|
139
|
+
encoding: UTF-8
|
140
|
+
string: '{"merge_fields":{"FNAME":"Billy","LNAME":"Bonkers"}}'
|
141
|
+
headers:
|
142
|
+
Accept:
|
143
|
+
- "*/*; q=0.5, application/xml"
|
144
|
+
Accept-Encoding:
|
145
|
+
- gzip, deflate
|
146
|
+
Authorization:
|
147
|
+
- apikey <%= ENV['MAILCHIMP_API_KEY'] %>
|
148
|
+
User-Agent:
|
149
|
+
- Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
|
150
|
+
Content-Length:
|
151
|
+
- '52'
|
152
|
+
response:
|
153
|
+
status:
|
154
|
+
code: 200
|
155
|
+
message: OK
|
156
|
+
headers:
|
157
|
+
Server:
|
158
|
+
- nginx
|
159
|
+
Content-Type:
|
160
|
+
- application/json; charset=utf-8
|
161
|
+
Content-Length:
|
162
|
+
- '2084'
|
163
|
+
X-Request-Id:
|
164
|
+
- 7f8db0bb-bb85-46d3-a4a1-166769f11ec2
|
165
|
+
Link:
|
166
|
+
- <https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json>; rel="describedBy"
|
167
|
+
Vary:
|
168
|
+
- Accept-Encoding
|
169
|
+
Date:
|
170
|
+
- Tue, 07 Jul 2015 12:05:57 GMT
|
171
|
+
Connection:
|
172
|
+
- keep-alive
|
173
|
+
body:
|
174
|
+
encoding: ASCII-8BIT
|
175
|
+
string: '{"id":"140b91c107d2058dee730e75be0b1151","email_address":"ann@sayers.cc","unique_email_id":"37a55cdc48","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"Billy","LNAME":"Bonkers"},"interests":{"ca7ab24b53":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"86.163.13.133","timestamp_opt":"2015-06-27
|
176
|
+
14:50:15","member_rating":2,"last_changed":"2015-07-07T12:05:57+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"e73f5910ca","_links":[{"rel":"self","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json"},{"rel":"parent","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Collection.json"},{"rel":"update","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"PATCH","schema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json"},{"rel":"delete","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"DELETE"},{"rel":"activity","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/activity","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Activity/Collection.json"},{"rel":"goals","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/goals","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Goals/Collection.json"},{"rel":"notes","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/notes","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Notes/Collection.json"}]}'
|
177
|
+
http_version:
|
178
|
+
recorded_at: Tue, 07 Jul 2015 12:05:57 GMT
|
179
|
+
- request:
|
180
|
+
method: patch
|
181
|
+
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151
|
182
|
+
body:
|
183
|
+
encoding: UTF-8
|
184
|
+
string: '{"merge_fields":{"FNAME":"William"}}'
|
185
|
+
headers:
|
186
|
+
Accept:
|
187
|
+
- "*/*; q=0.5, application/xml"
|
188
|
+
Accept-Encoding:
|
189
|
+
- gzip, deflate
|
190
|
+
Authorization:
|
191
|
+
- apikey <%= ENV['MAILCHIMP_API_KEY'] %>
|
192
|
+
User-Agent:
|
193
|
+
- Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
|
194
|
+
Content-Length:
|
195
|
+
- '36'
|
196
|
+
response:
|
197
|
+
status:
|
198
|
+
code: 200
|
199
|
+
message: OK
|
200
|
+
headers:
|
201
|
+
Server:
|
202
|
+
- nginx
|
203
|
+
Content-Type:
|
204
|
+
- application/json; charset=utf-8
|
205
|
+
Content-Length:
|
206
|
+
- '2086'
|
207
|
+
X-Request-Id:
|
208
|
+
- 7066d0b5-e8fa-4599-a8ee-9de8e02d98a0
|
209
|
+
Link:
|
210
|
+
- <https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json>; rel="describedBy"
|
211
|
+
Vary:
|
212
|
+
- Accept-Encoding
|
213
|
+
Date:
|
214
|
+
- Tue, 07 Jul 2015 12:05:57 GMT
|
215
|
+
Connection:
|
216
|
+
- keep-alive
|
217
|
+
body:
|
218
|
+
encoding: ASCII-8BIT
|
219
|
+
string: '{"id":"140b91c107d2058dee730e75be0b1151","email_address":"ann@sayers.cc","unique_email_id":"37a55cdc48","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"William","LNAME":"Bonkers"},"interests":{"ca7ab24b53":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"86.163.13.133","timestamp_opt":"2015-06-27
|
220
|
+
14:50:15","member_rating":2,"last_changed":"2015-07-07T12:05:57+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"e73f5910ca","_links":[{"rel":"self","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json"},{"rel":"parent","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Collection.json"},{"rel":"update","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"PATCH","schema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json"},{"rel":"delete","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"DELETE"},{"rel":"activity","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/activity","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Activity/Collection.json"},{"rel":"goals","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/goals","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Goals/Collection.json"},{"rel":"notes","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/notes","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Notes/Collection.json"}]}'
|
221
|
+
http_version:
|
222
|
+
recorded_at: Tue, 07 Jul 2015 12:05:57 GMT
|
223
|
+
- request:
|
224
|
+
method: patch
|
225
|
+
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151
|
226
|
+
body:
|
227
|
+
encoding: UTF-8
|
228
|
+
string: '{"merge_fields":{"FNAME":"Ann","LNAME":"Example"}}'
|
229
|
+
headers:
|
230
|
+
Accept:
|
231
|
+
- "*/*; q=0.5, application/xml"
|
232
|
+
Accept-Encoding:
|
233
|
+
- gzip, deflate
|
234
|
+
Authorization:
|
235
|
+
- apikey <%= ENV['MAILCHIMP_API_KEY'] %>
|
236
|
+
User-Agent:
|
237
|
+
- Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
|
238
|
+
Content-Length:
|
239
|
+
- '50'
|
240
|
+
response:
|
241
|
+
status:
|
242
|
+
code: 200
|
243
|
+
message: OK
|
244
|
+
headers:
|
245
|
+
Server:
|
246
|
+
- nginx
|
247
|
+
Content-Type:
|
248
|
+
- application/json; charset=utf-8
|
249
|
+
Content-Length:
|
250
|
+
- '2082'
|
251
|
+
X-Request-Id:
|
252
|
+
- 784daa28-78f2-4d78-aacb-c996c3e08425
|
253
|
+
Link:
|
254
|
+
- <https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json>; rel="describedBy"
|
255
|
+
Vary:
|
256
|
+
- Accept-Encoding
|
257
|
+
Date:
|
258
|
+
- Tue, 07 Jul 2015 12:05:58 GMT
|
259
|
+
Connection:
|
260
|
+
- keep-alive
|
261
|
+
body:
|
262
|
+
encoding: ASCII-8BIT
|
263
|
+
string: '{"id":"140b91c107d2058dee730e75be0b1151","email_address":"ann@sayers.cc","unique_email_id":"37a55cdc48","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"Ann","LNAME":"Example"},"interests":{"ca7ab24b53":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"86.163.13.133","timestamp_opt":"2015-06-27
|
264
|
+
14:50:15","member_rating":2,"last_changed":"2015-07-07T12:05:57+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"e73f5910ca","_links":[{"rel":"self","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json"},{"rel":"parent","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Collection.json"},{"rel":"update","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"PATCH","schema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json"},{"rel":"delete","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"DELETE"},{"rel":"activity","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/activity","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Activity/Collection.json"},{"rel":"goals","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/goals","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Goals/Collection.json"},{"rel":"notes","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/notes","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Notes/Collection.json"}]}'
|
265
|
+
http_version:
|
266
|
+
recorded_at: Tue, 07 Jul 2015 12:05:58 GMT
|
267
|
+
recorded_with: VCR 2.9.3
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists?count=500&exclude_fields=lists._links&offset=0
|
5
|
+
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists?count=500&exclude_fields=lists._links,_links&offset=0
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -46,7 +46,7 @@ http_interactions:
|
|
46
46
|
recorded_at: Wed, 01 Jul 2015 14:30:32 GMT
|
47
47
|
- request:
|
48
48
|
method: get
|
49
|
-
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members?count=10&exclude_fields=members._links&offset=0
|
49
|
+
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members?count=10&exclude_fields=members._links,_links&offset=0
|
50
50
|
body:
|
51
51
|
encoding: US-ASCII
|
52
52
|
string: ''
|
@@ -105,7 +105,7 @@ http_interactions:
|
|
105
105
|
recorded_at: Wed, 01 Jul 2015 14:30:32 GMT
|
106
106
|
- request:
|
107
107
|
method: get
|
108
|
-
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members?count=10&exclude_fields=members._links&offset=10
|
108
|
+
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members?count=10&exclude_fields=members._links,_links&offset=10
|
109
109
|
body:
|
110
110
|
encoding: US-ASCII
|
111
111
|
string: ''
|
@@ -164,7 +164,7 @@ http_interactions:
|
|
164
164
|
recorded_at: Wed, 01 Jul 2015 14:30:32 GMT
|
165
165
|
- request:
|
166
166
|
method: get
|
167
|
-
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members?count=10&exclude_fields=members._links&offset=20
|
167
|
+
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members?count=10&exclude_fields=members._links,_links&offset=20
|
168
168
|
body:
|
169
169
|
encoding: US-ASCII
|
170
170
|
string: ''
|
@@ -223,7 +223,7 @@ http_interactions:
|
|
223
223
|
recorded_at: Wed, 01 Jul 2015 14:30:32 GMT
|
224
224
|
- request:
|
225
225
|
method: get
|
226
|
-
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members?count=10&exclude_fields=members._links&offset=30
|
226
|
+
uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members?count=10&exclude_fields=members._links,_links&offset=30
|
227
227
|
body:
|
228
228
|
encoding: US-ASCII
|
229
229
|
string: ''
|
@@ -260,7 +260,18 @@ http_interactions:
|
|
260
260
|
- keep-alive
|
261
261
|
body:
|
262
262
|
encoding: ASCII-8BIT
|
263
|
-
string: '{"members":[{"id":"3387277a449fa6fe2d66f5185ef23d0d","email_address":"somebody@example.com","unique_email_id":"130333fe23","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"","LNAME":"Omar
|
263
|
+
string: '{"members":[{"id":"3387277a449fa6fe2d66f5185ef23d0d","email_address":"somebody@example.com","unique_email_id":"130333fe23","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"","LNAME":"Omar
|
264
|
+
Liess","MMERGE3":"","MMERGE4":"","MMERGE5":0,"MMERGE6":"","MMERGE7":"","MMERGE8":"","MMERGE9":"","MMERGE10":"","MMERGE11":""},"interests":{"bcb5bf9704":false,"a3466d48ef":false,"108f2c6b6e":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"85.92.193.106","timestamp_opt":"2015-02-24
|
265
|
+
11:06:16","member_rating":2,"last_changed":"2015-02-24T11:06:16+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"c6d27c12c2"},{"id":"9f4ce260f5ba979eed17469c906d0215","email_address":"somebody@example.com","unique_email_id":"35bf97a7b5","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"","LNAME":"dave","MMERGE3":"","MMERGE4":"","MMERGE5":0,"MMERGE6":"","MMERGE7":"","MMERGE8":"","MMERGE9":"","MMERGE10":"","MMERGE11":""},"interests":{"bcb5bf9704":false,"a3466d48ef":false,"108f2c6b6e":false},"stats":{"avg_open_rate":0.3333,"avg_click_rate":0.3333},"ip_signup":"","timestamp_signup":"","ip_opt":"85.92.193.106","timestamp_opt":"2015-02-24
|
266
|
+
11:06:16","member_rating":2,"last_changed":"2015-02-24T11:06:16+00:00","language":"en","vip":false,"email_client":"","location":{"latitude":52.6045,"longitude":-2.60185,"gmtoff":0,"dstoff":1,"country_code":"GB","timezone":"Atlantic/Faroe"},"list_id":"c6d27c12c2"},{"id":"1c45af27937ca4047416dd5e39094a4f","email_address":"somebody@example.com","unique_email_id":"8f0a4838ed","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"","LNAME":"Omar
|
267
|
+
Liess","MMERGE3":"","MMERGE4":"","MMERGE5":0,"MMERGE6":"","MMERGE7":"","MMERGE8":"","MMERGE9":"","MMERGE10":"","MMERGE11":""},"interests":{"bcb5bf9704":false,"a3466d48ef":false,"108f2c6b6e":false},"stats":{"avg_open_rate":0.3333,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"2015-02-24
|
268
|
+
19:58:00","ip_opt":"85.92.193.106","timestamp_opt":"2015-02-24 11:06:16","member_rating":2,"last_changed":"2015-02-24T11:06:16+00:00","language":"","vip":false,"email_client":"","location":{"latitude":52.6045,"longitude":-2.60185,"gmtoff":0,"dstoff":1,"country_code":"GB","timezone":"Atlantic/Faroe"},"list_id":"c6d27c12c2"},{"id":"5294b6b042c69a70598fef2b5532451f","email_address":"somebody@example.com","unique_email_id":"83dfb3427c","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"","LNAME":"Chris
|
269
|
+
Handley","MMERGE3":"","MMERGE4":"","MMERGE5":0,"MMERGE6":"","MMERGE7":"","MMERGE8":"","MMERGE9":"","MMERGE10":"","MMERGE11":""},"interests":{"bcb5bf9704":false,"a3466d48ef":false,"108f2c6b6e":false},"stats":{"avg_open_rate":0.6667,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"85.92.193.106","timestamp_opt":"2015-02-24
|
270
|
+
11:06:16","member_rating":2,"last_changed":"2015-02-24T11:06:16+00:00","language":"","vip":false,"email_client":"","location":{"latitude":52.6474,"longitude":-2.70793,"gmtoff":0,"dstoff":1,"country_code":"GB","timezone":"Atlantic/Faroe"},"list_id":"c6d27c12c2"},{"id":"06dc2c772ea2170f5a212dde3c14b793","email_address":"somebody@example.com","unique_email_id":"a81e1bbf30","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"","LNAME":"shameelkhan363","MMERGE3":"","MMERGE4":"","MMERGE5":0,"MMERGE6":"","MMERGE7":"","MMERGE8":"","MMERGE9":"","MMERGE10":"","MMERGE11":""},"interests":{"bcb5bf9704":false,"a3466d48ef":false,"108f2c6b6e":false},"stats":{"avg_open_rate":1,"avg_click_rate":0.3333},"ip_signup":"","timestamp_signup":"","ip_opt":"85.92.193.106","timestamp_opt":"2015-02-24
|
271
|
+
11:06:16","member_rating":4,"last_changed":"2015-02-24T11:06:16+00:00","language":"en","vip":false,"email_client":"","location":{"latitude":52.6474,"longitude":-2.70793,"gmtoff":0,"dstoff":1,"country_code":"GB","timezone":"Atlantic/Faroe"},"list_id":"c6d27c12c2"},{"id":"884db83a3347f02271fc2b26c742111b","email_address":"somebody@example.com","unique_email_id":"64404b810a","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"","LNAME":"Reuben
|
272
|
+
Levy","MMERGE3":"","MMERGE4":"","MMERGE5":0,"MMERGE6":"","MMERGE7":"","MMERGE8":"","MMERGE9":"","MMERGE10":"","MMERGE11":""},"interests":{"bcb5bf9704":false,"a3466d48ef":false,"108f2c6b6e":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"2015-02-24
|
273
|
+
22:18:00","ip_opt":"85.92.193.106","timestamp_opt":"2015-02-24 11:06:16","member_rating":2,"last_changed":"2015-02-24T11:06:16+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"c6d27c12c2"},{"id":"31722da12b62b65a02aaddad2491fb10","email_address":"somebody@example.com","unique_email_id":"7e294f60f2","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"","LNAME":"bowoproperties","MMERGE3":"","MMERGE4":"","MMERGE5":0,"MMERGE6":"","MMERGE7":"","MMERGE8":"","MMERGE9":"","MMERGE10":"","MMERGE11":""},"interests":{"bcb5bf9704":false,"a3466d48ef":false,"108f2c6b6e":false},"stats":{"avg_open_rate":0.3333,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"85.92.193.106","timestamp_opt":"2015-02-24
|
274
|
+
11:06:16","member_rating":2,"last_changed":"2015-02-24T11:06:16+00:00","language":"","vip":false,"email_client":"","location":{"latitude":52.6045,"longitude":-2.60185,"gmtoff":0,"dstoff":1,"country_code":"GB","timezone":"Atlantic/Faroe"},"list_id":"c6d27c12c2"}],"total_items":37}'
|
264
275
|
http_version:
|
265
276
|
recorded_at: Wed, 01 Jul 2015 14:30:32 GMT
|
266
277
|
recorded_with: VCR 2.9.3
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'mailchimp_api_v3'
|
4
4
|
|
5
|
-
describe Mailchimp::Account, vcr: { cassette_name: '
|
5
|
+
describe Mailchimp::Account, vcr: { cassette_name: 'account' } do
|
6
6
|
it 'is the expected class' do
|
7
7
|
expect(Mailchimp.connect.account).to be_a Mailchimp::Account
|
8
8
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'mailchimp_api_v3'
|
4
4
|
|
5
|
-
describe Mailchimp::Exception::APIKeyError, vcr: { cassette_name: '
|
5
|
+
describe Mailchimp::Exception::APIKeyError, vcr: { cassette_name: 'exception' } do
|
6
6
|
let(:bad_key) { 'xxxxxxxxxx-us11' }
|
7
7
|
|
8
8
|
it 'raises an exception if the API key is not valid' do
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'mailchimp_api_v3'
|
4
4
|
|
5
|
-
describe Mailchimp::List::InterestCategories, vcr: { cassette_name: '
|
5
|
+
describe Mailchimp::List::InterestCategories, vcr: { cassette_name: 'interest_categories' } do
|
6
6
|
let(:list) { Mailchimp.connect.lists.first }
|
7
7
|
let(:interest_categories) { list.interest_categories }
|
8
8
|
|
@@ -10,45 +10,33 @@ describe Mailchimp::List::InterestCategories, vcr: { cassette_name: 'mailchimp'
|
|
10
10
|
expect(interest_categories).to be_a Mailchimp::List::InterestCategories
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
context 'adding and deleting' do
|
14
|
+
context '#create, #find_by, #delete, #first_or_create' do
|
15
|
+
it 'can add and delete a new instance' do
|
16
|
+
title = 'Days'
|
17
|
+
data = { 'title' => title, 'type' => 'checkboxes' }
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
expect(interest_category).to be_a Mailchimp::List::InterestCategory
|
21
|
-
expect(interest_category.id).to eq '2ce011eb68'
|
22
|
-
end
|
19
|
+
# #create
|
20
|
+
expect { interest_categories.create data }.to change { list.interest_categories.count }.by(1)
|
21
|
+
expect { interest_categories.create data }.to raise_error Mailchimp::Exception::Duplicate
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
it 'can add a new instance' do
|
27
|
-
data = { 'title' => 'Days', 'type' => 'checkboxes' }
|
28
|
-
interest_category = interest_categories.create data
|
23
|
+
# #find_by
|
24
|
+
interest_category = list.interest_categories.find_by title: title
|
29
25
|
expect(interest_category).to be_a Mailchimp::List::InterestCategory
|
30
|
-
expect(interest_category.title).to eq
|
31
|
-
end
|
26
|
+
expect(interest_category.title).to eq title
|
32
27
|
|
33
|
-
|
34
|
-
|
35
|
-
expect
|
36
|
-
end
|
37
|
-
end
|
28
|
+
# #first_or_create finds the same instance
|
29
|
+
interest_category2 = list.interest_categories.first_or_create title: title
|
30
|
+
expect(interest_category.id).to eq(interest_category2.id)
|
38
31
|
|
39
|
-
|
40
|
-
|
41
|
-
data = { 'title' => 'Colors', 'type' => 'checkboxes' }
|
42
|
-
interest_category = interest_categories.first_or_create data
|
43
|
-
expect(interest_category).to be_a Mailchimp::List::InterestCategory
|
44
|
-
expect(interest_category.title).to eq 'Colors'
|
45
|
-
end
|
32
|
+
# #delete
|
33
|
+
expect { interest_category.delete }.to change { list.interest_categories.count }.by(-1)
|
46
34
|
|
47
|
-
|
48
|
-
|
35
|
+
# #first_or_create creates a new instance
|
36
|
+
title = 'Sex'
|
37
|
+
data = { 'title' => title, 'type' => 'radio' }
|
49
38
|
interest_category = interest_categories.first_or_create data
|
50
|
-
expect(interest_category).to
|
51
|
-
expect(interest_category.title).to eq 'Sex'
|
39
|
+
expect(interest_category.title).to eq title
|
52
40
|
end
|
53
41
|
end
|
54
42
|
end
|
@@ -2,24 +2,24 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'mailchimp_api_v3'
|
4
4
|
|
5
|
-
describe Mailchimp::List::InterestCategory, vcr: { cassette_name: '
|
5
|
+
describe Mailchimp::List::InterestCategory, vcr: { cassette_name: 'interest_category' } do
|
6
6
|
let(:lists) { Mailchimp.connect.lists }
|
7
7
|
let(:list) { lists.first }
|
8
|
-
let(:
|
8
|
+
let(:title) { 'Days' }
|
9
|
+
let(:interest_category) { list.interest_categories.create 'title' => title, 'type' => 'checkboxes' }
|
9
10
|
|
10
11
|
it 'is the expected class' do
|
11
12
|
expect(interest_category).to be_a Mailchimp::List::InterestCategory
|
12
13
|
end
|
13
14
|
|
14
15
|
it 'has a title' do
|
15
|
-
expect(interest_category.title).to eq
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'has an id' do
|
19
|
-
expect(interest_category.id).to eq '2ce011eb68'
|
16
|
+
expect(interest_category.title).to eq title
|
20
17
|
end
|
21
18
|
|
22
19
|
it 'has an interests collection' do
|
20
|
+
expect(interest_category.interests.count).to eq 0
|
21
|
+
interest_category.interests.create name: 'Monday'
|
22
|
+
interest_category.interests.create name: 'Tuesday'
|
23
23
|
interests = interest_category.interests
|
24
24
|
expect(interests).to be_an Array
|
25
25
|
expect(interests.sample).to be_a Mailchimp::List::InterestCategory::Interest
|