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
@@ -2,21 +2,24 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'mailchimp_api_v3'
|
4
4
|
|
5
|
-
describe Mailchimp::List::InterestCategory::Interest, vcr: { cassette_name: '
|
5
|
+
describe Mailchimp::List::InterestCategory::Interest, vcr: { cassette_name: 'interest' } do
|
6
6
|
let(:lists) { Mailchimp.connect.lists }
|
7
7
|
let(:list) { lists.first }
|
8
|
-
let(:
|
9
|
-
let(:
|
8
|
+
let(:title) { 'Days' }
|
9
|
+
let(:interest_category) { list.interest_categories.create 'title' => title, 'type' => 'checkboxes' }
|
10
|
+
let(:name) { 'Monday' }
|
11
|
+
let(:interest) { interest_category.interests.create name: name }
|
10
12
|
|
11
13
|
it 'is the expected class' do
|
12
14
|
expect(interest).to be_a Mailchimp::List::InterestCategory::Interest
|
13
15
|
end
|
14
16
|
|
15
17
|
it 'has a name' do
|
16
|
-
expect(interest.name).to eq
|
18
|
+
expect(interest.name).to eq name
|
17
19
|
end
|
18
20
|
|
19
|
-
it '
|
20
|
-
|
21
|
+
it 'deletes an instance' do
|
22
|
+
interest2 = interest_category.interests.create name: 'Tuesday'
|
23
|
+
expect { interest2.delete }.to change { interest_category.interests.count }.by(-1)
|
21
24
|
end
|
22
25
|
end
|
@@ -2,47 +2,43 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'mailchimp_api_v3'
|
4
4
|
|
5
|
-
describe Mailchimp::List::InterestCategory::Interests, vcr: { cassette_name: '
|
5
|
+
describe Mailchimp::List::InterestCategory::Interests, vcr: { cassette_name: 'interests' } do
|
6
6
|
let(:list) { Mailchimp.connect.lists.first }
|
7
|
-
let(:
|
7
|
+
let(:title) { 'Days' }
|
8
|
+
let(:interest_category) { list.interest_categories.create 'title' => title, 'type' => 'checkboxes' }
|
8
9
|
let(:interests) { interest_category.interests }
|
9
10
|
|
10
11
|
it 'is the expected class' do
|
11
12
|
expect(interests).to be_a Mailchimp::List::InterestCategory::Interests
|
12
13
|
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
context '#create' do
|
20
|
-
it 'can add a new instance' do
|
21
|
-
data = { 'name' => 'Green' }
|
22
|
-
interest = interests.create data
|
23
|
-
expect(interest).to be_a Mailchimp::List::InterestCategory::Interest
|
24
|
-
expect(interest.name).to eq 'Green'
|
25
|
-
end
|
15
|
+
context 'adding and deleting' do
|
16
|
+
context '#create, #find_by, #delete, #first_or_create' do
|
17
|
+
it 'can add and delete a new instance' do
|
18
|
+
name = 'Monday'
|
19
|
+
data = { 'name' => name }
|
26
20
|
|
27
|
-
|
28
|
-
data
|
21
|
+
# #create
|
22
|
+
expect { interests.create data }.to change { interest_category.interests.count }.by(1)
|
29
23
|
expect { interests.create data }.to raise_error Mailchimp::Exception::Duplicate
|
30
|
-
end
|
31
|
-
end
|
32
24
|
|
33
|
-
|
34
|
-
|
35
|
-
data = { 'name' => 'Red' }
|
36
|
-
interest = interests.first_or_create data
|
25
|
+
# #find_by
|
26
|
+
interest = interest_category.interests.find_by name: name
|
37
27
|
expect(interest).to be_a Mailchimp::List::InterestCategory::Interest
|
38
|
-
expect(interest.name).to eq
|
39
|
-
|
28
|
+
expect(interest.name).to eq name
|
29
|
+
|
30
|
+
# #first_or_create finds the same instance
|
31
|
+
interest2 = interest_category.interests.first_or_create name: name
|
32
|
+
expect(interest.id).to eq(interest2.id)
|
40
33
|
|
41
|
-
|
42
|
-
|
34
|
+
# #delete
|
35
|
+
expect { interest.delete }.to change { interest_category.interests.count }.by(-1)
|
36
|
+
|
37
|
+
# #first_or_create creates a new instance
|
38
|
+
name = 'Tuesday'
|
39
|
+
data = { 'name' => name }
|
43
40
|
interest = interests.first_or_create data
|
44
|
-
expect(interest).to
|
45
|
-
expect(interest.name).to eq 'Amber'
|
41
|
+
expect(interest.name).to eq name
|
46
42
|
end
|
47
43
|
end
|
48
44
|
end
|
@@ -2,17 +2,18 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'mailchimp_api_v3'
|
4
4
|
|
5
|
-
describe Mailchimp::List::Member, vcr: { cassette_name: '
|
5
|
+
describe Mailchimp::List::Member, vcr: { cassette_name: 'member' } do
|
6
6
|
let(:lists) { Mailchimp.connect.lists }
|
7
7
|
let(:list) { lists.first }
|
8
|
-
let(:
|
8
|
+
let(:name) { 'Ann Example' }
|
9
|
+
let(:member) { list.members.first_or_create name: name, email_address: 'ann@sayers.cc' }
|
9
10
|
|
10
11
|
it 'is the expected class' do
|
11
12
|
expect(member).to be_a Mailchimp::List::Member
|
12
13
|
end
|
13
14
|
|
14
15
|
it 'has a name' do
|
15
|
-
expect(member.name).to eq
|
16
|
+
expect(member.name).to eq name
|
16
17
|
end
|
17
18
|
|
18
19
|
it 'has an id' do
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'mailchimp_api_v3'
|
4
4
|
|
5
|
-
describe Mailchimp::List::Members, vcr: { cassette_name: 'members' } do
|
5
|
+
describe Mailchimp::List::Members, vcr: { cassette_name: 'members', allow_playback_repeats: true } do
|
6
6
|
let(:page_size) { 10 }
|
7
7
|
let(:member_count) { 37 }
|
8
8
|
let(:list) { Mailchimp.connect.lists.first }
|
data/spec/support/vcr_setup.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailchimp_api_v3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xenapto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -237,7 +237,17 @@ files:
|
|
237
237
|
- lib/mailchimp_api_v3/member.rb
|
238
238
|
- lib/mailchimp_api_v3/version.rb
|
239
239
|
- mailchimp_api_v3.gemspec
|
240
|
+
- spec/fixtures/cassettes/account.yml
|
241
|
+
- spec/fixtures/cassettes/client.yml
|
242
|
+
- spec/fixtures/cassettes/exception.yml
|
243
|
+
- spec/fixtures/cassettes/interest.yml
|
244
|
+
- spec/fixtures/cassettes/interest_categories.yml
|
245
|
+
- spec/fixtures/cassettes/interest_category.yml
|
246
|
+
- spec/fixtures/cassettes/interests.yml
|
247
|
+
- spec/fixtures/cassettes/list.yml
|
248
|
+
- spec/fixtures/cassettes/lists.yml
|
240
249
|
- spec/fixtures/cassettes/mailchimp.yml
|
250
|
+
- spec/fixtures/cassettes/member.yml
|
241
251
|
- spec/fixtures/cassettes/members.yml
|
242
252
|
- spec/mailchimp_api_v3/account_spec.rb
|
243
253
|
- spec/mailchimp_api_v3/client_spec.rb
|
@@ -274,12 +284,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
284
|
version: '0'
|
275
285
|
requirements: []
|
276
286
|
rubyforge_project:
|
277
|
-
rubygems_version: 2.4.
|
287
|
+
rubygems_version: 2.4.6
|
278
288
|
signing_key:
|
279
289
|
specification_version: 4
|
280
290
|
summary: 'Example: mailchimp.lists("My first list").member("ann@example.com")'
|
281
291
|
test_files:
|
292
|
+
- spec/fixtures/cassettes/account.yml
|
293
|
+
- spec/fixtures/cassettes/client.yml
|
294
|
+
- spec/fixtures/cassettes/exception.yml
|
295
|
+
- spec/fixtures/cassettes/interest.yml
|
296
|
+
- spec/fixtures/cassettes/interest_categories.yml
|
297
|
+
- spec/fixtures/cassettes/interest_category.yml
|
298
|
+
- spec/fixtures/cassettes/interests.yml
|
299
|
+
- spec/fixtures/cassettes/list.yml
|
300
|
+
- spec/fixtures/cassettes/lists.yml
|
282
301
|
- spec/fixtures/cassettes/mailchimp.yml
|
302
|
+
- spec/fixtures/cassettes/member.yml
|
283
303
|
- spec/fixtures/cassettes/members.yml
|
284
304
|
- spec/mailchimp_api_v3/account_spec.rb
|
285
305
|
- spec/mailchimp_api_v3/client_spec.rb
|
@@ -296,4 +316,3 @@ test_files:
|
|
296
316
|
- spec/spec_helper.rb
|
297
317
|
- spec/support/api_key.rb
|
298
318
|
- spec/support/vcr_setup.rb
|
299
|
-
has_rdoc:
|