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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26476250e28b87cf289bba0eccaf6cb110569eb3a4b257a5c4a54ae2a26f1bdd
4
- data.tar.gz: 1c8fa0e0cfe43eaf2984b7384dc5de09fc282431d9f916f774c011d33ce75c3f
3
+ metadata.gz: bf06c2b614a36abc1ae9f8d33f4fa738771e56e6645c7b97c8152c7f895ef3b7
4
+ data.tar.gz: 1e58adc94cfaef6c71985335d8c26ec0f89f351bde8f5218c4c2073f333dc337
5
5
  SHA512:
6
- metadata.gz: 89df2ef7e930774ad86986d38de88653ee04dc899c91f93a5c96ce3d84a0a31121237233992d36ae5dbc2f4cc767c760707e9b4c8f31b9384db93139b893f45c
7
- data.tar.gz: 12d1c9538bbb830ee4cc05a2e4b402a66bfd0b915b5849d9b532981b1b5ca40adfbe3216daf243c62021c1eaa4183dafd5a6bd72ee94748687b92beb9f496801
6
+ metadata.gz: ba180fb682d7c3fb4cc7668c66031dfcd544a21febb0b390ac5f7dd7896d588b4b80bbf2d7cca40be4d43bd9d47b611e4b17ddd3c471a54c18a9f5d3983eac3e
7
+ data.tar.gz: 4552b68bc80f9566bb05a957e06947a95898b3726918e13877b88bfcd9e1b19f91087c53ebdf6d32e094e294eb894183047bd50d5ff7b089c8f52bddd15170c1
@@ -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.0
14
+ ruby-version: 3.1
15
15
 
16
16
  - name: Install Bundler
17
- run: gem install bundler -v 2.4.22
17
+ run: gem install bundler -v 2.5.23
18
18
 
19
19
  - name: Install dependencies
20
- run: bundle _2.4.22_ install
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: actions/setup-ruby@v1
15
+ uses: ruby/setup-ruby@v1
16
16
  with:
17
- ruby-version: 3.0
17
+ ruby-version: 3.1
18
18
 
19
19
  - name: Install Bundler
20
- run: gem install bundler -v 2.4.22
20
+ run: gem install bundler -v 2.5.23
21
21
 
22
22
  - name: Install dependencies
23
- run: bundle _2.4.22_ install
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
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.5
2
+ TargetRubyVersion: 3.1
3
3
  SuggestExtensions: false
4
4
  NewCops: enable
5
5
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [2.0.0] - 2024-12-11
2
+ - *BREAKING CHANGE* - Please check the README file, dotenv is now optional
3
+ - *BREAKING CHANGE* - Updated the minimal required Ruby version from 2.5 to 3.1
4
+
1
5
  ## [1.0.6] - 2024-12-06
2
6
  - Page parameter to cursor pagination fix
3
7
 
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 either have `.env` file with `MAILERLITE_API_TOKEN` env variable or that your variable is enabled system wide (useful for Docker/Kubernetes). The example of how `MAILERLITE_API_TOKEN` should look like is in `.env.example`.
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
 
@@ -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(api_token = ENV.fetch('MAILERLITE_API_TOKEN', nil))
17
- @api_token = api_token
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MailerLite
4
- VERSION = '1.0.6'
4
+ VERSION = '2.0.0'
5
5
  end
@@ -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 = '>= 2.5.0'
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.4.1'
31
- spec.add_development_dependency 'rake', '~> 13.0'
32
- spec.add_development_dependency 'rubocop', '~> 1.7'
33
- spec.add_dependency 'dotenv', '~> 2.7'
34
- spec.add_dependency 'http', '~> 5.0'
35
- spec.add_dependency 'json', '~> 2.5'
36
- spec.add_dependency 'uri', '~> 0.13.0'
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: 1.0.6
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-06 00:00:00.000000000 Z
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.4.1
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.4.1
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.0'
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.0'
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.7'
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.7'
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: '2.7'
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: '2.7'
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.0'
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.0'
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.5'
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.5'
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: 0.13.0
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: 0.13.0
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: 2.5.0
294
+ version: '3.1'
295
295
  required_rubygems_version: !ruby/object:Gem::Requirement
296
296
  requirements:
297
297
  - - ">="