mailerlite 1.2.0 → 1.3.0
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/examples/README.md +1 -0
- data/examples/fields.md +3 -2
- data/examples/webhooks.md +31 -0
- data/lib/mailerlite/client.rb +2 -0
- data/lib/mailerlite/clients/campaigns.rb +6 -4
- data/lib/mailerlite/clients/fields.rb +4 -4
- data/lib/mailerlite/clients/groups.rb +16 -8
- data/lib/mailerlite/clients/subscribers.rb +5 -5
- data/lib/mailerlite/clients/webhooks.rb +63 -0
- data/lib/mailerlite/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9de4d75cd5a4ead0366d3877ea110f1a551e01f0
|
4
|
+
data.tar.gz: 8b439fd20c4839f14f000305279c5839142de63b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d14e38d75a5382bcd8864d99c11e1e6261f81b42a47ab1eb8cd256c1f58ffaa39b0140a3798e7ca11df97a72d7d58aee5385f9dec36c3338bcf77c1847aa9a94
|
7
|
+
data.tar.gz: 8940d6c252b925e788e55b06c545fa40de345756b42308f63cb62c49c5c437366997011db48c3c5b8414b415f48865c8e299553c733d71c0482493df51eaf100
|
data/examples/README.md
CHANGED
data/examples/fields.md
CHANGED
@@ -16,10 +16,11 @@ client.create_field(options)
|
|
16
16
|
## Update custom field in account
|
17
17
|
|
18
18
|
```ruby
|
19
|
-
client.update_field(id,
|
19
|
+
client.update_field(id, title: 'New title')
|
20
20
|
```
|
21
21
|
|
22
|
-
##Remove custom field from account
|
22
|
+
## Remove custom field from account
|
23
|
+
|
23
24
|
```ruby
|
24
25
|
client.delete_field(id)
|
25
26
|
```
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Webhooks
|
2
|
+
|
3
|
+
## Get all webhooks
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
client.webhooks
|
7
|
+
```
|
8
|
+
|
9
|
+
## Get single webhook
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
client.webhook(1)
|
13
|
+
```
|
14
|
+
|
15
|
+
## Create webhook
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
client.create_webhook('example.com', 'event')
|
19
|
+
```
|
20
|
+
|
21
|
+
## Update webhook
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
client.update_webhook(1, event: 'event')
|
25
|
+
```
|
26
|
+
|
27
|
+
## Remove webhook
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
client.delete_webhook(1)
|
31
|
+
```
|
data/lib/mailerlite/client.rb
CHANGED
@@ -5,6 +5,7 @@ require 'mailerlite/clients/campaigns'
|
|
5
5
|
require 'mailerlite/clients/fields'
|
6
6
|
require 'mailerlite/clients/groups'
|
7
7
|
require 'mailerlite/clients/subscribers'
|
8
|
+
require 'mailerlite/clients/webhooks'
|
8
9
|
|
9
10
|
module MailerLite
|
10
11
|
# Wrapper class for all actions.
|
@@ -13,6 +14,7 @@ module MailerLite
|
|
13
14
|
include MailerLite::Clients::Fields
|
14
15
|
include MailerLite::Clients::Groups
|
15
16
|
include MailerLite::Clients::Subscribers
|
17
|
+
include MailerLite::Clients::Webhooks
|
16
18
|
|
17
19
|
# Initialize client.
|
18
20
|
#
|
@@ -4,7 +4,7 @@ module MailerLite
|
|
4
4
|
module Campaigns
|
5
5
|
# Create campaign where you will use your custom HTML template
|
6
6
|
#
|
7
|
-
# @see https://developers.mailerlite.com/
|
7
|
+
# @see https://developers.mailerlite.com/v2/reference#campaigns
|
8
8
|
#
|
9
9
|
# @param options [Hash] A customizable set of options.
|
10
10
|
# @option options [String] :type Type of campaign. Available values:
|
@@ -24,7 +24,7 @@ module MailerLite
|
|
24
24
|
|
25
25
|
# Upload your HTML template to created campaign
|
26
26
|
#
|
27
|
-
# @see https://developers.mailerlite.com/
|
27
|
+
# @see https://developers.mailerlite.com/v2/reference#put-custom-content-to-campaign
|
28
28
|
#
|
29
29
|
# @param id [Integer] ID of campaign
|
30
30
|
# @param options [Hash] A customizable set of options.
|
@@ -40,7 +40,7 @@ module MailerLite
|
|
40
40
|
|
41
41
|
# Send, schedule or cancel campaign
|
42
42
|
#
|
43
|
-
# @see https://developers.mailerlite.com/
|
43
|
+
# @see https://developers.mailerlite.com/v2/reference#campaign-actions-and-triggers
|
44
44
|
#
|
45
45
|
# @param id [Integer] ID of campaign
|
46
46
|
# @param action [String] Action type. Possible values: send, cancel
|
@@ -53,7 +53,7 @@ module MailerLite
|
|
53
53
|
# Returns all campaigns you have in your account by :status which is
|
54
54
|
# required. Also basic summary for each campaign including the ID.
|
55
55
|
#
|
56
|
-
# @see
|
56
|
+
# @see https://developers.mailerlite.com/v2/reference#campaigns-by-type
|
57
57
|
#
|
58
58
|
# @param status [String] possible values: 'sent', 'outbox', 'draft'
|
59
59
|
# no value means 'sent'
|
@@ -65,6 +65,8 @@ module MailerLite
|
|
65
65
|
|
66
66
|
# Remove a campaign.
|
67
67
|
#
|
68
|
+
# @see https://developers.mailerlite.com/v2/reference#delete-campaign
|
69
|
+
#
|
68
70
|
# @param id [Integer] id of campaign
|
69
71
|
#
|
70
72
|
# @return [Boolean] Response from API.
|
@@ -4,7 +4,7 @@ module MailerLite
|
|
4
4
|
module Fields
|
5
5
|
# Get subscriber fields of account
|
6
6
|
#
|
7
|
-
# @see https://developers.mailerlite.com/
|
7
|
+
# @see https://developers.mailerlite.com/v2/reference#all-fields
|
8
8
|
#
|
9
9
|
# @return [Array] Response from API.
|
10
10
|
def fields
|
@@ -13,7 +13,7 @@ module MailerLite
|
|
13
13
|
|
14
14
|
# Create new custom field in account
|
15
15
|
#
|
16
|
-
# @see https://developers.mailerlite.com/
|
16
|
+
# @see https://developers.mailerlite.com/v2/reference#create-field
|
17
17
|
#
|
18
18
|
# @param options [Hash] A customizable set of options.
|
19
19
|
# @option options [String] :title Title of field
|
@@ -27,7 +27,7 @@ module MailerLite
|
|
27
27
|
|
28
28
|
# Update custom field in account
|
29
29
|
#
|
30
|
-
# @see https://developers.mailerlite.com/
|
30
|
+
# @see https://developers.mailerlite.com/v2/reference#update-field
|
31
31
|
#
|
32
32
|
# @param id [Integer] ID of field.
|
33
33
|
# @param options [Hash] A customizable set of options.
|
@@ -40,7 +40,7 @@ module MailerLite
|
|
40
40
|
|
41
41
|
# Remove custom field from account
|
42
42
|
#
|
43
|
-
# @see https://developers.mailerlite.com/
|
43
|
+
# @see https://developers.mailerlite.com/v2/reference#remove-field
|
44
44
|
#
|
45
45
|
# @param id [Integer] ID of field.
|
46
46
|
#
|
@@ -4,7 +4,7 @@ module MailerLite
|
|
4
4
|
module Groups
|
5
5
|
# Get list of groups
|
6
6
|
#
|
7
|
-
# @see https://developers.mailerlite.com/
|
7
|
+
# @see https://developers.mailerlite.com/v2/reference#groups
|
8
8
|
#
|
9
9
|
# @return [Array] Response from API.
|
10
10
|
def groups
|
@@ -13,7 +13,7 @@ module MailerLite
|
|
13
13
|
|
14
14
|
# Get single group by ID
|
15
15
|
#
|
16
|
-
# @see
|
16
|
+
# @see https://developers.mailerlite.com/v2/reference#single-group
|
17
17
|
#
|
18
18
|
# @param id [Integer] Id of group
|
19
19
|
#
|
@@ -25,7 +25,7 @@ module MailerLite
|
|
25
25
|
|
26
26
|
# Create new group
|
27
27
|
#
|
28
|
-
# @see
|
28
|
+
# @see https://developers.mailerlite.com/v2/reference#create-group
|
29
29
|
#
|
30
30
|
# @param name [String] Name of your group
|
31
31
|
#
|
@@ -34,13 +34,21 @@ module MailerLite
|
|
34
34
|
connection.post('groups', name: name)
|
35
35
|
end
|
36
36
|
|
37
|
+
# Update group
|
38
|
+
#
|
39
|
+
# @see https://developers.mailerlite.com/v2/reference#rename-group
|
40
|
+
#
|
41
|
+
# @param [Integer] Id of group
|
42
|
+
# @param options [Hash] Request options
|
43
|
+
#
|
44
|
+
# @return [Hash] Response from API.
|
37
45
|
def update_group(id, options = {})
|
38
46
|
connection.put("groups/#{id}", options)
|
39
47
|
end
|
40
48
|
|
41
49
|
# Remove group
|
42
50
|
#
|
43
|
-
# @see
|
51
|
+
# @see https://developers.mailerlite.com/v2/reference#delete-group
|
44
52
|
#
|
45
53
|
# @param [Integer] Id of group
|
46
54
|
#
|
@@ -51,7 +59,7 @@ module MailerLite
|
|
51
59
|
|
52
60
|
# Get all subscribers in a specified group
|
53
61
|
#
|
54
|
-
# @see
|
62
|
+
# @see https://developers.mailerlite.com/v2/reference#subscribers-in-a-group
|
55
63
|
#
|
56
64
|
# @param group_id [Integer] Id of group
|
57
65
|
# @param options [Hash] Request options
|
@@ -63,7 +71,7 @@ module MailerLite
|
|
63
71
|
|
64
72
|
# Add new single subscriber to specified group
|
65
73
|
#
|
66
|
-
# @see
|
74
|
+
# @see https://developers.mailerlite.com/v2/reference#add-single-subscriber
|
67
75
|
#
|
68
76
|
# @param group_id [Integer] Id of group
|
69
77
|
# @param options [Hash] Request options
|
@@ -75,7 +83,7 @@ module MailerLite
|
|
75
83
|
|
76
84
|
# Add many new subscribers to specified group at once
|
77
85
|
#
|
78
|
-
# @see
|
86
|
+
# @see https://developers.mailerlite.com/v2/reference#add-many-subscribers
|
79
87
|
#
|
80
88
|
# @param group_id [Integer] Id of group
|
81
89
|
# @param subscribers [Array] Array of hash each indicates a subscriber
|
@@ -89,7 +97,7 @@ module MailerLite
|
|
89
97
|
|
90
98
|
# Remove single subscriber from specified group
|
91
99
|
#
|
92
|
-
# @see
|
100
|
+
# @see https://developers.mailerlite.com/v2/reference#remove-subscriber
|
93
101
|
#
|
94
102
|
# @param group_id [Integer|String] Id of group
|
95
103
|
# @param subscriber_id_or_email [Array] Id or email of subscriber
|
@@ -4,7 +4,7 @@ module MailerLite
|
|
4
4
|
module Subscribers
|
5
5
|
# Get single subscriber
|
6
6
|
#
|
7
|
-
# @see https://developers.mailerlite.com/
|
7
|
+
# @see https://developers.mailerlite.com/v2/reference#single-subscriber
|
8
8
|
#
|
9
9
|
# @param identifier [Integer,String] ID or email of subscriber.
|
10
10
|
#
|
@@ -15,7 +15,7 @@ module MailerLite
|
|
15
15
|
|
16
16
|
# Update single subscriber
|
17
17
|
#
|
18
|
-
# @see https://developers.mailerlite.com/
|
18
|
+
# @see https://developers.mailerlite.com/v2/reference#update-subscriber
|
19
19
|
#
|
20
20
|
# @param identifier [Integer,String] ID or email of subscriber.
|
21
21
|
# @param options [Hash] A customizable set of options.
|
@@ -32,7 +32,7 @@ module MailerLite
|
|
32
32
|
|
33
33
|
# Search for subscribers
|
34
34
|
#
|
35
|
-
# @see https://developers.mailerlite.com/
|
35
|
+
# @see https://developers.mailerlite.com/v2/reference#search-for-subscribers
|
36
36
|
#
|
37
37
|
# @param query [String] Search query
|
38
38
|
# @param options [Hash] A customizable set of options.
|
@@ -48,7 +48,7 @@ module MailerLite
|
|
48
48
|
|
49
49
|
# Get groups subscriber belongs to
|
50
50
|
#
|
51
|
-
# @see https://developers.mailerlite.com/
|
51
|
+
# @see https://developers.mailerlite.com/v2/reference#groups-subscriber-belongs-to
|
52
52
|
#
|
53
53
|
# @param identifier [Integer,String] ID or email of subscriber.
|
54
54
|
#
|
@@ -59,7 +59,7 @@ module MailerLite
|
|
59
59
|
|
60
60
|
# Get activity (clicks, opens, etc) of selected subscriber
|
61
61
|
#
|
62
|
-
# @see https://developers.mailerlite.com/
|
62
|
+
# @see https://developers.mailerlite.com/v2/reference#activity-of-single-subscriber
|
63
63
|
#
|
64
64
|
# @param identifier [Integer,String] ID or email of subscriber.
|
65
65
|
#
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module MailerLite
|
2
|
+
module Clients
|
3
|
+
# MailerLite Webhooks
|
4
|
+
module Webhooks
|
5
|
+
# Get webhooks
|
6
|
+
#
|
7
|
+
# @see https://developers.mailerlite.com/v2/reference#webhooks-1
|
8
|
+
#
|
9
|
+
# @return [Hash] Response from API.
|
10
|
+
def webhooks
|
11
|
+
connection.get('webhooks')
|
12
|
+
end
|
13
|
+
|
14
|
+
# Get single webhook
|
15
|
+
#
|
16
|
+
# @see https://developers.mailerlite.com/v2/reference#webhooksid
|
17
|
+
#
|
18
|
+
# @param id [Integer] ID of a webhook
|
19
|
+
#
|
20
|
+
# @return [Hash] Response from API.
|
21
|
+
def webhook(id)
|
22
|
+
connection.get("webhooks/#{id}")
|
23
|
+
end
|
24
|
+
|
25
|
+
# Create webhook
|
26
|
+
#
|
27
|
+
# @see https://developers.mailerlite.com/v2/reference#webhooks-2
|
28
|
+
#
|
29
|
+
# @param url [String] Your URL where callbacks are sent.
|
30
|
+
# @param event [String] Subscribed event.
|
31
|
+
#
|
32
|
+
# @return [Hash] Response from API.
|
33
|
+
def create_webhook(url, event)
|
34
|
+
connection.post('webhooks', url: url, event: event)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Update webhook
|
38
|
+
#
|
39
|
+
# @see https://developers.mailerlite.com/v2/reference#webhooksid-1
|
40
|
+
#
|
41
|
+
# @param id [Integer] ID of webhook.
|
42
|
+
# @param options [Hash] A customizable set of options.
|
43
|
+
# @option options [String] :url Your URL where callbacks are sent
|
44
|
+
# @option options [String] :event Subscribed event
|
45
|
+
#
|
46
|
+
# @return [Hash] Response from API.
|
47
|
+
def update_webhook(id, options = {})
|
48
|
+
connection.put("webhooks/#{id}", options)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Remove webhook
|
52
|
+
#
|
53
|
+
# @see https://developers.mailerlite.com/v2/reference#webhooksid-2
|
54
|
+
#
|
55
|
+
# @param id [Integer] ID of webhook.
|
56
|
+
#
|
57
|
+
# @return [Hash] Response from API.
|
58
|
+
def delete_webhook(id)
|
59
|
+
connection.delete("webhooks/#{id}")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/mailerlite/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailerlite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justas Palumickas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -106,12 +106,14 @@ files:
|
|
106
106
|
- examples/fields.md
|
107
107
|
- examples/groups.md
|
108
108
|
- examples/subscribers.md
|
109
|
+
- examples/webhooks.md
|
109
110
|
- lib/mailerlite.rb
|
110
111
|
- lib/mailerlite/client.rb
|
111
112
|
- lib/mailerlite/clients/campaigns.rb
|
112
113
|
- lib/mailerlite/clients/fields.rb
|
113
114
|
- lib/mailerlite/clients/groups.rb
|
114
115
|
- lib/mailerlite/clients/subscribers.rb
|
116
|
+
- lib/mailerlite/clients/webhooks.rb
|
115
117
|
- lib/mailerlite/configuration.rb
|
116
118
|
- lib/mailerlite/connection.rb
|
117
119
|
- lib/mailerlite/error.rb
|
@@ -142,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
144
|
version: '0'
|
143
145
|
requirements: []
|
144
146
|
rubyforge_project:
|
145
|
-
rubygems_version: 2.6.
|
147
|
+
rubygems_version: 2.6.12
|
146
148
|
signing_key:
|
147
149
|
specification_version: 4
|
148
150
|
summary: Ruby wrapper for MailerLite API v2
|