mailerlite-ruby 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env.example +1 -0
- data/.github/workflows/main.yml +17 -0
- data/.github/workflows/publish_gem.yml +21 -0
- data/.gitignore +60 -0
- data/.rspec +1 -0
- data/.rubocop.yml +36 -0
- data/CHANGELOG.md +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +801 -0
- data/Rakefile +8 -0
- data/bin/console +8 -0
- data/bin/setup +8 -0
- data/fixtures/automations/fetch.yml +61 -0
- data/fixtures/automations/get.yml +68 -0
- data/fixtures/automations/get_subscriber_activity.yml +71 -0
- data/fixtures/batch/request.yml +59 -0
- data/fixtures/campaigns/activity.yml +64 -0
- data/fixtures/campaigns/create.yml +65 -0
- data/fixtures/campaigns/delete.yml +53 -0
- data/fixtures/campaigns/fetch.yml +64 -0
- data/fixtures/campaigns/get.yml +68 -0
- data/fixtures/campaigns/languages.yml +60 -0
- data/fixtures/campaigns/schedule.yml +160 -0
- data/fixtures/campaigns/update.yml +159 -0
- data/fixtures/fields/create.yml +57 -0
- data/fixtures/fields/delete.yml +53 -0
- data/fixtures/fields/get.yml +60 -0
- data/fixtures/fields/update.yml +57 -0
- data/fixtures/forms/delete.yml +53 -0
- data/fixtures/forms/fetch.yml +60 -0
- data/fixtures/forms/fetch_subscribers.yml +59 -0
- data/fixtures/forms/list.yml +62 -0
- data/fixtures/forms/update.yml +60 -0
- data/fixtures/groups/assign_subscriber.yml +58 -0
- data/fixtures/groups/create.yml +58 -0
- data/fixtures/groups/delete.yml +53 -0
- data/fixtures/groups/get.yml +63 -0
- data/fixtures/groups/get_subscribers.yml +62 -0
- data/fixtures/groups/unassign_subscriber.yml +53 -0
- data/fixtures/groups/update.yml +58 -0
- data/fixtures/segments/delete.yml +53 -0
- data/fixtures/segments/get_subscribers.yml +61 -0
- data/fixtures/segments/list.yml +60 -0
- data/fixtures/segments/update.yml +58 -0
- data/fixtures/subscribers/create.yml +57 -0
- data/fixtures/subscribers/delete.yml +51 -0
- data/fixtures/subscribers/fetch.yml +68 -0
- data/fixtures/subscribers/fetch_count.yml +55 -0
- data/fixtures/subscribers/get.yml +62 -0
- data/fixtures/timezones/list.yml +575 -0
- data/fixtures/webhooks/create.yml +58 -0
- data/fixtures/webhooks/delete.yml +53 -0
- data/fixtures/webhooks/get.yml +58 -0
- data/fixtures/webhooks/list.yml +61 -0
- data/fixtures/webhooks/update.yml +58 -0
- data/lib/mailerlite/automations/automations.rb +62 -0
- data/lib/mailerlite/batch/batch.rb +24 -0
- data/lib/mailerlite/campaigns/campaigns.rb +216 -0
- data/lib/mailerlite/client.rb +35 -0
- data/lib/mailerlite/fields/fields.rb +61 -0
- data/lib/mailerlite/forms/forms.rb +73 -0
- data/lib/mailerlite/groups/groups.rb +90 -0
- data/lib/mailerlite/segments/segments.rb +62 -0
- data/lib/mailerlite/subscribers/subscribers.rb +116 -0
- data/lib/mailerlite/timezones/timezones.rb +22 -0
- data/lib/mailerlite/version.rb +5 -0
- data/lib/mailerlite/webhooks/webhooks.rb +67 -0
- data/lib/mailerlite-ruby.rb +3 -0
- data/lib/mailerlite.rb +13 -0
- data/mailerlite-ruby.gemspec +42 -0
- data/renovate.json +5 -0
- data/spec/automations_rspec.rb +63 -0
- data/spec/batches_rspec.rb +41 -0
- data/spec/campaigns_rspec.rb +155 -0
- data/spec/fields_rspec.rb +70 -0
- data/spec/forms_rspec.rb +81 -0
- data/spec/groups_rspec.rb +97 -0
- data/spec/segments_rspec.rb +70 -0
- data/spec/spec_helper.rb +101 -0
- data/spec/subscribers_rspec.rb +84 -0
- data/spec/timezones_rspec.rb +36 -0
- data/spec/webhooks_rspec.rb +86 -0
- metadata +303 -0
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Import the RSpec and VCR gems
|
4
|
+
require 'spec_helper'
|
5
|
+
require 'vcr'
|
6
|
+
require 'json'
|
7
|
+
|
8
|
+
# require "webmock/rspec"
|
9
|
+
# Import the `Webhooks` class
|
10
|
+
|
11
|
+
# Configure VCR to save and replay HTTP requests
|
12
|
+
VCR.configure do |config|
|
13
|
+
config.cassette_library_dir = './fixtures'
|
14
|
+
config.hook_into :webmock
|
15
|
+
config.filter_sensitive_data('<AUTH>') do |interaction|
|
16
|
+
interaction.request.headers['Authorization'][0]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Set up the test for the `Webhooks` class
|
21
|
+
RSpec.describe MailerLite::Webhooks do
|
22
|
+
let(:client) { MailerLite::Client.new }
|
23
|
+
let(:webhooks) { described_class.new(client: client) }
|
24
|
+
|
25
|
+
describe '#create' do
|
26
|
+
# Use VCR to record and replay the HTTP request
|
27
|
+
it 'creates a webhook' do
|
28
|
+
VCR.use_cassette('webhooks/create') do
|
29
|
+
response = webhooks.create(
|
30
|
+
name: 'test_webhook',
|
31
|
+
events: ['subscriber.created'],
|
32
|
+
url: 'http://foobar.hook'
|
33
|
+
)
|
34
|
+
body = JSON.parse(response.body)
|
35
|
+
expect(response.status).to eq 201
|
36
|
+
expect(Integer(body['data']['id'])).to be_an Integer
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#list' do
|
42
|
+
# Use VCR to record and replay the HTTP request
|
43
|
+
it 'lists all webhooks' do
|
44
|
+
VCR.use_cassette('webhooks/list') do
|
45
|
+
response = webhooks.list
|
46
|
+
body = JSON.parse(response.body)
|
47
|
+
expect(response.status).to eq 200
|
48
|
+
expect(body['data']).to be_an Array
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#update' do
|
54
|
+
# Use VCR to record and replay the HTTP request
|
55
|
+
it 'updates a webhook' do
|
56
|
+
VCR.use_cassette('webhooks/update') do
|
57
|
+
response = webhooks.update(webhook_id: 75_233_700_096_247_795, name: 'test_webhook2')
|
58
|
+
body = JSON.parse(response.body)
|
59
|
+
expect(response.status).to eq 200
|
60
|
+
expect(Integer(body['data']['id'])).to be_an Integer
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '#get' do
|
66
|
+
# Use VCR to record and replay the HTTP request
|
67
|
+
it 'gets all webhook' do
|
68
|
+
VCR.use_cassette('webhooks/get') do
|
69
|
+
response = webhooks.get(75_321_551_702_984_317)
|
70
|
+
body = JSON.parse(response.body)
|
71
|
+
expect(response.status).to eq 200
|
72
|
+
expect(Integer(body['data']['id'])).to be_an Integer
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe '#delete' do
|
78
|
+
# Use VCR to record and replay the HTTP request
|
79
|
+
it 'deletes a webhook' do
|
80
|
+
VCR.use_cassette('webhooks/delete') do
|
81
|
+
response = webhooks.delete(75_321_640_600_209_302)
|
82
|
+
expect(response.status).to eq 204
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
metadata
ADDED
@@ -0,0 +1,303 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mailerlite-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nikola Milojević
|
8
|
+
- Ahsan Gondal
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2023-03-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 2.4.7
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 2.4.7
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '13.0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '13.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rubocop
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.7'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.7'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: dotenv
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.7'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.7'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: http
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '5.0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '5.0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: json
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '2.5'
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '2.5'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: uri
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 0.12.0
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 0.12.0
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: rspec
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: simplecov
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: vcr
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: webmock
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: yard
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
type: :development
|
176
|
+
prerelease: false
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
description: MailerLite's official Ruby SDK. Interacts with all endpoints at MailerLite
|
183
|
+
API.
|
184
|
+
email:
|
185
|
+
- info@mailerlite.com
|
186
|
+
executables:
|
187
|
+
- console
|
188
|
+
- setup
|
189
|
+
extensions: []
|
190
|
+
extra_rdoc_files: []
|
191
|
+
files:
|
192
|
+
- ".env.example"
|
193
|
+
- ".github/workflows/main.yml"
|
194
|
+
- ".github/workflows/publish_gem.yml"
|
195
|
+
- ".gitignore"
|
196
|
+
- ".rspec"
|
197
|
+
- ".rubocop.yml"
|
198
|
+
- CHANGELOG.md
|
199
|
+
- Gemfile
|
200
|
+
- LICENSE.txt
|
201
|
+
- README.md
|
202
|
+
- Rakefile
|
203
|
+
- bin/console
|
204
|
+
- bin/setup
|
205
|
+
- fixtures/automations/fetch.yml
|
206
|
+
- fixtures/automations/get.yml
|
207
|
+
- fixtures/automations/get_subscriber_activity.yml
|
208
|
+
- fixtures/batch/request.yml
|
209
|
+
- fixtures/campaigns/activity.yml
|
210
|
+
- fixtures/campaigns/create.yml
|
211
|
+
- fixtures/campaigns/delete.yml
|
212
|
+
- fixtures/campaigns/fetch.yml
|
213
|
+
- fixtures/campaigns/get.yml
|
214
|
+
- fixtures/campaigns/languages.yml
|
215
|
+
- fixtures/campaigns/schedule.yml
|
216
|
+
- fixtures/campaigns/update.yml
|
217
|
+
- fixtures/fields/create.yml
|
218
|
+
- fixtures/fields/delete.yml
|
219
|
+
- fixtures/fields/get.yml
|
220
|
+
- fixtures/fields/update.yml
|
221
|
+
- fixtures/forms/delete.yml
|
222
|
+
- fixtures/forms/fetch.yml
|
223
|
+
- fixtures/forms/fetch_subscribers.yml
|
224
|
+
- fixtures/forms/list.yml
|
225
|
+
- fixtures/forms/update.yml
|
226
|
+
- fixtures/groups/assign_subscriber.yml
|
227
|
+
- fixtures/groups/create.yml
|
228
|
+
- fixtures/groups/delete.yml
|
229
|
+
- fixtures/groups/get.yml
|
230
|
+
- fixtures/groups/get_subscribers.yml
|
231
|
+
- fixtures/groups/unassign_subscriber.yml
|
232
|
+
- fixtures/groups/update.yml
|
233
|
+
- fixtures/segments/delete.yml
|
234
|
+
- fixtures/segments/get_subscribers.yml
|
235
|
+
- fixtures/segments/list.yml
|
236
|
+
- fixtures/segments/update.yml
|
237
|
+
- fixtures/subscribers/create.yml
|
238
|
+
- fixtures/subscribers/delete.yml
|
239
|
+
- fixtures/subscribers/fetch.yml
|
240
|
+
- fixtures/subscribers/fetch_count.yml
|
241
|
+
- fixtures/subscribers/get.yml
|
242
|
+
- fixtures/timezones/list.yml
|
243
|
+
- fixtures/webhooks/create.yml
|
244
|
+
- fixtures/webhooks/delete.yml
|
245
|
+
- fixtures/webhooks/get.yml
|
246
|
+
- fixtures/webhooks/list.yml
|
247
|
+
- fixtures/webhooks/update.yml
|
248
|
+
- lib/mailerlite-ruby.rb
|
249
|
+
- lib/mailerlite.rb
|
250
|
+
- lib/mailerlite/automations/automations.rb
|
251
|
+
- lib/mailerlite/batch/batch.rb
|
252
|
+
- lib/mailerlite/campaigns/campaigns.rb
|
253
|
+
- lib/mailerlite/client.rb
|
254
|
+
- lib/mailerlite/fields/fields.rb
|
255
|
+
- lib/mailerlite/forms/forms.rb
|
256
|
+
- lib/mailerlite/groups/groups.rb
|
257
|
+
- lib/mailerlite/segments/segments.rb
|
258
|
+
- lib/mailerlite/subscribers/subscribers.rb
|
259
|
+
- lib/mailerlite/timezones/timezones.rb
|
260
|
+
- lib/mailerlite/version.rb
|
261
|
+
- lib/mailerlite/webhooks/webhooks.rb
|
262
|
+
- mailerlite-ruby.gemspec
|
263
|
+
- renovate.json
|
264
|
+
- spec/automations_rspec.rb
|
265
|
+
- spec/batches_rspec.rb
|
266
|
+
- spec/campaigns_rspec.rb
|
267
|
+
- spec/fields_rspec.rb
|
268
|
+
- spec/forms_rspec.rb
|
269
|
+
- spec/groups_rspec.rb
|
270
|
+
- spec/segments_rspec.rb
|
271
|
+
- spec/spec_helper.rb
|
272
|
+
- spec/subscribers_rspec.rb
|
273
|
+
- spec/timezones_rspec.rb
|
274
|
+
- spec/webhooks_rspec.rb
|
275
|
+
homepage: https://www.MailerLite.com
|
276
|
+
licenses:
|
277
|
+
- MIT
|
278
|
+
metadata:
|
279
|
+
allowed_push_host: https://rubygems.org
|
280
|
+
homepage_uri: https://www.MailerLite.com
|
281
|
+
source_code_uri: https://github.com/mailerlite/mailerlite-ruby
|
282
|
+
changelog_uri: https://github.com/mailerlite/mailerlite-ruby/blob/main/CHANGELOG.md
|
283
|
+
rubygems_mfa_required: 'true'
|
284
|
+
post_install_message:
|
285
|
+
rdoc_options: []
|
286
|
+
require_paths:
|
287
|
+
- lib
|
288
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - ">="
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: 2.5.0
|
293
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
294
|
+
requirements:
|
295
|
+
- - ">="
|
296
|
+
- !ruby/object:Gem::Version
|
297
|
+
version: '0'
|
298
|
+
requirements: []
|
299
|
+
rubygems_version: 3.4.6
|
300
|
+
signing_key:
|
301
|
+
specification_version: 4
|
302
|
+
summary: MailerLite's official Ruby SDK
|
303
|
+
test_files: []
|