mailchimp3 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/mailchimp3/endpoint.rb +7 -0
- data/lib/mailchimp3/version.rb +1 -1
- data/spec/mailchimp3/endpoint_spec.rb +33 -0
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6fd6225b87a5d12d4161ec1d65ac0a9c8c9dafd92050e4c3416bd229447d9fcd
|
4
|
+
data.tar.gz: 87f548c2d01253aaa9e5c4a9e2a4fd6a8c479ecd834c701d269b711586b484f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce4724bbe6b7bd38013e44ce84adb4b6c80795c75cdfeb83e045fecd5c9f82169eff6a42a0908f0547ad5fe4caf846342c31990cc2d2163a73a6160a2c810790
|
7
|
+
data.tar.gz: 8fbea35cb50e103906e2b0b35402eace21b65b22322f10de05ccc6b2a9d49f2cd19901359ffd6a6b7ad9d6fdfff188be5280deeee6fbe31bf5dcfc0a51c970a7
|
data/lib/mailchimp3/endpoint.rb
CHANGED
@@ -44,6 +44,13 @@ module MailChimp3
|
|
44
44
|
_build_response(@last_result)
|
45
45
|
end
|
46
46
|
|
47
|
+
def put(body = {})
|
48
|
+
@last_result = _connection.put(@url) do |req|
|
49
|
+
req.body = body.to_json
|
50
|
+
end
|
51
|
+
_build_response(@last_result)
|
52
|
+
end
|
53
|
+
|
47
54
|
def delete
|
48
55
|
@last_result = _connection.delete(@url)
|
49
56
|
if @last_result.status == 204
|
data/lib/mailchimp3/version.rb
CHANGED
@@ -197,6 +197,38 @@ describe MailChimp3::Endpoint do
|
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
+
describe '#put' do
|
201
|
+
subject { base.lists[list_id].members[md5_hash] }
|
202
|
+
|
203
|
+
let(:list_id) { 'd3ed40bd7c' }
|
204
|
+
let(:member_email) { 'test@email.com' }
|
205
|
+
let(:md5_hash) { Digest::MD5.hexdigest(member_email) }
|
206
|
+
let(:resource) do
|
207
|
+
{
|
208
|
+
'email_address' => member_email,
|
209
|
+
'status_if_new' => 'subscribed'
|
210
|
+
}
|
211
|
+
end
|
212
|
+
|
213
|
+
let(:result) do
|
214
|
+
{
|
215
|
+
'id' => md5_hash,
|
216
|
+
'list_id' => list_id,
|
217
|
+
'status' => 'subscribed'
|
218
|
+
}
|
219
|
+
end
|
220
|
+
|
221
|
+
before do
|
222
|
+
stub_request(:put, "https://us2.api.mailchimp.com/3.0/lists/#{list_id}/members/#{md5_hash}")
|
223
|
+
.to_return(status: 200, body: result.to_json, headers: { 'Content-Type' => 'application/json; charset=utf-8' })
|
224
|
+
@result = subject.put(resource)
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'returns the result of making a PUT request to the endpoint' do
|
228
|
+
expect(@result).to eq(result)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
200
232
|
describe '#delete' do
|
201
233
|
subject { base.lists['d3ed40bd7c'] }
|
202
234
|
|
@@ -210,4 +242,5 @@ describe MailChimp3::Endpoint do
|
|
210
242
|
expect(@result).to eq(true)
|
211
243
|
end
|
212
244
|
end
|
245
|
+
|
213
246
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailchimp3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.45
|
33
|
+
version: '0.45'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.45
|
40
|
+
version: '0.45'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: oauth2
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,13 +132,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
|
-
|
136
|
-
rubygems_version: 2.5.2
|
135
|
+
rubygems_version: 3.0.1
|
137
136
|
signing_key:
|
138
137
|
specification_version: 4
|
139
138
|
summary: wrapper for MailChimp's 3.0 API
|
140
139
|
test_files:
|
141
|
-
- spec/mailchimp3/endpoint_spec.rb
|
142
|
-
- spec/mailchimp3/oauth_spec.rb
|
143
|
-
- spec/mailchimp3_spec.rb
|
144
140
|
- spec/spec_helper.rb
|
141
|
+
- spec/mailchimp3_spec.rb
|
142
|
+
- spec/mailchimp3/oauth_spec.rb
|
143
|
+
- spec/mailchimp3/endpoint_spec.rb
|