mailersend-ruby 0.1.0 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb6199cff0a78e0716fd71e505603272ec11f5be3e1807932068fd0347ffe8c6
4
- data.tar.gz: 60f799a1d817d792e2c0f90d94ed5e4c5b0cf1d27df00d91b5923d31574adfad
3
+ metadata.gz: 9ac665fe97374d246c31952ff4e34a63c0a302e2833186a27750424450ebf332
4
+ data.tar.gz: 121fc72092e62063cfaa753e72272c4ff03b2038ff5eec7eb7431884e3b6995a
5
5
  SHA512:
6
- metadata.gz: 2b3154b1ef480050c9509602e0f0192b0b55fe97af546d80f774d504fd4b28271df747f30e99121fcc4c94e2e16951d09692ef7f8559754c079d948a6bef21cf
7
- data.tar.gz: fed0dbf67eaf84f36c77918a245dadfa52e6a2aedee915e5ba0a9803f4b7d81b625ae90798ef079aac3cc6c77227aa6cb66441693a46c6b10bb8127720556237
6
+ metadata.gz: 395e71b85cff75f893a0f7f522d70b059ee893b06bece2ed42965587cce2cdb120c1bb822999d3d55ee33792e1e1058c83f504737ef2c05136c9249e1a2410c7
7
+ data.tar.gz: 90805ef350b1ec3f3efccefe12e5fb05f16d2ac8035e545e40811bb6bf3cf37497eee215394198d20644ef421d278735259f0bbfe64745c173c868bb7e862659
data/.env.example CHANGED
@@ -1 +1 @@
1
- API_TOKEN="Bearer superlongkey"
1
+ API_TOKEN="superlongkey"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  ## [Released]
2
2
 
3
+ ## [0.1.5] - 2021-06-15
4
+
5
+ - Fixed arguments error in Domains list
6
+
7
+ ## [0.1.4] - 2021-06-15
8
+
9
+ - Fixed Domains init
10
+
11
+ ## [0.1.3] - 2021-06-14
12
+
13
+ - Updated gem description
14
+
15
+ ## [0.1.2] - 2021-06-14
16
+
17
+ - Fixed activity and tokens endpoints.
18
+
19
+ ## [0.1.1] - 2021-06-14
20
+
21
+ - Updated token format so you don't have to include `Bearer` in env variable.
22
+
3
23
  ## [0.1.0] - 2021-06-14
4
24
 
5
25
  - Initial release
