mailersend-ruby 0.1.2 → 0.1.7

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: 4d505ebb32c33458ffd673e60c82620b4938241f6759f45b12fefec0b3058ab5
4
- data.tar.gz: ac9b5c974cd4478afb658378770609f1936fda55a8441ee466f56cc337b8b58c
3
+ metadata.gz: d8014167f26531076478ce1a76efca2bff0769ff8857adcfe8a0c6c54ee27565
4
+ data.tar.gz: 659cd21b1a22e1c02b27813801fcddf72032250cf0875d180eb645080b250258
5
5
  SHA512:
6
- metadata.gz: 108c5201b2ebdb2f038903c9c2497c729edb3287ab099cca976d7269777f689c0d28bd512445dc8066a21a5215649e8df5cb9f3672e52f80bad6c72f250eea78
7
- data.tar.gz: c7df5c911d37ba748f64e1d71bfcec8e53432e9f9f5087aacc38731b540626f64d97b61da657b1aaf2e2b6f4fe7a44a7e12d4d7eba0c7f56c3a9ad0dab1bb8ed
6
+ metadata.gz: 9c873fdb29ca0960680da1a85e17c31b1e32f6d7bbb72f8520d78bf00f6d8baff1083607eca82b00522f2adf35b2eed59401f5015cd7199066d40b61819b0061
7
+ data.tar.gz: 693b330d3bc564f7b2ac06c5b1be086a0879cbb7d6b0bcbecc5ef0a1568210fd8b619d102c938e1b226ce89bd10773e96818377f3503b9da47c2b4d0d8307a0c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  ## [Released]
2
2
 
3
+ ## [0.1.6] - 2021-06-15
4
+
5
+ - Fixed small issues in Domains
6
+
7
+ ## [0.1.5] - 2021-06-15
8
+
9
+ - Fixed arguments error in Domains list
10
+
11
+ ## [0.1.4] - 2021-06-15
12
+
13
+ - Fixed Domains init
14
+
15
+ ## [0.1.3] - 2021-06-14
16
+
17
+ - Updated gem description
18
+
3
19
  ## [0.1.2] - 2021-06-14
4
20
 
5
21
  - Fixed activity and tokens endpoints.
data/README.md CHANGED
@@ -129,7 +129,7 @@ ms_email.send
129
129
  require "mailersend-ruby"
130
130
 
131
131
  ms_tokens = Mailersend::Tokens.new
132
- ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ])
132
+ ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ], domain_id: "yourdomainid")
133
133
  ```
134
134
 
135
135
  ### Update a token
@@ -158,26 +158,15 @@ ms_email = Mailersend::Email.new
158
158
 
159
159
  # Add parameters
160
160
  ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
161
- ms_email.add_recipients("email" => "leslie@parksandrec.com", "name" => "Leslie")
162
161
  ms_email.add_from("email" => "april@parksandrec.com", "name" => "April")
163
- ms_email.add_subject("Time")
164
- ms_email.add_text("Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.")
165
- 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>")
166
165
 
167
166
  personalization = {
168
- "email": "test@test.com",
169
- "data": {
170
- "var": "value",
171
- "boolean": true,
172
- "object": {
173
- "key": "object-value"
174
- },
175
- "number": 2,
176
- "array": [
177
- 1,
178
- 2,
179
- 3
180
- ]
167
+ email: 'ron@parksandrec.com',
168
+ data: {
169
+ test: 'Test Value'
181
170
  }
182
171
  }
183
172
 
@@ -196,18 +185,17 @@ ms_email = Mailersend::Email.new
196
185
 
197
186
  # Add parameters
198
187
  ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
199
- ms_email.add_recipients("email" => "leslie@parksandrec.com", "name" => "Leslie")
200
188
  ms_email.add_from("email" => "april@parksandrec.com", "name" => "April")
201
- ms_email.add_subject("Time")
202
- ms_email.add_text("Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.")
203
- 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>")
204
192
 
205
193
  variables = {
206
- "email": "test@test.com",
207
- "substitutions": [
194
+ email: 'ron@parksandrec.com',
195
+ substitutions: [
208
196
  {
209
- "var": "test",
210
- "value": "test"
197
+ var: 'test',
198
+ value: 'Test Value'
211
199
  }
212
200
  ]
213
201
  }
@@ -261,7 +249,7 @@ ms_activity.get(domain_id: "xxx2241ll", page: 3, limit: 5, date_from: 1620643567
261
249
  require "mailersend-ruby"
262
250
 
263
251
  ms_analytics = Mailersend::Analytics.new
264
- 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])
265
253
  ```
266
254
 
267
255
  ### Opens by country
@@ -308,7 +296,7 @@ ms_domains.list
308
296
  require "mailersend-ruby"
309
297
 
310
298
  ms_domains = Mailersend::Domains.new
311
- ms_domains.list(domain_id: "idofdomain12412")
299
+ ms_domains.single(domain_id: "idofdomain12412")
312
300
  ```
313
301
 
314
302
  ### Delete a domain
@@ -393,7 +381,7 @@ ms_webhooks.list(domain_id: "xxx2241ll")
393
381
  require "mailersend-ruby"
394
382
 
395
383
  ms_webhooks = Mailersend::Webhooks.new
396
- ms_webhooks.list(webhook_id: "zzz2241ll")
384
+ ms_webhooks.single(webhook_id: "zzz2241ll")
397
385
  ```
398
386
 
399
387
  ### Create a webhook
@@ -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)
@@ -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,18 @@ module Mailersend
17
17
  @verified = verified
18
18
  end
19
19
 
20
- def list
20
+ def list(page: nil, limit: nil, verified: nil)
21
+ hash = {
22
+ "page" => page,
23
+ "limit" => limit,
24
+ "verified" => verified
25
+ }
26
+ response = client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/domains",
27
+ query: URI.encode_www_form(hash.compact)))
28
+ puts response
29
+ end
30
+
31
+ def single(domain_id:, page: nil, limit: nil, verified: nil)
21
32
  hash = {
22
33
  "page" => page,
23
34
  "limit" => limit,
@@ -17,10 +17,11 @@ module Mailersend
17
17
  @status = {}
18
18
  end
19
19
 
20
- def create(name:, scopes:)
20
+ def create(name:, scopes:, domain_id:)
21
21
  json = {
22
22
  "name" => name,
23
- "scopes" => scopes
23
+ "scopes" => scopes,
24
+ "domain_id" => scopes
24
25
  }
25
26
  response = client.http.post("#{API_URL}/token", json: json)
26
27
  puts response
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mailersend
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.7"
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"
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_development_dependency "bundler", "~> 2.2.15"
30
30
  spec.add_development_dependency "rake", "~> 13.0"
31
+ spec.add_development_dependency "rspec"
31
32
  spec.add_development_dependency "rubocop", "~> 1.7"
32
33
  spec.add_dependency "dotenv-rails", "~> 2.7"
33
34
  spec.add_dependency "http", "~> 5.0"
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.2
4
+ version: 0.1.7
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
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '13.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rubocop
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -108,7 +122,7 @@ dependencies:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
124
  version: 0.10.1
111
- description: MailerSend's official Ruby SDK. Interacts will all endpoints at MailerSend
125
+ description: MailerSend's official Ruby SDK. Interacts with all endpoints at MailerSend
112
126
  API.
113
127
  email:
114
128
  - info@mailersend.com