sendpulse 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -110
- data/lib/sendpulse/email_service/mailing_list.rb +47 -0
- data/lib/sendpulse/version.rb +1 -1
- data/spec/lib/sendpulse/{mailing_list_spec.rb → email_service/mailing_list_spec.rb} +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +5 -5
- data/lib/sendpulse/mailing_list.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45e723926ac1c3cfea8a73810dec40bd439df1f8
|
4
|
+
data.tar.gz: 0b44ee6246a676772dc86c45fd0dbfa3c53afcf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9344fa6c976b5ded44ca09198615b6bf86b25c39102957c8af93e8f7c55314ac712f607df87a2fbfb0e6446d30f657f174ba21aed6682bcf0681c58a76c1e5bf
|
7
|
+
data.tar.gz: e0a1e977e21981b8f4f5f658a82a221eed32e9e85acf1f5ba3e6722c6f1db050ef92b58a92be2974055bb36a0743be3479db2a7d8372ffb76aafee3001220310
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,6 +6,9 @@ Ruby client for [SendPulse](https://sendpulse.com/)
|
|
6
6
|
|
7
7
|
## Usage
|
8
8
|
|
9
|
+
### Email Service
|
10
|
+
1. [Mailing lists](https://github.com/yogahp/SendPulse/wiki/Mailing-lists)
|
11
|
+
|
9
12
|
### SMTP
|
10
13
|
#### Send Email
|
11
14
|
|
@@ -41,116 +44,6 @@ sendpulse_smtp = SendPulse::Smtp.new(your_client_id, your_client_secret, 'https'
|
|
41
44
|
sendpulse_smtp.retrieve_emails
|
42
45
|
```
|
43
46
|
|
44
|
-
### Mailing List
|
45
|
-
#### Creating a mailing list
|
46
|
-
|
47
|
-
```ruby
|
48
|
-
require 'sendpulse/mailing_list'
|
49
|
-
|
50
|
-
sendpulse_mailinglist = SendPulse::MailingList.new(your_client_id, your_client_secret, 'https', nil)
|
51
|
-
sendpulse_mailinglist.create("Mailing List Title")
|
52
|
-
```
|
53
|
-
|
54
|
-
#### Editing a mailing list
|
55
|
-
|
56
|
-
```ruby
|
57
|
-
require 'sendpulse/mailing_list'
|
58
|
-
|
59
|
-
sendpulse_mailinglist = SendPulse::MailingList.new(your_client_id, your_client_secret, 'https', nil)
|
60
|
-
sendpulse_mailinglist.update({ id: id, name: "New mailing list name" })
|
61
|
-
```
|
62
|
-
|
63
|
-
#### Retrieving a list of mailing list
|
64
|
-
|
65
|
-
```ruby
|
66
|
-
require 'sendpulse/mailing_list'
|
67
|
-
|
68
|
-
sendpulse_mailinglist = SendPulse::MailingList.new(your_client_id, your_client_secret, 'https', nil)
|
69
|
-
sendpulse_mailinglist.list({ limit: 10, offset: 10 })
|
70
|
-
```
|
71
|
-
|
72
|
-
#### Retrieving mailing list information
|
73
|
-
|
74
|
-
```ruby
|
75
|
-
require 'sendpulse/mailing_list'
|
76
|
-
|
77
|
-
sendpulse_mailinglist = SendPulse::MailingList.new(your_client_id, your_client_secret, 'https', nil)
|
78
|
-
sendpulse_mailinglist.get(mailinglist_id)
|
79
|
-
```
|
80
|
-
|
81
|
-
#### Retrieving a list of emails from a mailing list
|
82
|
-
|
83
|
-
```ruby
|
84
|
-
require 'sendpulse/mailing_list'
|
85
|
-
|
86
|
-
sendpulse_mailinglist = SendPulse::MailingList.new(your_client_id, your_client_secret, 'https', nil)
|
87
|
-
sendpulse_mailinglist.get_emails(mailinglist_id)
|
88
|
-
```
|
89
|
-
|
90
|
-
#### Adding emails to a mailing list
|
91
|
-
|
92
|
-
```ruby
|
93
|
-
require 'sendpulse/mailing_list'
|
94
|
-
|
95
|
-
sendpulse_mailinglist = SendPulse::MailingList.new(your_client_id, your_client_secret, 'https', nil)
|
96
|
-
sendpulse_mailinglist.add_emails(
|
97
|
-
{
|
98
|
-
id: id,
|
99
|
-
emails: [
|
100
|
-
{
|
101
|
-
"email": "test1@gmail.com",
|
102
|
-
"variables": {
|
103
|
-
"variable1": "value1",
|
104
|
-
"variable2": "value2"
|
105
|
-
}
|
106
|
-
},
|
107
|
-
{
|
108
|
-
"email": "test1@gmail.com",
|
109
|
-
"variables": {
|
110
|
-
"variable1": "value1",
|
111
|
-
"variable2": "value2"
|
112
|
-
}
|
113
|
-
}
|
114
|
-
]
|
115
|
-
}
|
116
|
-
)
|
117
|
-
```
|
118
|
-
|
119
|
-
#### Deleting emails from a mailing list
|
120
|
-
|
121
|
-
```ruby
|
122
|
-
require 'sendpulse/mailing_list'
|
123
|
-
|
124
|
-
sendpulse_mailinglist = SendPulse::MailingList.new(your_client_id, your_client_secret, 'https', nil)
|
125
|
-
sendpulse_mailinglist.delete_emails({ id: id, emails: ["test1@gmail.com"] })
|
126
|
-
```
|
127
|
-
|
128
|
-
#### Retrieving information for specific email address from a mailing list
|
129
|
-
|
130
|
-
```ruby
|
131
|
-
require 'sendpulse/mailing_list'
|
132
|
-
|
133
|
-
sendpulse_mailinglist = SendPulse::MailingList.new(your_client_id, your_client_secret, 'https', nil)
|
134
|
-
sendpulse_mailinglist.get_email({ id: id, email: "test1@gmail.com" })
|
135
|
-
```
|
136
|
-
|
137
|
-
#### Erasing a mailing list
|
138
|
-
|
139
|
-
```ruby
|
140
|
-
require 'sendpulse/mailing_list'
|
141
|
-
|
142
|
-
sendpulse_mailinglist = SendPulse::MailingList.new(your_client_id, your_client_secret, 'https', nil)
|
143
|
-
sendpulse_mailinglist.delete(id)
|
144
|
-
```
|
145
|
-
|
146
|
-
#### Calculating the cost of a campaign carried out by a mailing list
|
147
|
-
|
148
|
-
```ruby
|
149
|
-
require 'sendpulse/mailing_list'
|
150
|
-
|
151
|
-
sendpulse_mailinglist = SendPulse::MailingList.new(your_client_id, your_client_secret, 'https', nil)
|
152
|
-
sendpulse_mailinglist.cost(id)
|
153
|
-
```
|
154
47
|
|
155
48
|
[Here](https://sendpulse.com/integrations/api) is SendPulse API specification.
|
156
49
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'sendpulse/api'
|
2
|
+
|
3
|
+
module SendPulse
|
4
|
+
module EmailService
|
5
|
+
class MailingList < SendPulse::Api
|
6
|
+
def create(list_name)
|
7
|
+
send_request('addressbooks', 'POST', { bookName: list_name })
|
8
|
+
end
|
9
|
+
|
10
|
+
def update(params)
|
11
|
+
send_request("addressbooks/#{params[:id]}", 'PUT', params)
|
12
|
+
end
|
13
|
+
|
14
|
+
def list(params = {})
|
15
|
+
send_request('addressbooks', 'GET', params)
|
16
|
+
end
|
17
|
+
|
18
|
+
def get(id)
|
19
|
+
send_request("addressbooks/#{id}", 'GET')
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_emails(params)
|
23
|
+
send_request("addressbooks/#{params[:id]}/emails", 'POST', { id: params[:id], emails: serialize(params[:emails]) })
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_emails(params)
|
27
|
+
send_request("addressbooks/#{params[:id]}/emails", 'GET', params)
|
28
|
+
end
|
29
|
+
|
30
|
+
def delete_emails(params)
|
31
|
+
send_request("addressbooks/#{params[:id]}/emails", 'DELETE', { emails: serialize(params[:emails]) })
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_email(params)
|
35
|
+
send_request("addressbooks/#{params[:id]}/emails/#{params[:email]}", 'GET', params)
|
36
|
+
end
|
37
|
+
|
38
|
+
def delete(id)
|
39
|
+
send_request("addressbooks/#{id}", 'DELETE')
|
40
|
+
end
|
41
|
+
|
42
|
+
def cost(id)
|
43
|
+
send_request("addressbooks/#{id}/cost", 'GET')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/sendpulse/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sendpulse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoga Hapriana
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -96,12 +96,12 @@ files:
|
|
96
96
|
- Rakefile
|
97
97
|
- SendPulse.gemspec
|
98
98
|
- lib/sendpulse/api.rb
|
99
|
+
- lib/sendpulse/email_service/mailing_list.rb
|
99
100
|
- lib/sendpulse/host.rb
|
100
|
-
- lib/sendpulse/mailing_list.rb
|
101
101
|
- lib/sendpulse/smtp.rb
|
102
102
|
- lib/sendpulse/version.rb
|
103
103
|
- spec/lib/sendpulse/api_spec.rb
|
104
|
-
- spec/lib/sendpulse/mailing_list_spec.rb
|
104
|
+
- spec/lib/sendpulse/email_service/mailing_list_spec.rb
|
105
105
|
- spec/lib/sendpulse/smtp_spec.rb
|
106
106
|
- spec/spec_helper.rb
|
107
107
|
homepage: https://github.com/yogahp/SendPulse
|
@@ -130,6 +130,6 @@ specification_version: 4
|
|
130
130
|
summary: Client to http://sendpulse.com/ API.
|
131
131
|
test_files:
|
132
132
|
- spec/lib/sendpulse/api_spec.rb
|
133
|
-
- spec/lib/sendpulse/mailing_list_spec.rb
|
133
|
+
- spec/lib/sendpulse/email_service/mailing_list_spec.rb
|
134
134
|
- spec/lib/sendpulse/smtp_spec.rb
|
135
135
|
- spec/spec_helper.rb
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'sendpulse/api'
|
2
|
-
|
3
|
-
module SendPulse
|
4
|
-
class MailingList < SendPulse::Api
|
5
|
-
def create(list_name)
|
6
|
-
send_request('addressbooks', 'POST', { bookName: list_name })
|
7
|
-
end
|
8
|
-
|
9
|
-
def update(params)
|
10
|
-
send_request("addressbooks/#{params[:id]}", 'PUT', params)
|
11
|
-
end
|
12
|
-
|
13
|
-
def list(params = {})
|
14
|
-
send_request('addressbooks', 'GET', params)
|
15
|
-
end
|
16
|
-
|
17
|
-
def get(id)
|
18
|
-
send_request("addressbooks/#{id}", 'GET')
|
19
|
-
end
|
20
|
-
|
21
|
-
def add_emails(params)
|
22
|
-
send_request("addressbooks/#{params[:id]}/emails", 'POST', { id: params[:id], emails: serialize(params[:emails]) })
|
23
|
-
end
|
24
|
-
|
25
|
-
def get_emails(params)
|
26
|
-
send_request("addressbooks/#{params[:id]}/emails", 'GET', params)
|
27
|
-
end
|
28
|
-
|
29
|
-
def delete_emails(params)
|
30
|
-
send_request("addressbooks/#{params[:id]}/emails", 'DELETE', { emails: serialize(params[:emails]) })
|
31
|
-
end
|
32
|
-
|
33
|
-
def get_email(params)
|
34
|
-
send_request("addressbooks/#{params[:id]}/emails/#{params[:email]}", 'GET', params)
|
35
|
-
end
|
36
|
-
|
37
|
-
def delete(id)
|
38
|
-
send_request("addressbooks/#{id}", 'DELETE')
|
39
|
-
end
|
40
|
-
|
41
|
-
def cost(id)
|
42
|
-
send_request("addressbooks/#{id}/cost", 'GET')
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|