mailchimp_api 1.0.0.pre.10 → 1.0.0.pre.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/lib/mailchimp_api/collection_parsers/segment_member.rb +9 -0
- data/lib/mailchimp_api/exceptions.rb +6 -0
- data/lib/mailchimp_api/resources/list.rb +1 -0
- data/lib/mailchimp_api/resources/member.rb +8 -0
- data/lib/mailchimp_api/resources/segment.rb +10 -0
- data/lib/mailchimp_api/resources/segment_member.rb +17 -0
- data/lib/mailchimp_api/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1558e2a34a6df4a62a33ad95adcbad36e8ca962ba6598af347f03b5721bed4f
|
4
|
+
data.tar.gz: c4fd86b6e6994d92286f7ab63668e3578d2df89e0224353d6ca9b69c258c73ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4fa7b461537628d84b8cc5fdc4b02ace8f0d32de2c03dffa763c003e3ef0ea30c73c56cf7ee34f075cba10ae03214e7130377077052b35198ecc469af5ba3cb
|
7
|
+
data.tar.gz: b1792d1ed32d4007222bfd51d8c0010c1905dcfff17d7ce1adab380fc354b2dbf3d37cb4d0ee931a1a873d50c701c741a9ee137f4ac81846f7796fbc203014b9
|
data/CHANGELOG.md
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
- Support of '/lists/<id>/members/<id>/notes'
|
12
12
|
- Support of '/lists/<id>/members/<id>/tags'
|
13
13
|
- Support of '/lists/<id>/segments'
|
14
|
+
- Support of '/lists/<id>/segments/<id>/members'
|
14
15
|
- Support of '/lists/<id>/merge-fields'
|
15
16
|
- Support of '/lists/<id>/signup-forms'
|
16
17
|
- `.count` support
|
@@ -12,5 +12,6 @@ module MailchimpAPI
|
|
12
12
|
has_many :members, class_name: 'MailchimpAPI::Member'
|
13
13
|
has_many :merge_fields, class_name: 'MailchimpAPI::MergeField'
|
14
14
|
has_many :signup_forms, class_name: 'MailchimpAPI::SignupForm'
|
15
|
+
has_many :segments, class_name: 'MailchimpAPI::Segment'
|
15
16
|
end
|
16
17
|
end
|
@@ -40,5 +40,13 @@ module MailchimpAPI
|
|
40
40
|
connection.post path, nil, self.class.headers
|
41
41
|
end
|
42
42
|
end
|
43
|
+
|
44
|
+
# Tags should be provided as an array of the form [{name: 'tag1', status: 'active'}, {name: 'tag2', status: 'inactive'}]
|
45
|
+
def update_tags(tags)
|
46
|
+
path = element_path(prefix_options) + '/tags'
|
47
|
+
body = { tags: tags }.to_json
|
48
|
+
|
49
|
+
connection.post path, body, self.class.headers
|
50
|
+
end
|
43
51
|
end
|
44
52
|
end
|
@@ -9,5 +9,15 @@ module MailchimpAPI
|
|
9
9
|
self.collection_parser = CollectionParsers::Segment
|
10
10
|
|
11
11
|
self.prefix = '/3.0/lists/:list_id/'
|
12
|
+
|
13
|
+
# The path to get segment members is '/3.0/lists/:list_id/segments/:segment_id/members'
|
14
|
+
# Unfortunately, ActiveResource does not support nested resources, only single parent resources:
|
15
|
+
#
|
16
|
+
# https://github.com/rails/activeresource/blob/4accda8bc03ceae0ad626f8cec0b4751e89a58ad/lib/active_resource/associations.rb#L151
|
17
|
+
#
|
18
|
+
# Using a has_many, there is no way to include the `list_id`, so we just create our own members method.
|
19
|
+
def members(params = {})
|
20
|
+
@members ||= MailchimpAPI::SegmentMember.find(:all, params: { segment_id: id }.deep_merge(prefix_options).deep_merge(params))
|
21
|
+
end
|
12
22
|
end
|
13
23
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MailchimpAPI
|
4
|
+
class SegmentMember < Base
|
5
|
+
extend MailchimpAPI::Support::Countable
|
6
|
+
|
7
|
+
self.collection_parser = CollectionParsers::SegmentMember
|
8
|
+
self.element_name = 'member'
|
9
|
+
self.collection_name = 'members'
|
10
|
+
|
11
|
+
self.prefix = '/3.0/lists/:list_id/segments/:segment_id/'
|
12
|
+
|
13
|
+
def update
|
14
|
+
raise MailchimpAPI::InvalidOperation.new 'Cannot update SegmentMember. Please use POST to add to a Segment, or DELETE to remove from a Segment.'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailchimp_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.
|
4
|
+
version: 1.0.0.pre.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rewind.io
|
@@ -186,6 +186,7 @@ files:
|
|
186
186
|
- lib/mailchimp_api/collection_parsers/merge_field.rb
|
187
187
|
- lib/mailchimp_api/collection_parsers/note.rb
|
188
188
|
- lib/mailchimp_api/collection_parsers/segment.rb
|
189
|
+
- lib/mailchimp_api/collection_parsers/segment_member.rb
|
189
190
|
- lib/mailchimp_api/collection_parsers/signup_form.rb
|
190
191
|
- lib/mailchimp_api/collection_parsers/tag.rb
|
191
192
|
- lib/mailchimp_api/configuration.rb
|
@@ -204,6 +205,7 @@ files:
|
|
204
205
|
- lib/mailchimp_api/resources/merge_field.rb
|
205
206
|
- lib/mailchimp_api/resources/note.rb
|
206
207
|
- lib/mailchimp_api/resources/segment.rb
|
208
|
+
- lib/mailchimp_api/resources/segment_member.rb
|
207
209
|
- lib/mailchimp_api/resources/signup_form.rb
|
208
210
|
- lib/mailchimp_api/resources/support/countable.rb
|
209
211
|
- lib/mailchimp_api/resources/support/patch_update.rb
|