mailkick 0.1.4 → 0.1.5

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
  SHA1:
3
- metadata.gz: 0bf0541ba51746a50f8a286d7acd0bed58660b4b
4
- data.tar.gz: 796d78becdc4f302b06dd1eb7bf44df154fd9e6f
3
+ metadata.gz: 90d458c1e23507be111eeb1e9de2ecfa430bbea1
4
+ data.tar.gz: bd18b0a3b32a5bd69ad8a73409c5d42bb7c6435e
5
5
  SHA512:
6
- metadata.gz: da32468a31c92c6e674eb1b397827d155c01bd918ade637c9145702b92c35ebb39c916eee01c680efad85ac1b2d298ad2b4b9bb2033bd1d04dfab67baca8e58c
7
- data.tar.gz: 11cbb1e1b2cce5d3763cb11517892d010240ad24e467ff3a2f9b9d8f1d69a1320ab8efd777093edaf328ba1241495bf2f50303d39e82b5333e35dd49b8b130bd
6
+ metadata.gz: 7ccb7874c79601b112b15242802a760d75a97cc16c07ec7b1163fbfd6bfb609b011cf26d6d443ef2edda5ff13850a016ca62073adbff703024dfc52fda776eb9
7
+ data.tar.gz: fd76e86747549847fcfe4359aba508e575c8b36c7eacba58f254209a012759b34fa34c044aa7c27d22f428fc6ff011f41208511f6d8207067753f5c0aa9d4439
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.1.5
2
+
3
+ - Use `safely`
4
+ - Only discover services if not manually set
5
+ - Added `mount` option
6
+
1
7
  ## 0.1.4
2
8
 
3
9
  - Use `Module#prepend` instead of `alias_method_chain`
@@ -1,6 +1,6 @@
1
1
  module Mailkick
2
2
  class SubscriptionsController < ActionController::Base
3
- before_filter :set_email
3
+ before_action :set_email
4
4
 
5
5
  def show
6
6
  end
data/config/routes.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  Rails.application.routes.draw do
2
- mount Mailkick::Engine => "/mailkick"
2
+ mount Mailkick::Engine => "/mailkick" if Mailkick.mount
3
3
  end
4
4
 
5
5
  Mailkick::Engine.routes.draw do
@@ -3,7 +3,7 @@ module Mailkick
3
3
  isolate_namespace Mailkick
4
4
 
5
5
  initializer "mailkick" do |app|
6
- Mailkick.discover_services
6
+ Mailkick.discover_services unless Mailkick.services.any?
7
7
  secrets = app.respond_to?(:secrets) ? app.secrets : app.config
8
8
  Mailkick.secret_token ||= secrets.respond_to?(:secret_key_base) ? secrets.secret_key_base : secrets.secret_token
9
9
  ActiveSupport.on_load :action_mailer do
@@ -3,7 +3,7 @@ module Mailkick
3
3
  def mail(headers = {}, &block)
4
4
  message = super
5
5
 
6
- Mailkick::Processor.new(message).process
6
+ Safely.safely { Mailkick::Processor.new(message).process }
7
7
 
8
8
  message
9
9
  end
@@ -10,9 +10,12 @@ module Mailkick
10
10
  "unsub" => "unsubscribe"
11
11
  }
12
12
 
13
+ # TODO remove ENV["MANDRILL_APIKEY"]
13
14
  def initialize(options = {})
14
15
  require "mandrill"
15
- @mandrill = ::Mandrill::API.new(options[:api_key] || ENV["MANDRILL_APIKEY"])
16
+ @mandrill = ::Mandrill::API.new(
17
+ options[:api_key] || ENV["MANDRILL_APIKEY"] || ENV["MANDRILL_API_KEY"]
18
+ )
16
19
  end
17
20
 
18
21
  # TODO paginate
@@ -26,8 +29,9 @@ module Mailkick
26
29
  end
27
30
  end
28
31
 
32
+ # TODO remove ENV["MANDRILL_APIKEY"]
29
33
  def self.discoverable?
30
- !!(defined?(::Mandrill::API) && ENV["MANDRILL_APIKEY"])
34
+ !!(defined?(::Mandrill::API) && (ENV["MANDRILL_APIKEY"] || ENV["MANDRILL_API_KEY"]))
31
35
  end
32
36
  end
33
37
  end
@@ -1,3 +1,3 @@
1
1
  module Mailkick
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
data/lib/mailkick.rb CHANGED
@@ -9,11 +9,13 @@ require "mailkick/service/mandrill"
9
9
  require "mailkick/service/sendgrid"
10
10
  require "mailkick/service/mailgun"
11
11
  require "set"
12
+ require "safely/core"
12
13
 
13
14
  module Mailkick
14
- mattr_accessor :services, :user_method, :secret_token
15
+ mattr_accessor :services, :user_method, :secret_token, :mount
15
16
  self.services = []
16
17
  self.user_method = proc { |email| User.where(email: email).first rescue nil }
18
+ self.mount = true
17
19
 
18
20
  def self.fetch_opt_outs
19
21
  services.each(&:fetch_opt_outs)
data/mailkick.gemspec CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_dependency "safely_block", ">= 0.1.1"
22
+
21
23
  spec.add_development_dependency "bundler", "~> 1.6"
22
24
  spec.add_development_dependency "rake"
23
25
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailkick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-21 00:00:00.000000000 Z
11
+ date: 2016-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: safely_block
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.1
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -91,9 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
105
  version: '0'
92
106
  requirements: []
93
107
  rubyforge_project:
94
- rubygems_version: 2.4.5.1
108
+ rubygems_version: 2.5.1
95
109
  signing_key:
96
110
  specification_version: 4
97
111
  summary: Email subscriptions made easy
98
112
  test_files: []
99
- has_rdoc: