mailcat 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fd497534965b04484494d464268f45f1c02e81f7aec1975fa834aeca0ee96f9
4
- data.tar.gz: 861c80c84f44c5771e203502a1237a53c1ab173bffb34e6ea8aef512b506482b
3
+ metadata.gz: 4bb7968127c9678b2385d8f1de093120bf5e0365e823328ae3478f4d481d485e
4
+ data.tar.gz: f6f6c3f6e718daad7832aa18d85be765e6bc1e37802e2de8da5b01c6ea898c1a
5
5
  SHA512:
6
- metadata.gz: 5753e084a90af4b46f4d3bc2ca5ae78d5523e3528894cae44fc53d6ce60d640983330f4f2ff3da8cb818297f25b55cbd0a17a1ba54151ccbf660677f441a6973
7
- data.tar.gz: a24b69b44ff7c03578260cac8ed87487abb37852c54d8d968ef69b216a5f05188283075d20fe1b9471bbf0faa7336ca68eeb5524879dc595575b3a3c2af74ce7
6
+ metadata.gz: e5af544b05be27470c85800e560cf8b9a7e7476cd55661306b4006742434fb8fe2c59eaf4a59bf16530bcea2ae25843d2918411d0a416c2f7a698dc6fe995111
7
+ data.tar.gz: 66a48c93de2ecd53d9545b9e1c86f8ade902af09d6256fbea98f2f03592f8983183ce2f96d8724035118aa5d4bd1fdf59e1b849484c375fc190c9caf55da66d5
data/.rubocop.yml CHANGED
@@ -1,16 +1,19 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 3.0
3
3
 
4
-
5
4
  Metrics/AbcSize:
6
5
  Max: 26
7
6
 
7
+ Metrics/BlockLength:
8
+ Exclude:
9
+ - "spec/**/*"
10
+
8
11
  Metrics/MethodLength:
9
12
  Max: 20
10
13
 
11
14
  Style/Documentation:
12
15
  Exclude:
13
- - 'lib/mailcat.rb'
16
+ - "lib/mailcat.rb"
14
17
 
15
18
  Style/StringLiterals:
16
19
  Enabled: true
@@ -21,7 +21,7 @@ module Mailcat
21
21
  Net::HTTP.start(emails_uri.hostname, emails_uri.port, use_ssl: emails_uri.scheme == "https") do |http|
22
22
  req = Net::HTTP::Post.new(emails_uri)
23
23
  req["Content-Type"] = "application/json"
24
- req["X-Api-Key"] = Mailcat.config.mailcat_api_key
24
+ req["X-Api-Key"] = Mailcat.mailcat_api_key_raw
25
25
  email_body = {
26
26
  from: mail.from.first,
27
27
  to: mail.to,
@@ -62,7 +62,7 @@ module Mailcat
62
62
 
63
63
  req = Net::HTTP::Post.new(direct_uploads_uri)
64
64
  req["Content-Type"] = "application/json"
65
- req["X-Api-Key"] = Mailcat.config.mailcat_api_key
65
+ req["X-Api-Key"] = Mailcat.mailcat_api_key_raw
66
66
  req.body = {
67
67
  blob: {
68
68
  filename: attachment.filename,
@@ -82,11 +82,11 @@ module Mailcat
82
82
  end
83
83
 
84
84
  def emails_uri
85
- @emails_uri ||= URI("#{Mailcat.config.mailcat_url}/api/emails")
85
+ @emails_uri ||= URI("#{Mailcat.mailcat_url_raw}/api/emails")
86
86
  end
87
87
 
88
88
  def direct_uploads_uri
89
- @direct_uploads_uri ||= URI("#{Mailcat.config.mailcat_url}/api/direct_uploads")
89
+ @direct_uploads_uri ||= URI("#{Mailcat.mailcat_url_raw}/api/direct_uploads")
90
90
  end
91
91
 
92
92
  def attachment_tempfile(attachment)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mailcat
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/mailcat.rb CHANGED
@@ -10,6 +10,14 @@ module Mailcat
10
10
 
11
11
  include ::ActiveSupport::Configurable
12
12
 
13
- config_accessor :mailcat_api_key, default: ENV["MAILCAT_API_KEY"]
14
- config_accessor :mailcat_url, default: ENV["MAILCAT_URL"]
13
+ config_accessor :mailcat_api_key, default: -> { ENV["MAILCAT_API_KEY"] }
14
+ config_accessor :mailcat_url, default: -> { ENV["MAILCAT_URL"] }
15
+
16
+ def self.mailcat_api_key_raw
17
+ config.mailcat_api_key.is_a?(Proc) ? config.mailcat_api_key.call : config.mailcat_api_key
18
+ end
19
+
20
+ def self.mailcat_url_raw
21
+ config.mailcat_url.is_a?(Proc) ? config.mailcat_url.call : config.mailcat_url
22
+ end
15
23
  end
data/mailcat.gemspec ADDED
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/mailcat/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "mailcat"
7
+ spec.version = Mailcat::VERSION
8
+ spec.authors = ["Juan Aparicio"]
9
+ spec.email = ["apariciojuan30@gmail.com"]
10
+
11
+ spec.summary = "Mailcat app rails integration."
12
+ spec.description = "Easily test your emails in staging and visualize them in https://mailcat.app ."
13
+ spec.homepage = "https://mailcat.app"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 3.0.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/gogrow-dev/mailcat"
19
+ spec.metadata["changelog_uri"] = "https://github.com/gogrow-dev/mailcat/blob/main/CHANGELOG.md"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(__dir__) do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ (File.expand_path(f) == __FILE__) ||
26
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
27
+ end
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ # Uncomment to register a new dependency of your gem
34
+ spec.add_runtime_dependency "activesupport", ">= 6.0.0"
35
+
36
+ # For more information and examples about making a new gem, check out our
37
+ # guide at: https://bundler.io/guides/creating_gem.html
38
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Aparicio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-30 00:00:00.000000000 Z
11
+ date: 2025-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -44,6 +44,7 @@ files:
44
44
  - lib/mailcat/delivery_method.rb
45
45
  - lib/mailcat/railtie.rb
46
46
  - lib/mailcat/version.rb
47
+ - mailcat.gemspec
47
48
  - sig/mailcat.rbs
48
49
  homepage: https://mailcat.app
49
50
  licenses: