mailerlite-ruby 1.0.6 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +3 -3
- data/.github/workflows/publish_gem.yml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +9 -1
- data/lib/mailerlite/client.rb +15 -5
- data/lib/mailerlite/version.rb +1 -1
- data/mailerlite-ruby.gemspec +8 -8
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf06c2b614a36abc1ae9f8d33f4fa738771e56e6645c7b97c8152c7f895ef3b7
|
4
|
+
data.tar.gz: 1e58adc94cfaef6c71985335d8c26ec0f89f351bde8f5218c4c2073f333dc337
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba180fb682d7c3fb4cc7668c66031dfcd544a21febb0b390ac5f7dd7896d588b4b80bbf2d7cca40be4d43bd9d47b611e4b17ddd3c471a54c18a9f5d3983eac3e
|
7
|
+
data.tar.gz: 4552b68bc80f9566bb05a957e06947a95898b3726918e13877b88bfcd9e1b19f91087c53ebdf6d32e094e294eb894183047bd50d5ff7b089c8f52bddd15170c1
|
data/.github/workflows/main.yml
CHANGED
@@ -11,13 +11,13 @@ jobs:
|
|
11
11
|
- name: Set up Ruby
|
12
12
|
uses: ruby/setup-ruby@v1
|
13
13
|
with:
|
14
|
-
ruby-version: 3.
|
14
|
+
ruby-version: 3.1
|
15
15
|
|
16
16
|
- name: Install Bundler
|
17
|
-
run: gem install bundler -v 2.
|
17
|
+
run: gem install bundler -v 2.5.23
|
18
18
|
|
19
19
|
- name: Install dependencies
|
20
|
-
run: bundle _2.
|
20
|
+
run: bundle _2.5.23_ install
|
21
21
|
|
22
22
|
- name: Run tests
|
23
23
|
run: export MAILERLITE_API_TOKEN=dummy_token && bundle exec rspec spec/*rspec.rb
|
@@ -12,15 +12,15 @@ jobs:
|
|
12
12
|
- uses: actions/checkout@v4
|
13
13
|
|
14
14
|
- name: Set up Ruby
|
15
|
-
uses:
|
15
|
+
uses: ruby/setup-ruby@v1
|
16
16
|
with:
|
17
|
-
ruby-version: 3.
|
17
|
+
ruby-version: 3.1
|
18
18
|
|
19
19
|
- name: Install Bundler
|
20
|
-
run: gem install bundler -v 2.
|
20
|
+
run: gem install bundler -v 2.5.23
|
21
21
|
|
22
22
|
- name: Install dependencies
|
23
|
-
run: bundle _2.
|
23
|
+
run: bundle _2.5.23_ install
|
24
24
|
|
25
25
|
- name: Release Gem
|
26
26
|
if: contains(github.ref, 'refs/tags/v')
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -89,7 +89,15 @@ You will have to initalize it in your Ruby file with `require "mailerlite-ruby"`
|
|
89
89
|
|
90
90
|
# Usage
|
91
91
|
|
92
|
-
This SDK requires that you
|
92
|
+
This SDK requires that you have the `MAILERLITE_API_TOKEN` environment variable set. You can set this variable in a `.env` file or enable it system-wide (useful for Docker/Kubernetes). The example of how `MAILERLITE_API_TOKEN` should look like is in `.env.example`.
|
93
|
+
|
94
|
+
If you want to use `dotenv` to manage your environment variables, you can configure the `mailerlite` gem to load `dotenv`:
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
MailerLite.configure do |config|
|
98
|
+
config.use_dotenv = true
|
99
|
+
end
|
100
|
+
```
|
93
101
|
|
94
102
|
## Subscribers
|
95
103
|
|
data/lib/mailerlite/client.rb
CHANGED
@@ -1,20 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'http'
|
4
|
-
require 'dotenv/load'
|
5
4
|
|
6
5
|
MAILERLITE_API_URL = 'https://connect.mailerlite.com/api'
|
7
6
|
|
8
|
-
Dotenv.require_keys('MAILERLITE_API_TOKEN')
|
9
|
-
|
10
7
|
# mailerlite-ruby is a gem that integrates all endpoints from MailerLite API
|
11
8
|
module MailerLite
|
12
9
|
attr_reader :api_token
|
13
10
|
|
11
|
+
class << self
|
12
|
+
attr_accessor :use_dotenv
|
13
|
+
|
14
|
+
def configure
|
15
|
+
yield self
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
14
19
|
# Inits the client.
|
15
20
|
class Client
|
16
|
-
def initialize
|
17
|
-
|
21
|
+
def initialize
|
22
|
+
if MailerLite.use_dotenv
|
23
|
+
require 'dotenv'
|
24
|
+
Dotenv.load
|
25
|
+
Dotenv.require_keys('MAILERLITE_API_TOKEN')
|
26
|
+
end
|
27
|
+
@api_token = ENV.fetch('MAILERLITE_API_TOKEN', nil)
|
18
28
|
end
|
19
29
|
|
20
30
|
def headers
|
data/lib/mailerlite/version.rb
CHANGED
data/mailerlite-ruby.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.description = "MailerLite's official Ruby SDK. Interacts with all endpoints at MailerLite API."
|
15
15
|
spec.homepage = 'https://www.MailerLite.com'
|
16
16
|
spec.license = 'MIT'
|
17
|
-
spec.required_ruby_version = '>=
|
17
|
+
spec.required_ruby_version = '>= 3.1'
|
18
18
|
|
19
19
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
20
20
|
|
@@ -27,13 +27,13 @@ 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_development_dependency 'bundler', '~> 2.
|
31
|
-
spec.add_development_dependency 'rake', '~> 13.
|
32
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
33
|
-
spec.add_dependency 'dotenv', '~>
|
34
|
-
spec.add_dependency 'http', '~> 5.
|
35
|
-
spec.add_dependency 'json', '~> 2.
|
36
|
-
spec.add_dependency 'uri', '~>
|
30
|
+
spec.add_development_dependency 'bundler', '~> 2.5'
|
31
|
+
spec.add_development_dependency 'rake', '~> 13.2'
|
32
|
+
spec.add_development_dependency 'rubocop', '~> 1.69'
|
33
|
+
spec.add_dependency 'dotenv', '~> 3.1'
|
34
|
+
spec.add_dependency 'http', '~> 5.2'
|
35
|
+
spec.add_dependency 'json', '~> 2.9'
|
36
|
+
spec.add_dependency 'uri', '~> 1.0'
|
37
37
|
spec.add_development_dependency 'rspec'
|
38
38
|
spec.add_development_dependency 'simplecov'
|
39
39
|
spec.add_development_dependency 'vcr'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailerlite-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikola Milojević
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-12-
|
12
|
+
date: 2024-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -17,98 +17,98 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 2.
|
20
|
+
version: '2.5'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 2.
|
27
|
+
version: '2.5'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '13.
|
34
|
+
version: '13.2'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '13.
|
41
|
+
version: '13.2'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rubocop
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '1.
|
48
|
+
version: '1.69'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '1.
|
55
|
+
version: '1.69'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: dotenv
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
62
|
+
version: '3.1'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '3.1'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: http
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '5.
|
76
|
+
version: '5.2'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '5.
|
83
|
+
version: '5.2'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: json
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '2.
|
90
|
+
version: '2.9'
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '2.
|
97
|
+
version: '2.9'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: uri
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version:
|
104
|
+
version: '1.0'
|
105
105
|
type: :runtime
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
111
|
+
version: '1.0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: rspec
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -291,7 +291,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
291
291
|
requirements:
|
292
292
|
- - ">="
|
293
293
|
- !ruby/object:Gem::Version
|
294
|
-
version:
|
294
|
+
version: '3.1'
|
295
295
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
296
296
|
requirements:
|
297
297
|
- - ">="
|