data/README.md CHANGED
@@ -9,8 +9,12 @@ MailerSend Ruby SDK
9
9
  - [Usage](#usage)
10
10
  - [Email](#email)
11
11
  - [Send an email](#send-an-email)
12
- - [Send and email with CC and BCC](#send-and-email-with-cc-and-bcc)
13
- - [Send a templated email](#send-a-templated-email)
12
+ - [Add CC, BCC recipients](#add-cc-bcc-recipients)
13
+ - [Send a template-based email](#send-a-template-based-email)
14
+ - [Tokens](#tokens)
15
+ - [Create a token](#create-a-token)
16
+ - [Update a token](#update-a-token)
17
+ - [Delete a token](#delete-a-token)
14
18
  - [Advanced personalization](#advanced-personalization)
15
19
  - [Simple personalization](#simple-personalization)
16
20
  - [Send email with attachment](#send-email-with-attachment)
@@ -33,10 +37,6 @@ MailerSend Ruby SDK
33
37
  - [Get recipients](#get-recipients)
34
38
  - [Get a single recipient](#get-a-single-recipient)
35
39
  - [Delete a recipient](#delete-a-recipient)
36
- - [Tokens](#tokens)
37
- - [Create a token](#create-a-token)
38
- - [Update a token](#update-a-token)
39
- - [Delete a token](#delete-a-token)
40
40
  - [Webhooks](#webhooks)
41
41
  - [List webhooks](#list-webhooks)
42
42
  - [Get a webhook](#get-a-webhook)
@@ -81,7 +81,7 @@ ms_email.add_html("<b>Time is money, money is power, power is pizza, and pizza i
81
81
  ms_email.send
82
82
  ```
83
83
 
84
- ### Send and email with CC and BCC
84
+ ### Add CC, BCC recipients
85
85
 
86
86
  ```ruby
87
87
  require "mailersend-ruby"
@@ -103,7 +103,7 @@ ms_email.add_html("<b>Time is money, money is power, power is pizza, and pizza i
103
103
  ms_email.send
104
104
  ```
105
105
 
106
- ### Send a templated email
106
+ ### Send a template-based email
107
107
 
108
108
  ```ruby
109
109
  require "mailersend-ruby"
@@ -122,6 +122,32 @@ ms_email.add_template_id(12415125)
122
122
  ms_email.send
123
123
  ```
124
124
 
125
+ ## Tokens
126
+
127
+ ### Create a token
128
+ ```ruby
129
+ require "mailersend-ruby"
130
+
131
+ ms_tokens = Mailersend::Tokens.new
132
+ ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ])
133
+ ```
134
+
135
+ ### Update a token
136
+ ```ruby
137
+ require "mailersend-ruby"
138
+
139
+ ms_tokens = Mailersend::Tokens.new
140
+ ms_tokens.update(token_id: "d2220fx04", status: "paused")
141
+ ```
142
+
143
+ ### Delete a token
144
+ ```ruby
145
+ require "mailersend-ruby"
146
+
147
+ ms_tokens = Mailersend::Tokens.new
148
+ ms_tokens.delete(token_id: "d2220fx04")
149
+ ```
150
+
125
151
  ### Advanced personalization
126
152
 
127
153
  ```ruby
@@ -132,26 +158,15 @@ ms_email = Mailersend::Email.new
132
158
 
133
159
  # Add parameters
134
160
  ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
135
- ms_email.add_recipients("email" => "leslie@parksandrec.com", "name" => "Leslie")
136
161
  ms_email.add_from("email" => "april@parksandrec.com", "name" => "April")
137
- ms_email.add_subject("Time")
138
- ms_email.add_text("Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.")
139
- ms_email.add_html("<b>Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.</b>")
162
+ ms_email.add_subject("Time {{ test }}")
163
+ ms_email.add_text("{{ test }}Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.")
164
+ ms_email.add_html("<b>{{ test }}Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.</b>")
140
165
 
141
166
  personalization = {
142
- "email": "test@test.com",
143
- "data": {
144
- "var": "value",
145
- "boolean": true,
146
- "object": {
147
- "key": "object-value"
148
- },
149
- "number": 2,
150
- "array": [
151
- 1,
152
- 2,
153
- 3
154
- ]
167
+ email: 'ron@parksandrec.com',
168
+ data: {
169
+ test: 'Test Value'
155
170
  }
156
171
  }
157
172
 
@@ -170,18 +185,17 @@ ms_email = Mailersend::Email.new
170
185
 
171
186
  # Add parameters
172
187
  ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
173
- ms_email.add_recipients("email" => "leslie@parksandrec.com", "name" => "Leslie")
174
188
  ms_email.add_from("email" => "april@parksandrec.com", "name" => "April")
175
- ms_email.add_subject("Time")
176
- ms_email.add_text("Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.")
177
- ms_email.add_html("<b>Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.</b>")
189
+ ms_email.add_subject("Time {$test}")
190
+ ms_email.add_text("{$test} Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.")
191
+ ms_email.add_html("<b>{$test} Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.</b>")
178
192
 
179
193
  variables = {
180
- "email": "test@test.com",
181
- "substitutions": [
194
+ email: 'ron@parksandrec.com',
195
+ substitutions: [
182
196
  {
183
- "var": "test",
184
- "value": "test"
197
+ var: 'test',
198
+ value: 'Test Value'
185
199
  }
186
200
  ]
187
201
  }
@@ -235,7 +249,7 @@ ms_activity.get(domain_id: "xxx2241ll", page: 3, limit: 5, date_from: 1620643567
235
249
  require "mailersend-ruby"
236
250
 
237
251
  ms_analytics = Mailersend::Analytics.new
238
- ms_analytics.date(date_from: 1620643567, date_to: 1623321967, events: %w[sent queued]))
252
+ ms_analytics.date(date_from: 1620643567, date_to: 1623321967, events: %w[sent queued])
239
253
  ```
240
254
 
241
255
  ### Opens by country
@@ -352,32 +366,6 @@ ms_recipients = Mailersend::Recipients.new
352
366
  ms_recipients.delete(recipient_id: "id124")
353
367
  ```
354
368
 
355
- ## Tokens
356
-
357
- ### Create a token
358
- ```ruby
359
- require "mailersend-ruby"
360
-
361
- ms_tokens = Mailersend::Tokens.new
362
- ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ])
363
- ```
364
-
365
- ### Update a token
366
- ```ruby
367
- require "mailersend-ruby"
368
-
369
- ms_tokens = Mailersend::Tokens.new
370
- ms_tokens.update(token_id: "d2220fx04", name: "Very nice token", scopes: %w[ email_full domains_read activity_read ])
371
- ```
372
-
373
- ### Delete a token
374
- ```ruby
375
- require "mailersend-ruby"
376
-
377
- ms_tokens = Mailersend::Tokens.new
378
- ms_tokens.delete(token_id: "d2220fx04")
379
- ```
380
-
381
369
  ## Webhooks
382
370
 
383
371
  ### List webhooks
@@ -424,4 +412,4 @@ The official documentation is at [https://developers.mailersend.com](https://dev
424
412
 
425
413
  # License
426
414
 
427
- [The MIT License (MIT)](LICENSE)
415
+ [The MIT License (MIT)](LICENSE)
@@ -27,7 +27,7 @@ module Mailersend
27
27
  date_to: date_to
28
28
  }
29
29
 
30
- response = client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/analytics/#{domain_id}",
30
+ response = client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/activity/#{domain_id}",
31
31
  query: URI.encode_www_form(hash.compact)))
32
32
  puts response
33
33
  end
@@ -21,7 +21,7 @@ module Mailersend
21
21
  def http
22
22
  HTTP
23
23
  .timeout(connect: 15, read: 30)
24
- .auth(@api_token)
24
+ .auth("Bearer #{@api_token}")
25
25
  .headers("User-Agent" => "MailerSend-client-ruby/1.0.0",
26
26
  "Accept" => "application/json")
27
27
  end
@@ -9,7 +9,7 @@ module Mailersend
9
9
  :limit,
10
10
  :verified
11
11
 
12
- def initialize(client = Mailersend.client.new)
12
+ def initialize(client = Mailersend::Client.new)
13
13
  @client = client
14
14
  @domain_id = domain_id
15
15
  @page = page
@@ -17,7 +17,7 @@ module Mailersend
17
17
  @verified = verified
18
18
  end
19
19
 
20
- def list
20
+ def list(domain_id:, page: nil, limit: nil, verified: nil)
21
21
  hash = {
22
22
  "page" => page,
23
23
  "limit" => limit,
@@ -34,8 +34,8 @@ module Mailersend
34
34
  puts response
35
35
  end
36
36
 
37
- def delete(name:)
38
- response = client.http.delete("#{API_URL}/token/#{name}")
37
+ def delete(token_id:)
38
+ response = client.http.delete("#{API_URL}/token/#{token_id}")
39
39
  puts response
40
40
  end
41
41
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mailersend
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.5"
5
5
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ["info@mailersend.com"]
12
12
 
13
13
  spec.summary = "MailerSend's official Ruby SDK"
14
- spec.description = "MailerSend's official Ruby SDK. Interacts will all endpoints at MailerSend API."
14
+ spec.description = "MailerSend's official Ruby SDK. Interacts with all endpoints at MailerSend API."
15
15
  spec.homepage = "https://www.mailersend.com"
16
16
  spec.license = "MIT"
17
17
  spec.required_ruby_version = ">= 2.5.0"
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.metadata["homepage_uri"] = spec.homepage
22
22
  spec.metadata["source_code_uri"] = "https://github.com/mailersend/mailersend-ruby"
23
- spec.metadata["changelog_uri"] = "https://github.com/mailersend/mailersend-ruby/CHANGELOG.md"
23
+ spec.metadata["changelog_uri"] = "https://github.com/mailersend/mailersend-ruby/blob/main/CHANGELOG.md"
24
24
 
25
25
  spec.files = `git ls-files -z`.split("\x0")
26
26
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailersend-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikola Milojević
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-14 00:00:00.000000000 Z
11
+ date: 2021-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.10.1
111
- description: MailerSend's official Ruby SDK. Interacts will all endpoints at MailerSend
111
+ description: MailerSend's official Ruby SDK. Interacts with all endpoints at MailerSend
112
112
  API.
113
113
  email:
114
114
  - info@mailersend.com
@@ -149,7 +149,7 @@ metadata:
149
149
  allowed_push_host: https://rubygems.org
150
150
  homepage_uri: https://www.mailersend.com
151
151
  source_code_uri: https://github.com/mailersend/mailersend-ruby
152
- changelog_uri: https://github.com/mailersend/mailersend-ruby/CHANGELOG.md
152
+ changelog_uri: https://github.com/mailersend/mailersend-ruby/blob/main/CHANGELOG.md
153
153
  post_install_message:
154
154
  rdoc_options: []
155
155
  require_paths: