mailersend-ruby 1.6.0 → 2.0.0

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: 51974d7d8584e99e7d3913249f949e05e5aacbc8db3732b166a16baf7b8313dd
4
- data.tar.gz: 7634d9b0a6a9463961e425b1c67c8a5df2668dd202c06a2eee043201be42ec38
3
+ metadata.gz: 968822d3ad903e00f17ed9f621a5aef8b44864b8ae978fe0a7add39c90d0b49c
4
+ data.tar.gz: af1f6618fea59168f002e35e3dbf1fed804636d98232fa97b1d443573b45f20b
5
5
  SHA512:
6
- metadata.gz: 2fb335aa0e07bfb4836571f956abc8d0505e1f397ca003da6792fc488a9bbfd3bd71c6578a338ceb49920bd72e4baf58b0eed70d8bca4e07c3aeb23cb216b74b
7
- data.tar.gz: 16c0baec523c402acb12b54a9217d052e5e2104a975a781a803cfe392b737bd9b1e016ce807f3387eab243139bcade197e9b8a6b53ffe390162f8d004c96170f
6
+ metadata.gz: 86652332997ef19fb218761ca2b9233442ce3637c031e96786e490d282e2757235ad56231d6450d2cd7a490a88b2cb5bf7e4749522a1f521b98d4060c42f076b
7
+ data.tar.gz: 25bc20a08ff764455e0079b9d981752eb55369a0a9328ba1a366945dd3d574ea0f2d36d133ed8fa83d0f8344430bd4c70c0d3ad6c2a4a86e32ff0eb560f788f5
@@ -6,11 +6,18 @@ jobs:
6
6
  build:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
- - uses: actions/checkout@v3
9
+ - uses: actions/checkout@v4
10
+
10
11
  - name: Set up Ruby
11
- uses: ruby/setup-ruby@v1
12
+ uses: actions/setup-ruby@v1
12
13
  with:
13
14
  ruby-version: 3.0
14
- bundler-cache: true
15
+
16
+ - name: Install Bundler
17
+ run: gem install bundler -v 2.4.22
18
+
19
+ - name: Install dependencies
20
+ run: bundle _2.4.22_ install
21
+
15
22
  - name: Run the default task
16
23
  run: bundle exec rake
@@ -9,7 +9,18 @@ jobs:
9
9
  runs-on: ubuntu-latest
10
10
 
11
11
  steps:
12
- - uses: actions/checkout@v3
12
+ - uses: actions/checkout@v4
13
+
14
+ - name: Set up Ruby
15
+ uses: actions/setup-ruby@v1
16
+ with:
17
+ ruby-version: 3.0
18
+
19
+ - name: Install Bundler
20
+ run: gem install bundler -v 2.4.22
21
+
22
+ - name: Install dependencies
23
+ run: bundle _2.4.22_ install
13
24
 
14
25
  - name: Release Gem
15
26
  if: contains(github.ref, 'refs/tags/v')
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Released]
2
2
 
3
+ ## [2.0.0] - 2023-12-18
4
+
5
+ - *BREAKING CHANGE* - Please check the README file, MailerSend API token is now defined inside your application.
6
+
3
7
  ## [1.6.0] - 2023-06-22
4
8
 
5
9
  - Sender identities by email
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :development do
7
- gem 'bundler', '~> 2.4.10'
8
- gem 'rake', '~> 13.0.6'
9
- gem 'rubocop', '~> 1.52.1'
7
+ gem 'bundler', '~> 2.4.22'
8
+ gem 'rake', '~> 13.0'
9
+ gem 'rubocop', '~> 1.7'
10
10
  end
data/README.md CHANGED
@@ -126,10 +126,6 @@ gem install mailersend-ruby
126
126
 
127
127
  You will have to initalize it in your Ruby file with `require "mailersend-ruby"`.
128
128
 
129
- # Usage
130
-
131
- This SDK requires that you either have `.env` file with `MAILERSEND_API_TOKEN` env variable or that your variable is enabled system wide (useful for Docker/Kubernetes). The example of how `MAILERSEND_API_TOKEN` should look like is in `.env.example`.
132
-
133
129
  ## Email
134
130
 
135
131
  ### Send an email
@@ -137,8 +133,10 @@ This SDK requires that you either have `.env` file with `MAILERSEND_API_TOKEN` e
137
133
  ```ruby
138
134
  require "mailersend-ruby"
139
135
 
136
+ ms_client = Mailersend::Client.new('your_mailersend_token')
137
+
140
138
  # Intialize the email class
141
- ms_email = Mailersend::Email.new
139
+ ms_email = Mailersend::Email.new(ms_client)
142
140
 
143
141
  # Add parameters
144
142
  ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
@@ -157,8 +155,10 @@ ms_email.send
157
155
  ```ruby
158
156
  require "mailersend-ruby"
159
157
 
158
+ ms_client = Mailersend::Client.new('your_mailersend_token')
159
+
160
160
  # Intialize the email class
161
- ms_email = Mailersend::Email.new
161
+ ms_email = Mailersend::Email.new(ms_client)
162
162
 
163
163
  # Add parameters
164
164
  ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
@@ -179,8 +179,10 @@ ms_email.send
179
179
  ```ruby
180
180
  require "mailersend-ruby"
181
181
 
182
+ ms_client = Mailersend::Client.new('your_mailersend_token')
183
+
182
184
  # Intialize the email class
183
- ms_email = Mailersend::Email.new
185
+ ms_email = Mailersend::Email.new(ms_client)
184
186
 
185
187
  # Add parameters
186
188
  ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
@@ -198,8 +200,10 @@ ms_email.send
198
200
  ```ruby
199
201
  require "mailersend-ruby"
200
202
 
203
+ ms_client = Mailersend::Client.new('your_mailersend_token')
204
+
201
205
  # Intialize the email class
202
- ms_email = Mailersend::Email.new
206
+ ms_email = Mailersend::Email.new(ms_client)
203
207
 
204
208
  # Add parameters
205
209
  ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
@@ -225,8 +229,10 @@ ms_email.send
225
229
  ```ruby
226
230
  require "mailersend-ruby"
227
231
 
232
+ ms_client = Mailersend::Client.new('your_mailersend_token')
233
+
228
234
  # Intialize the email class
229
- ms_email = Mailersend::Email.new
235
+ ms_email = Mailersend::Email.new(ms_client)
230
236
 
231
237
  # Add parameters
232
238
  ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
@@ -256,7 +262,9 @@ ms_email.send
256
262
  ```ruby
257
263
  require "mailersend-ruby"
258
264
 
259
- ms_bulk_email = Mailersend::BulkEmail.new
265
+ ms_client = Mailersend::Client.new('your_mailersend_token')
266
+
267
+ ms_bulk_email = Mailersend::BulkEmail.new(ms_client)
260
268
 
261
269
  ms_bulk_email.messages = [
262
270
  {
@@ -282,7 +290,9 @@ ms_bulk_email.send
282
290
  ```ruby
283
291
  require "mailersend-ruby"
284
292
 
285
- ms_bulk_email = Mailersend::BulkEmail.new
293
+ ms_client = Mailersend::Client.new('your_mailersend_token')
294
+
295
+ ms_bulk_email = Mailersend::BulkEmail.new(ms_client)
286
296
  ms_bulk_email.get_bulk_status(bulk_email_id: 'yourbulkemailid')
287
297
  ```
288
298
 
@@ -292,7 +302,9 @@ ms_bulk_email.get_bulk_status(bulk_email_id: 'yourbulkemailid')
292
302
  ```ruby
293
303
  require "mailersend-ruby"
294
304
 
295
- ms_tokens = Mailersend::Tokens.new
305
+ ms_client = Mailersend::Client.new('your_mailersend_token')
306
+
307
+ ms_tokens = Mailersend::Tokens.new(ms_client)
296
308
  ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ], domain_id: "yourdomainid")
297
309
  ```
298
310
 
@@ -300,7 +312,9 @@ ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ],
300
312
  ```ruby
301
313
  require "mailersend-ruby"
302
314
 
303
- ms_tokens = Mailersend::Tokens.new
315
+ ms_client = Mailersend::Client.new('your_mailersend_token')
316
+
317
+ ms_tokens = Mailersend::Tokens.new(ms_client)
304
318
  ms_tokens.update(token_id: "d2220fx04", status: "paused")
305
319
  ```
306
320
 
@@ -308,7 +322,9 @@ ms_tokens.update(token_id: "d2220fx04", status: "paused")
308
322
  ```ruby
309
323
  require "mailersend-ruby"
310
324
 
311
- ms_tokens = Mailersend::Tokens.new
325
+ ms_client = Mailersend::Client.new('your_mailersend_token')
326
+
327
+ ms_tokens = Mailersend::Tokens.new(ms_client)
312
328
  ms_tokens.delete(token_id: "d2220fx04")
313
329
  ```
314
330
 
@@ -317,8 +333,10 @@ ms_tokens.delete(token_id: "d2220fx04")
317
333
  ```ruby
318
334
  require "mailersend-ruby"
319
335
 
336
+ ms_client = Mailersend::Client.new('your_mailersend_token')
337
+
320
338
  # Intialize the email class
321
- ms_email = Mailersend::Email.new
339
+ ms_email = Mailersend::Email.new(ms_client)
322
340
 
323
341
  # Add parameters
324
342
  ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
@@ -344,7 +362,9 @@ ms_email.send
344
362
  ```ruby
345
363
  require "mailersend-ruby"
346
364
 
347
- ms_activity = Mailersend::Activity.new
365
+ ms_client = Mailersend::Client.new('your_mailersend_token')
366
+
367
+ ms_activity = Mailersend::Activity.new(ms_client)
348
368
  ms_activity.get(domain_id: "xxx2241ll", page: 3, limit: 5, date_from: 1620643567, date_to: 1623321967)
349
369
  ```
350
370
 
@@ -355,7 +375,9 @@ ms_activity.get(domain_id: "xxx2241ll", page: 3, limit: 5, date_from: 1620643567
355
375
  ```ruby
356
376
  require "mailersend-ruby"
357
377
 
358
- ms_analytics = Mailersend::Analytics.new
378
+ ms_client = Mailersend::Client.new('your_mailersend_token')
379
+
380
+ ms_analytics = Mailersend::Analytics.new(ms_client)
359
381
  ms_analytics.date(date_from: 1620643567, date_to: 1623321967, events: %w[sent queued])
360
382
  ```
361
383
 
@@ -364,7 +386,9 @@ ms_analytics.date(date_from: 1620643567, date_to: 1623321967, events: %w[sent qu
364
386
  ```ruby
365
387
  require "mailersend-ruby"
366
388
 
367
- ms_analytics = Mailersend::Analytics.new
389
+ ms_client = Mailersend::Client.new('your_mailersend_token')
390
+
391
+ ms_analytics = Mailersend::Analytics.new(ms_client)
368
392
  ms_analytics.country(date_from: 1620643567, date_to: 1623321967)
369
393
  ```
370
394
 
@@ -373,7 +397,9 @@ ms_analytics.country(date_from: 1620643567, date_to: 1623321967)
373
397
  ```ruby
374
398
  require "mailersend-ruby"
375
399
 
376
- ms_analytics = Mailersend::Analytics.new
400
+ ms_client = Mailersend::Client.new('your_mailersend_token')
401
+
402
+ ms_analytics = Mailersend::Analytics.new(ms_client)
377
403
  ms_analytics.ua_name(date_from: 1620643567, date_to: 1623321967)
378
404
  ```
379
405
 
@@ -382,7 +408,9 @@ ms_analytics.ua_name(date_from: 1620643567, date_to: 1623321967)
382
408
  ```ruby
383
409
  require "mailersend-ruby"
384
410
 
385
- ms_analytics = Mailersend::Analytics.new
411
+ ms_client = Mailersend::Client.new('your_mailersend_token')
412
+
413
+ ms_analytics = Mailersend::Analytics.new(ms_client)
386
414
  ms_analytics.ua_type(date_from: 1620643567, date_to: 1623321967)
387
415
  ```
388
416
 
@@ -393,7 +421,9 @@ ms_analytics.ua_type(date_from: 1620643567, date_to: 1623321967)
393
421
  ```ruby
394
422
  require "mailersend-ruby"
395
423
 
396
- ms_inbound_routes = Mailersend::InboundRouting.new
424
+ ms_client = Mailersend::Client.new('your_mailersend_token')
425
+
426
+ ms_inbound_routes = Mailersend::InboundRouting.new(ms_client)
397
427
  ms_inbound_routes.get_inbound_routes
398
428
  ```
399
429
 
@@ -402,7 +432,9 @@ ms_inbound_routes.get_inbound_routes
402
432
  ```ruby
403
433
  require "mailersend-ruby"
404
434
 
405
- ms_inbound_routes = Mailersend::InboundRouting.new
435
+ ms_client = Mailersend::Client.new('your_mailersend_token')
436
+
437
+ ms_inbound_routes = Mailersend::InboundRouting.new(ms_client)
406
438
  ms_inbound_routes.get_single_route(inbound_id: 'idofroute12412')
407
439
  ```
408
440
 
@@ -411,7 +443,9 @@ ms_inbound_routes.get_single_route(inbound_id: 'idofroute12412')
411
443
  ```ruby
412
444
  require "mailersend-ruby"
413
445
 
414
- ms_inbound_routes = Mailersend::InboundRouting.new
446
+ ms_client = Mailersend::Client.new('your_mailersend_token')
447
+
448
+ ms_inbound_routes = Mailersend::InboundRouting.new(ms_client)
415
449
  ms_inbound_routes.settings =
416
450
  {
417
451
  'domain_id' => 'yourdomainid',
@@ -428,7 +462,9 @@ puts ms_inbound_routes.add_inbound_route
428
462
  ```ruby
429
463
  require "mailersend-ruby"
430
464
 
431
- ms_inbound_routes = Mailersend::InboundRouting.new
465
+ ms_client = Mailersend::Client.new('your_mailersend_token')
466
+
467
+ ms_inbound_routes = Mailersend::InboundRouting.new(ms_client)
432
468
  ms_inbound_routes.settings =
433
469
  {
434
470
  'domain_id' => 'yourdomainid',
@@ -445,7 +481,9 @@ puts ms_inbound_routes.update_inbound_route(inbound_id: 'idofroute12412')
445
481
  ```ruby
446
482
  require "mailersend-ruby"
447
483
 
448
- ms_inbound_routes = Mailersend::InboundRouting.new
484
+ ms_client = Mailersend::Client.new('your_mailersend_token')
485
+
486
+ ms_inbound_routes = Mailersend::InboundRouting.new(ms_client)
449
487
  ms_inbound_routes.delete_route(inbound_id: 'idofroute12412')
450
488
  ```
451
489
 
@@ -456,7 +494,9 @@ ms_inbound_routes.delete_route(inbound_id: 'idofroute12412')
456
494
  ```ruby
457
495
  require "mailersend-ruby"
458
496
 
459
- ms_domains = Mailersend::Domains.new
497
+ ms_client = Mailersend::Client.new('your_mailersend_token')
498
+
499
+ ms_domains = Mailersend::Domains.new(ms_client)
460
500
  ms_domains.list
461
501
  ```
462
502
 
@@ -465,7 +505,9 @@ ms_domains.list
465
505
  ```ruby
466
506
  require "mailersend-ruby"
467
507
 
468
- ms_domains = Mailersend::Domains.new
508
+ ms_client = Mailersend::Client.new('your_mailersend_token')
509
+
510
+ ms_domains = Mailersend::Domains.new(ms_client)
469
511
  ms_domains.single(domain_id: "idofdomain12412")
470
512
  ```
471
513
 
@@ -474,7 +516,9 @@ ms_domains.single(domain_id: "idofdomain12412")
474
516
  ```ruby
475
517
  require "mailersend-ruby"
476
518
 
477
- ms_domains = Mailersend::Domains.new
519
+ ms_client = Mailersend::Client.new('your_mailersend_token')
520
+
521
+ ms_domains = Mailersend::Domains.new(ms_client)
478
522
  ms_domains.add(name: 'yourdomain')
479
523
  ```
480
524
 
@@ -483,7 +527,9 @@ ms_domains.add(name: 'yourdomain')
483
527
  ```ruby
484
528
  require "mailersend-ruby"
485
529
 
486
- ms_domains = Mailersend::Domains.new
530
+ ms_client = Mailersend::Client.new('your_mailersend_token')
531
+
532
+ ms_domains = Mailersend::Domains.new(ms_client)
487
533
  ms_domains.delete(domain_id: "idofdomain12412")
488
534
  ```
489
535
 
@@ -492,7 +538,9 @@ ms_domains.delete(domain_id: "idofdomain12412")
492
538
  ```ruby
493
539
  require "mailersend-ruby"
494
540
 
495
- ms_domains = Mailersend::Domains.new
541
+ ms_client = Mailersend::Client.new('your_mailersend_token')
542
+
543
+ ms_domains = Mailersend::Domains.new(ms_client)
496
544
  ms_domains.recipients(domain_id: "idofdomain12412")
497
545
  ```
498
546
 
@@ -501,7 +549,9 @@ ms_domains.recipients(domain_id: "idofdomain12412")
501
549
  ```ruby
502
550
  require "mailersend-ruby"
503
551
 
504
- ms_domains = Mailersend::Domains.new
552
+ ms_client = Mailersend::Client.new('your_mailersend_token')
553
+
554
+ ms_domains = Mailersend::Domains.new(ms_client)
505
555
  ms_domains.settings(domain_id: "idofdomain12412", track_clicks: true, track_unsubscribe: false)
506
556
  ```
507
557
 
@@ -510,7 +560,9 @@ ms_domains.settings(domain_id: "idofdomain12412", track_clicks: true, track_unsu
510
560
  ```ruby
511
561
  require "mailersend-ruby"
512
562
 
513
- ms_domains = Mailersend::Domains.new
563
+ ms_client = Mailersend::Client.new('your_mailersend_token')
564
+
565
+ ms_domains = Mailersend::Domains.new(ms_client)
514
566
  ms_domains.dns(domain_id: "idofdomain12412")
515
567
  ```
516
568
 
@@ -519,7 +571,9 @@ ms_domains.dns(domain_id: "idofdomain12412")
519
571
  ```ruby
520
572
  require "mailersend-ruby"
521
573
 
522
- ms_domains = Mailersend::Domains.new
574
+ ms_client = Mailersend::Client.new('your_mailersend_token')
575
+
576
+ ms_domains = Mailersend::Domains.new(ms_client)
523
577
  ms_domains.verify(domain_id: "idofdomain12412")
524
578
  ```
525
579
 
@@ -530,7 +584,9 @@ ms_domains.verify(domain_id: "idofdomain12412")
530
584
  ```ruby
531
585
  require "mailersend-ruby"
532
586
 
533
- ms_sender_identity = Mailersend::SenderIdentity.new
587
+ ms_client = Mailersend::Client.new('your_mailersend_token')
588
+
589
+ ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
534
590
  ms_sender_identity.list
535
591
  ```
536
592
 
@@ -539,7 +595,9 @@ ms_sender_identity.list
539
595
  ```ruby
540
596
  require "mailersend-ruby"
541
597
 
542
- ms_sender_identity = Mailersend::SenderIdentity.new
598
+ ms_client = Mailersend::Client.new('your_mailersend_token')
599
+
600
+ ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
543
601
  ms_sender_identity.single(identity_id: 'idofidentity123')
544
602
  ```
545
603
 
@@ -548,7 +606,9 @@ ms_sender_identity.single(identity_id: 'idofidentity123')
548
606
  ```ruby
549
607
  require "mailersend-ruby"
550
608
 
551
- ms_sender_identity = Mailersend::SenderIdentity.new
609
+ ms_client = Mailersend::Client.new('your_mailersend_token')
610
+
611
+ ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
552
612
  ms_sender_identity.single_by_email(email: 'example@email.com')
553
613
  ```
554
614
 
@@ -557,7 +617,9 @@ ms_sender_identity.single_by_email(email: 'example@email.com')
557
617
  ```ruby
558
618
  require "mailersend-ruby"
559
619
 
560
- ms_sender_identity = Mailersend::SenderIdentity.new
620
+ ms_client = Mailersend::Client.new('your_mailersend_token')
621
+
622
+ ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
561
623
  ms_sender_identity.add(domain_id: 'idofdomain12412', name: 'yourname', email: 'youremail')
562
624
  ```
563
625
 
@@ -566,7 +628,9 @@ ms_sender_identity.add(domain_id: 'idofdomain12412', name: 'yourname', email: 'y
566
628
  ```ruby
567
629
  require "mailersend-ruby"
568
630
 
569
- ms_sender_identity = Mailersend::SenderIdentity.new
631
+ ms_client = Mailersend::Client.new('your_mailersend_token')
632
+
633
+ ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
570
634
  ms_sender_identity.update(identity_id: 'idofidentity123', reply_to_email: 'replyemail', reply_to_name: 'replyname')
571
635
  ```
572
636
 
@@ -575,7 +639,9 @@ ms_sender_identity.update(identity_id: 'idofidentity123', reply_to_email: 'reply
575
639
  ```ruby
576
640
  require "mailersend-ruby"
577
641
 
578
- ms_sender_identity = Mailersend::SenderIdentity.new
642
+ ms_client = Mailersend::Client.new('your_mailersend_token')
643
+
644
+ ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
579
645
  ms_sender_identity.update_by_email(email: 'example@email.com', reply_to_email: 'replyemail', reply_to_name: 'replyname')
580
646
  ```
581
647
 
@@ -584,7 +650,9 @@ ms_sender_identity.update_by_email(email: 'example@email.com', reply_to_email: '
584
650
  ```ruby
585
651
  require "mailersend-ruby"
586
652
 
587
- ms_sender_identity = Mailersend::SenderIdentity.new
653
+ ms_client = Mailersend::Client.new('your_mailersend_token')
654
+
655
+ ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
588
656
  ms_sender_identity.delete(identity_id: 'idofidentity123')
589
657
  ```
590
658
 
@@ -593,7 +661,9 @@ ms_sender_identity.delete(identity_id: 'idofidentity123')
593
661
  ```ruby
594
662
  require "mailersend-ruby"
595
663
 
596
- ms_sender_identity = Mailersend::SenderIdentity.new
664
+ ms_client = Mailersend::Client.new('your_mailersend_token')
665
+
666
+ ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
597
667
  ms_sender_identity.delete_by_email(email: 'example@email.com')
598
668
  ```
599
669
 
@@ -604,7 +674,9 @@ ms_sender_identity.delete_by_email(email: 'example@email.com')
604
674
  ```ruby
605
675
  require "mailersend-ruby"
606
676
 
607
- ms_messages = Mailersend::Messages.new
677
+ ms_client = Mailersend::Client.new('your_mailersend_token')
678
+
679
+ ms_messages = Mailersend::Messages.new(ms_client)
608
680
  ms_messages.list(page: 1, limit: 10)
609
681
  ```
610
682
 
@@ -613,7 +685,9 @@ ms_messages.list(page: 1, limit: 10)
613
685
  ```ruby
614
686
  require "mailersend-ruby"
615
687
 
616
- ms_messages = Mailersend::Messages.new
688
+ ms_client = Mailersend::Client.new('your_mailersend_token')
689
+
690
+ ms_messages = Mailersend::Messages.new(ms_client)
617
691
  ms_messages.single(message_id: "mess11454")
618
692
  ```
619
693
 
@@ -624,7 +698,9 @@ ms_messages.single(message_id: "mess11454")
624
698
  ```ruby
625
699
  require "mailersend-ruby"
626
700
 
627
- ms_scheduled_messages = Mailersend::ScheduledMessages.new
701
+ ms_client = Mailersend::Client.new('your_mailersend_token')
702
+
703
+ ms_scheduled_messages = Mailersend::ScheduledMessages.new(ms_client)
628
704
  ms_scheduled_messages.get_list
629
705
  ```
630
706
 
@@ -633,7 +709,9 @@ ms_scheduled_messages.get_list
633
709
  ```ruby
634
710
  require "mailersend-ruby"
635
711
 
636
- ms_scheduled_messages = Mailersend::ScheduledMessages.new
712
+ ms_client = Mailersend::Client.new('your_mailersend_token')
713
+
714
+ ms_scheduled_messages = Mailersend::ScheduledMessages.new(ms_client)
637
715
  ms_scheduled_messages.get_signle(message_id: 'mess11454')
638
716
  ```
639
717
 
@@ -642,7 +720,9 @@ ms_scheduled_messages.get_signle(message_id: 'mess11454')
642
720
  ```ruby
643
721
  require "mailersend-ruby"
644
722
 
645
- ms_scheduled_messages = Mailersend::ScheduledMessages.new
723
+ ms_client = Mailersend::Client.new('your_mailersend_token')
724
+
725
+ ms_scheduled_messages = Mailersend::ScheduledMessages.new(ms_client)
646
726
  ms_scheduled_messages.delete(message_id: 'mess11454')
647
727
  ```
648
728
 
@@ -653,7 +733,9 @@ ms_scheduled_messages.delete(message_id: 'mess11454')
653
733
  ```ruby
654
734
  require "mailersend-ruby"
655
735
 
656
- ms_recipients = Mailersend::Recipients.new
736
+ ms_client = Mailersend::Client.new('your_mailersend_token')
737
+
738
+ ms_recipients = Mailersend::Recipients.new(ms_client)
657
739
  ms_recipients.list(page: 1, limit: 10)
658
740
  ```
659
741
 
@@ -662,7 +744,9 @@ ms_recipients.list(page: 1, limit: 10)
662
744
  ```ruby
663
745
  require "mailersend-ruby"
664
746
 
665
- ms_recipients = Mailersend::Recipients.new
747
+ ms_client = Mailersend::Client.new('your_mailersend_token')
748
+
749
+ ms_recipients = Mailersend::Recipients.new(ms_client)
666
750
  ms_recipients.single(recipient_id: "id124")
667
751
  ```
668
752
 
@@ -671,7 +755,9 @@ ms_recipients.single(recipient_id: "id124")
671
755
  ```ruby
672
756
  require "mailersend-ruby"
673
757
 
674
- ms_recipients = Mailersend::Recipients.new
758
+ ms_client = Mailersend::Client.new('your_mailersend_token')
759
+
760
+ ms_recipients = Mailersend::Recipients.new(ms_client)
675
761
  ms_recipients.delete(recipient_id: "id124")
676
762
  ```
677
763
 
@@ -682,7 +768,9 @@ ms_recipients.delete(recipient_id: "id124")
682
768
  ```ruby
683
769
  require "mailersend-ruby"
684
770
 
685
- ms_suppressions = Mailersend::Suppressions.new
771
+ ms_client = Mailersend::Client.new('your_mailersend_token')
772
+
773
+ ms_suppressions = Mailersend::Suppressions.new(ms_client)
686
774
 
687
775
  // List from Blocklist
688
776
  ms_suppressions.get_from_blocklist(domain_id: "xxx2241ll")
@@ -702,7 +790,9 @@ ms_suppressions.get_unsubscribes(domain_id: "xxx2241ll")
702
790
  ```ruby
703
791
  require "mailersend-ruby"
704
792
 
705
- ms_suppressions = Mailersend::Suppressions.new
793
+ ms_client = Mailersend::Client.new('your_mailersend_token')
794
+
795
+ ms_suppressions = Mailersend::Suppressions.new(ms_client)
706
796
 
707
797
  // Add Recipient to Block List using recipients
708
798
  ms_suppressions.add_to_blocklist(domain_id: "xxx2241ll", recipients: ["blocked@client.com"])
@@ -725,7 +815,9 @@ ms_suppressions.add_to_unsubscribers(domain_id: "xxx2241ll", recipients: ["bounc
725
815
  ```ruby
726
816
  require "mailersend-ruby"
727
817
 
728
- ms_suppressions = Mailersend::Suppressions.new
818
+ ms_client = Mailersend::Client.new('your_mailersend_token')
819
+
820
+ ms_suppressions = Mailersend::Suppressions.new(ms_client)
729
821
 
730
822
  // Delete from Block List
731
823
  ms_suppressions.delete_from_blocklist(domain_id: 'yourdomainid', ids: ["xxx2241ll"])
@@ -746,7 +838,9 @@ ms_suppressions.delete_from_unsubscribers(domain_id: 'yourdomainid', ids: ["xxx2
746
838
  ```ruby
747
839
  require "mailersend-ruby"
748
840
 
749
- ms_webhooks = Mailersend::Webhooks.new
841
+ ms_client = Mailersend::Client.new('your_mailersend_token')
842
+
843
+ ms_webhooks = Mailersend::Webhooks.new(ms_client)
750
844
  ms_webhooks.list(domain_id: "xxx2241ll")
751
845
  ```
752
846
 
@@ -754,7 +848,9 @@ ms_webhooks.list(domain_id: "xxx2241ll")
754
848
  ```ruby
755
849
  require "mailersend-ruby"
756
850
 
757
- ms_webhooks = Mailersend::Webhooks.new
851
+ ms_client = Mailersend::Client.new('your_mailersend_token')
852
+
853
+ ms_webhooks = Mailersend::Webhooks.new(ms_client)
758
854
  ms_webhooks.single(webhook_id: "zzz2241ll")
759
855
  ```
760
856
 
@@ -762,7 +858,9 @@ ms_webhooks.single(webhook_id: "zzz2241ll")
762
858
  ```ruby
763
859
  require "mailersend-ruby"
764
860
 
765
- ms_webhooks = Mailersend::Webhooks.new
861
+ ms_client = Mailersend::Client.new('your_mailersend_token')
862
+
863
+ ms_webhooks = Mailersend::Webhooks.new(ms_client)
766
864
  ms_webhooks.create(domain_id: "xxx2241ll", url: "https://domain.com/hook", name: "Webhook", events: ["activity.sent", "activity.delivered"], enabled: true)
767
865
  ```
768
866
 
@@ -770,7 +868,9 @@ ms_webhooks.create(domain_id: "xxx2241ll", url: "https://domain.com/hook", name:
770
868
  ```ruby
771
869
  require "mailersend-ruby"
772
870
 
773
- ms_webhooks = Mailersend::Webhooks.new
871
+ ms_client = Mailersend::Client.new('your_mailersend_token')
872
+
873
+ ms_webhooks = Mailersend::Webhooks.new(ms_client)
774
874
  ms_webhooks.update(webhook_id: "zzz2241ll", enabled: false)
775
875
  ```
776
876
 
@@ -778,7 +878,9 @@ ms_webhooks.update(webhook_id: "zzz2241ll", enabled: false)
778
878
  ```ruby
779
879
  require "mailersend-ruby"
780
880
 
781
- ms_webhooks = Mailersend::Webhooks.new
881
+ ms_client = Mailersend::Client.new('your_mailersend_token')
882
+
883
+ ms_webhooks = Mailersend::Webhooks.new(ms_client)
782
884
  ms_webhooks.delete(webhook_id: "zzz2241ll")
783
885
  ```
784
886
 
@@ -789,7 +891,9 @@ ms_webhooks.delete(webhook_id: "zzz2241ll")
789
891
  ```ruby
790
892
  require "mailersend-ruby"
791
893
 
792
- ms_templates = Mailersend::Templates.new
894
+ ms_client = Mailersend::Client.new('your_mailersend_token')
895
+
896
+ ms_templates = Mailersend::Templates.new(ms_client)
793
897
  ms_templates.list(domain_id: "aax455lll", page: 1, limit: 10)
794
898
  ```
795
899
 
@@ -798,7 +902,9 @@ ms_templates.list(domain_id: "aax455lll", page: 1, limit: 10)
798
902
  ```ruby
799
903
  require "mailersend-ruby"
800
904
 
801
- ms_templates = Mailersend::Templates.new
905
+ ms_client = Mailersend::Client.new('your_mailersend_token')
906
+
907
+ ms_templates = Mailersend::Templates.new(ms_client)
802
908
  ms_templates.single(template_id: "id124")
803
909
  ```
804
910
 
@@ -807,7 +913,9 @@ ms_templates.single(template_id: "id124")
807
913
  ```ruby
808
914
  require "mailersend-ruby"
809
915
 
810
- ms_templates = Mailersend::Templates.new
916
+ ms_client = Mailersend::Client.new('your_mailersend_token')
917
+
918
+ ms_templates = Mailersend::Templates.new(ms_client)
811
919
  ms_templates.delete(template_id: "id124")
812
920
  ```
813
921
 
@@ -818,7 +926,9 @@ ms_templates.delete(template_id: "id124")
818
926
  ```ruby
819
927
  require "mailersend-ruby"
820
928
 
821
- ms_email_verification = Mailersend::EmailVerification.new
929
+ ms_client = Mailersend::Client.new('your_mailersend_token')
930
+
931
+ ms_email_verification = Mailersend::EmailVerification.new(ms_client)
822
932
  ms_email_verification.verify_an_email(email: 'example@email.com')
823
933
  ```
824
934
 
@@ -827,7 +937,9 @@ ms_email_verification.verify_an_email(email: 'example@email.com')
827
937
  ```ruby
828
938
  require "mailersend-ruby"
829
939
 
830
- ms_email_verification = Mailersend::EmailVerification.new
940
+ ms_client = Mailersend::Client.new('your_mailersend_token')
941
+
942
+ ms_email_verification = Mailersend::EmailVerification.new(ms_client)
831
943
  ms_email_verification.list(page: 1, limit: 10)
832
944
  ```
833
945
 
@@ -836,7 +948,9 @@ ms_email_verification.list(page: 1, limit: 10)
836
948
  ```ruby
837
949
  require "mailersend-ruby"
838
950
 
839
- ms_email_verification = Mailersend::EmailVerification.new
951
+ ms_client = Mailersend::Client.new('your_mailersend_token')
952
+
953
+ ms_email_verification = Mailersend::EmailVerification.new(ms_client)
840
954
  ms_email_verification.get_single_list(email_verification_id: 'your-email-verification-id')
841
955
  ```
842
956
 
@@ -845,7 +959,9 @@ ms_email_verification.get_single_list(email_verification_id: 'your-email-verific
845
959
  ```ruby
846
960
  require "mailersend-ruby"
847
961
 
848
- ms_email_verification = Mailersend::EmailVerification.new
962
+ ms_client = Mailersend::Client.new('your_mailersend_token')
963
+
964
+ ms_email_verification = Mailersend::EmailVerification.new(ms_client)
849
965
  ms_email_verification.create_a_list(name: "name-your-list", emails: ["example@email.com"])
850
966
  ```
851
967
 
@@ -854,7 +970,9 @@ ms_email_verification.create_a_list(name: "name-your-list", emails: ["example@em
854
970
  ```ruby
855
971
  require "mailersend-ruby"
856
972
 
857
- ms_email_verification = Mailersend::EmailVerification.new
973
+ ms_client = Mailersend::Client.new('your_mailersend_token')
974
+
975
+ ms_email_verification = Mailersend::EmailVerification.new(ms_client)
858
976
  ms_email_verification.verify_a_list(email_verification_id: 'your-email-verification-id')
859
977
  ```
860
978
 
@@ -863,7 +981,9 @@ ms_email_verification.verify_a_list(email_verification_id: 'your-email-verificat
863
981
  ```ruby
864
982
  require "mailersend-ruby"
865
983
 
866
- ms_email_verification = Mailersend::EmailVerification.new
984
+ ms_client = Mailersend::Client.new('your_mailersend_token')
985
+
986
+ ms_email_verification = Mailersend::EmailVerification.new(ms_client)
867
987
  ms_email_verification.get_list_results(email_verification_id: 'your-email-verification-id')
868
988
  ```
869
989
 
@@ -874,8 +994,10 @@ ms_email_verification.get_list_results(email_verification_id: 'your-email-verifi
874
994
  ```ruby
875
995
  require "mailersend-ruby"
876
996
 
997
+ ms_client = Mailersend::Client.new('your_mailersend_token')
998
+
877
999
  # Intialize the SMS class
878
- ms_sms = Mailersend::SMS.new
1000
+ ms_sms = Mailersend::SMS.new(ms_client)
879
1001
 
880
1002
  # Add parameters
881
1003
  ms_sms.add_from('your-number')
@@ -900,8 +1022,10 @@ ms_sms.send
900
1022
  ```ruby
901
1023
  require "mailersend-ruby"
902
1024
 
1025
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1026
+
903
1027
  # Intialize the SMS Messages class
904
- ms_sms_messages = Mailersend::SMSMessages.new
1028
+ ms_sms_messages = Mailersend::SMSMessages.new(ms_client)
905
1029
 
906
1030
  # Add parameters
907
1031
  ms_sms_messages.list(page: 1, limit: 10)
@@ -912,8 +1036,10 @@ ms_sms_messages.list(page: 1, limit: 10)
912
1036
  ```ruby
913
1037
  require "mailersend-ruby"
914
1038
 
1039
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1040
+
915
1041
  # Intialize the SMS Messages class
916
- ms_sms_messages = Mailersend::SMSMessages.new
1042
+ ms_sms_messages = Mailersend::SMSMessages.new(ms_client)
917
1043
 
918
1044
  # Add parameters
919
1045
  ms_sms_messages.get_single_route(sms_message_id: 'your-sms-message-id')
@@ -926,8 +1052,10 @@ ms_sms_messages.get_single_route(sms_message_id: 'your-sms-message-id')
926
1052
  ```ruby
927
1053
  require "mailersend-ruby"
928
1054
 
1055
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1056
+
929
1057
  # Intialize the SMS Recipient class
930
- ms_sms_activity = Mailersend::SMSActivity.new
1058
+ ms_sms_activity = Mailersend::SMSActivity.new(ms_client)
931
1059
 
932
1060
  # Add parameters
933
1061
  ms_sms_activity.list(page: 1, limit: 10)
@@ -940,8 +1068,10 @@ ms_sms_activity.list(page: 1, limit: 10)
940
1068
  ```ruby
941
1069
  require "mailersend-ruby"
942
1070
 
1071
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1072
+
943
1073
  # Intialize the SMS Recipient class
944
- ms_sms_number = Mailersend::SMSNumber.new
1074
+ ms_sms_number = Mailersend::SMSNumber.new(ms_client)
945
1075
 
946
1076
  # Add parameters
947
1077
  ms_sms_number.list(page: 1, limit: 10)
@@ -952,8 +1082,10 @@ ms_sms_number.list(page: 1, limit: 10)
952
1082
  ```ruby
953
1083
  require "mailersend-ruby"
954
1084
 
1085
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1086
+
955
1087
  # Intialize the SMS Recipient class
956
- ms_sms_number = Mailersend::SMSNumber.new
1088
+ ms_sms_number = Mailersend::SMSNumber.new(ms_client)
957
1089
 
958
1090
  # Add parameters
959
1091
  ms_sms_number.get(sms_number_id: 'your-sms-number-id')
@@ -964,8 +1096,10 @@ ms_sms_number.get(sms_number_id: 'your-sms-number-id')
964
1096
  ```ruby
965
1097
  require "mailersend-ruby"
966
1098
 
1099
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1100
+
967
1101
  # Intialize the SMS Recipient class
968
- ms_sms_number = Mailersend::SMSNumber.new
1102
+ ms_sms_number = Mailersend::SMSNumber.new(ms_client)
969
1103
 
970
1104
  # Add parameters
971
1105
  ms_sms_number.update(sms_number_id: 'your-sms-number-id', paused: false)
@@ -976,8 +1110,10 @@ ms_sms_number.update(sms_number_id: 'your-sms-number-id', paused: false)
976
1110
  ```ruby
977
1111
  require "mailersend-ruby"
978
1112
 
1113
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1114
+
979
1115
  # Intialize the SMS Recipient class
980
- ms_sms_number = Mailersend::SMSNumber.new
1116
+ ms_sms_number = Mailersend::SMSNumber.new(ms_client)
981
1117
 
982
1118
  # Add parameters
983
1119
  ms_sms_number.delete(sms_number_id: 'your-sms-number-id')
@@ -990,8 +1126,10 @@ ms_sms_number.delete(sms_number_id: 'your-sms-number-id')
990
1126
  ```ruby
991
1127
  require "mailersend-ruby"
992
1128
 
1129
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1130
+
993
1131
  # Intialize the SMS Recipient class
994
- ms_sms_recipient = Mailersend::SMSRecipient.new
1132
+ ms_sms_recipient = Mailersend::SMSRecipient.new(ms_client)
995
1133
 
996
1134
  # Add parameters
997
1135
  ms_sms_recipient.list(page: 1, limit: 10)
@@ -1002,8 +1140,10 @@ ms_sms_recipient.list(page: 1, limit: 10)
1002
1140
  ```ruby
1003
1141
  require "mailersend-ruby"
1004
1142
 
1143
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1144
+
1005
1145
  # Intialize the SMS Recipient class
1006
- ms_sms_recipient = Mailersend::SMSRecipient.new
1146
+ ms_sms_recipient = Mailersend::SMSRecipient.new(ms_client)
1007
1147
 
1008
1148
  # Add parameters
1009
1149
  ms_sms_recipient.get(sms_recipient_id: 'your-sms-recipient-id')
@@ -1014,8 +1154,10 @@ ms_sms_recipient.get(sms_recipient_id: 'your-sms-recipient-id')
1014
1154
  ```ruby
1015
1155
  require "mailersend-ruby"
1016
1156
 
1157
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1158
+
1017
1159
  # Intialize the SMS Recipient class
1018
- ms_sms_recipient = Mailersend::SMSRecipient.new
1160
+ ms_sms_recipient = Mailersend::SMSRecipient.new(ms_client)
1019
1161
 
1020
1162
  # Add parameters
1021
1163
  ms_sms_recipient.update(sms_recipient_id: 'your-sms-recipient-id', status: 'opt_out')
@@ -1028,8 +1170,10 @@ ms_sms_recipient.update(sms_recipient_id: 'your-sms-recipient-id', status: 'opt_
1028
1170
  ```ruby
1029
1171
  require "mailersend-ruby"
1030
1172
 
1173
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1174
+
1031
1175
  # Intialize the SMS Inbounds class
1032
- ms_sms_inbounds = Mailersend::SMSInbounds.new
1176
+ ms_sms_inbounds = Mailersend::SMSInbounds.new(ms_client)
1033
1177
 
1034
1178
  ms_sms_inbounds.list
1035
1179
  ```
@@ -1039,8 +1183,10 @@ ms_sms_inbounds.list
1039
1183
  ```ruby
1040
1184
  require "mailersend-ruby"
1041
1185
 
1186
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1187
+
1042
1188
  # Intialize the SMS Inbounds class
1043
- ms_sms_inbounds = Mailersend::SMSInbounds.new
1189
+ ms_sms_inbounds = Mailersend::SMSInbounds.new(ms_client)
1044
1190
 
1045
1191
  # Add parameters
1046
1192
  ms_sms_inbounds.get_sms_inbound_route(sms_inbound_id: 'your-sms-inbound-id')
@@ -1051,8 +1197,10 @@ ms_sms_inbounds.get_sms_inbound_route(sms_inbound_id: 'your-sms-inbound-id')
1051
1197
  ```ruby
1052
1198
  require "mailersend-ruby"
1053
1199
 
1200
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1201
+
1054
1202
  # Intialize the SMS Inbounds class
1055
- ms_sms_inbounds = Mailersend::SMSInbounds.new
1203
+ ms_sms_inbounds = Mailersend::SMSInbounds.new(ms_client)
1056
1204
 
1057
1205
  # Add parameters
1058
1206
  ms_sms_inbounds.settings =
@@ -1070,8 +1218,10 @@ puts ms_sms_inbounds.add_sms_inbound_route
1070
1218
  ```ruby
1071
1219
  require "mailersend-ruby"
1072
1220
 
1221
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1222
+
1073
1223
  # Intialize the SMS Inbounds class
1074
- ms_sms_inbounds = Mailersend::SMSInbounds.new
1224
+ ms_sms_inbounds = Mailersend::SMSInbounds.new(ms_client)
1075
1225
 
1076
1226
  # Add parameters
1077
1227
  ms_sms_inbounds.settings =
@@ -1089,8 +1239,10 @@ puts ms_sms_inbounds.update_sms_inbound_route(sms_inbound_id: 'your-sms-inbound-
1089
1239
  ```ruby
1090
1240
  require "mailersend-ruby"
1091
1241
 
1242
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1243
+
1092
1244
  # Intialize the SMS Inbounds class
1093
- ms_sms_inbounds = Mailersend::SMSInbounds.new
1245
+ ms_sms_inbounds = Mailersend::SMSInbounds.new(ms_client)
1094
1246
 
1095
1247
  # Add parameters
1096
1248
  ms_sms_inbounds.delete_sms_inbound_route(sms_inbound_id: 'your-sms-inbound-id')
@@ -1103,8 +1255,10 @@ ms_sms_inbounds.delete_sms_inbound_route(sms_inbound_id: 'your-sms-inbound-id')
1103
1255
  ```ruby
1104
1256
  require "mailersend-ruby"
1105
1257
 
1258
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1259
+
1106
1260
  # Intialize the SMS Webhooks class
1107
- ms_sms_webhooks = Mailersend::SMSWebhooks.new
1261
+ ms_sms_webhooks = Mailersend::SMSWebhooks.new(ms_client)
1108
1262
 
1109
1263
  # Add parameters
1110
1264
  ms_sms_webhooks.list(sms_number_id: 'your-sms-number-id')
@@ -1115,8 +1269,10 @@ ms_sms_webhooks.list(sms_number_id: 'your-sms-number-id')
1115
1269
  ```ruby
1116
1270
  require "mailersend-ruby"
1117
1271
 
1272
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1273
+
1118
1274
  # Intialize the SMS Webhooks class
1119
- ms_sms_webhooks = Mailersend::SMSWebhooks.new
1275
+ ms_sms_webhooks = Mailersend::SMSWebhooks.new(ms_client)
1120
1276
 
1121
1277
  # Add parameters
1122
1278
  ms_sms_webhooks.get_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-id')
@@ -1127,8 +1283,10 @@ ms_sms_webhooks.get_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-id')
1127
1283
  ```ruby
1128
1284
  require "mailersend-ruby"
1129
1285
 
1286
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1287
+
1130
1288
  # Intialize the SMS Webhooks class
1131
- ms_sms_webhooks = Mailersend::SMSWebhooks.new
1289
+ ms_sms_webhooks = Mailersend::SMSWebhooks.new(ms_client)
1132
1290
 
1133
1291
  # Add parameters
1134
1292
  ms_sms_webhooks.settings =
@@ -1146,8 +1304,10 @@ puts ms_sms_webhooks.add_sms_webhook_route
1146
1304
  ```ruby
1147
1305
  require "mailersend-ruby"
1148
1306
 
1307
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1308
+
1149
1309
  # Intialize the SMS Webhooks class
1150
- ms_sms_webhooks = Mailersend::SMSWebhooks.new
1310
+ ms_sms_webhooks = Mailersend::SMSWebhooks.new(ms_client)
1151
1311
 
1152
1312
  # Add parameters
1153
1313
  ms_sms_webhooks.settings =
@@ -1165,8 +1325,10 @@ puts ms_sms_webhooks.update_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-
1165
1325
  ```ruby
1166
1326
  require "mailersend-ruby"
1167
1327
 
1328
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1329
+
1168
1330
  # Intialize the SMS Webhooks class
1169
- ms_sms_webhooks = Mailersend::SMSWebhooks.new
1331
+ ms_sms_webhooks = Mailersend::SMSWebhooks.new(ms_client)
1170
1332
 
1171
1333
  # Add parameters
1172
1334
  ms_sms_webhooks.delete_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-id')
@@ -1179,8 +1341,10 @@ ms_sms_webhooks.delete_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-id')
1179
1341
  ```ruby
1180
1342
  require "mailersend-ruby"
1181
1343
 
1344
+ ms_client = Mailersend::Client.new('your_mailersend_token')
1345
+
1182
1346
  # Intialize the API Quota class
1183
- ms_api_quota = Mailersend::APIQuota.new
1347
+ ms_api_quota = Mailersend::APIQuota.new(ms_client)
1184
1348
 
1185
1349
  # Add parameters
1186
1350
  ms_api_quota.get_api_quota
@@ -1,20 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'http'
4
- require 'dotenv/load'
5
4
 
6
5
  API_URL = 'https://api.mailersend.com/v1'
7
6
  API_BASE_HOST = 'api.mailersend.com'
8
7
 
9
- Dotenv.require_keys('MAILERSEND_API_TOKEN')
10
-
11
8
  # mailersend-ruby is a gem that integrates all endpoints from MailerSend API
12
9
  module Mailersend
13
10
  attr_reader :api_token
14
11
 
15
12
  # Inits the client.
16
13
  class Client
17
- def initialize(api_token = ENV['MAILERSEND_API_TOKEN'])
14
+ def initialize(api_token = ENV.fetch('MAILERSEND_API_TOKEN', nil))
15
+ raise ArgumentError, 'API token is not provided' if api_token.nil?
16
+
18
17
  @api_token = api_token
19
18
  end
20
19
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mailersend
4
- VERSION = '1.6.0'
4
+ VERSION = '2.0.0'
5
5
  end
@@ -27,8 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ['lib']
29
29
 
30
- spec.add_dependency 'dotenv', '~> 2.7'
31
30
  spec.add_dependency 'http', '~> 5.0'
32
31
  spec.add_dependency 'json', '~> 2.5'
33
- spec.add_dependency 'uri', '~> 0.12.0'
32
+ spec.add_dependency 'uri', '~> 0.12.2'
34
33
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailersend-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikola Milojević
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-23 00:00:00.000000000 Z
11
+ date: 2023-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: dotenv
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.7'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.7'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: http
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +44,14 @@ dependencies:
58
44
  requirements:
59
45
  - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: 0.12.0
47
+ version: 0.12.2
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: 0.12.0
54
+ version: 0.12.2
69
55
  description: MailerSend's official Ruby SDK. Interacts with all endpoints at MailerSend
70
56
  API.
71
57
  email: