ahoy_email 0.3.2 → 0.4.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
  SHA1:
3
- metadata.gz: 0d467aa7543e2d533c9e235ddb1fd5d3a1df4ed3
4
- data.tar.gz: 8574de8778ca3bd872e9c086d71e16e359851393
3
+ metadata.gz: 896fbfeee3ad98de6957deb50df361b61ba3d7a5
4
+ data.tar.gz: 42a4024bee8e9d3628795ba5637ebaf605bc0fad
5
5
  SHA512:
6
- metadata.gz: 065864eae9303b91f59f5b3e86169c5e630866061dae2721683883f97e0b6cc9ec4ee40b565ca97e63aaa65600f9bff42b495a554521f234b1e88dcbdce34f63
7
- data.tar.gz: baa96b0f8099d081ff591701ffd10395eb991cff4fefe7e88197f7412d4d33cdfc56ab25a48ae891f56aa2c8a6b61f05be7dcab2ae1aaf4ae5fe8e251a20c416
6
+ metadata.gz: 6cfcc41e31deee1f91e43cd0cf9b1b5305e472e497be81d08eb87fc764fcfc7b8425e3bdbfc4ef3f00bf3898e56de98d6c1128b88550dde436248b47089eb115
7
+ data.tar.gz: dd28e360cda8635058214b7282b59131bc73f4885fed85fe5be0bc73e2467252386f4e5c103238cb34e931a71a22f1f18dd704da227b6c6e0241885e5f372518
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ sudo: false
5
+ script: RUBYOPT=W0 bundle exec rake test
6
+ before_script:
7
+ - gem install bundler
8
+ notifications:
9
+ email:
10
+ on_success: never
11
+ on_failure: change
12
+ gemfile:
13
+ - Gemfile
14
+ - test/gemfiles/actionmailer42.gemfile
15
+ - test/gemfiles/actionmailer41.gemfile
16
+ - test/gemfiles/actionmailer40.gemfile
17
+ - test/gemfiles/actionmailer32.gemfile
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.4.0
2
+
3
+ - Fixed `belongs_to` error in Rails 5
4
+ - Include `safely_block` gem without polluting global namespace
5
+
1
6
  ## 0.3.2
2
7
 
3
8
  - Fixed deprecation warning for Rails 5
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in ahoy_email.gemspec
4
4
  gemspec
5
+
6
+ gem "actionmailer", "~> 5.0.0"
data/README.md CHANGED
@@ -14,6 +14,8 @@ Works with any email service.
14
14
 
15
15
  :fire: To track visits and events, check out [Ahoy](https://github.com/ankane/ahoy)
16
16
 
17
+ [![Build Status](https://travis-ci.org/ankane/ahoy_email.svg?branch=master)](https://travis-ci.org/ankane/ahoy_email)
18
+
17
19
  ## Installation
18
20
 
19
21
  Add this line to your application’s Gemfile:
data/ahoy_email.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_runtime_dependency "rails"
22
22
  spec.add_runtime_dependency "addressable"
23
23
  spec.add_runtime_dependency "nokogiri"
24
- spec.add_runtime_dependency "safely_block"
24
+ spec.add_runtime_dependency "safely_block", ">= 0.1.1"
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.6"
27
27
  spec.add_development_dependency "rake"
@@ -2,6 +2,6 @@ module Ahoy
2
2
  class Message < ActiveRecord::Base
3
3
  self.table_name = "ahoy_messages"
4
4
 
5
- belongs_to :user, polymorphic: true
5
+ belongs_to :user, AhoyEmail.belongs_to.merge(polymorphic: true)
6
6
  end
7
7
  end
data/lib/ahoy_email.rb CHANGED
@@ -4,14 +4,14 @@ require "rails"
4
4
  require "nokogiri"
5
5
  require "addressable/uri"
6
6
  require "openssl"
7
- require "safely_block"
7
+ require "safely/core"
8
8
  require "ahoy_email/processor"
9
9
  require "ahoy_email/interceptor"
10
10
  require "ahoy_email/mailer"
11
11
  require "ahoy_email/engine"
12
12
 
13
13
  module AhoyEmail
14
- mattr_accessor :secret_token, :options, :subscribers
14
+ mattr_accessor :secret_token, :options, :subscribers, :belongs_to
15
15
 
16
16
  self.options = {
17
17
  message: true,
@@ -30,6 +30,8 @@ module AhoyEmail
30
30
 
31
31
  self.subscribers = []
32
32
 
33
+ self.belongs_to = {}
34
+
33
35
  def self.track(options)
34
36
  self.options = self.options.merge(options)
35
37
  end
@@ -3,6 +3,7 @@ module AhoyEmail
3
3
  initializer "ahoy_email" do |app|
4
4
  secrets = app.respond_to?(:secrets) ? app.secrets : app.config
5
5
  AhoyEmail.secret_token ||= secrets.respond_to?(:secret_key_base) ? secrets.secret_key_base : secrets.secret_token
6
+ AhoyEmail.belongs_to = {optional: true} if Rails::VERSION::MAJOR >= 5
6
7
  end
7
8
  end
8
9
  end
@@ -10,7 +10,7 @@ module AhoyEmail
10
10
  end
11
11
 
12
12
  def process
13
- safely do
13
+ Safely.safely do
14
14
  action_name = mailer.action_name.to_sym
15
15
  if options[:message] && (!options[:only] || options[:only].include?(action_name)) && !options[:except].to_a.include?(action_name)
16
16
  @ahoy_message = AhoyEmail.message_model.new
@@ -31,14 +31,14 @@ module AhoyEmail
31
31
 
32
32
  ahoy_message.assign_attributes(options[:extra] || {})
33
33
 
34
- ahoy_message.save
34
+ ahoy_message.save!
35
35
  message["Ahoy-Message-Id"] = ahoy_message.id.to_s
36
36
  end
37
37
  end
38
38
  end
39
39
 
40
40
  def track_send
41
- safely do
41
+ Safely.safely do
42
42
  if (message_id = message["Ahoy-Message-Id"]) && message.perform_deliveries
43
43
  ahoy_message = AhoyEmail.message_model.where(id: message_id.to_s).first
44
44
  if ahoy_message
@@ -1,3 +1,3 @@
1
1
  module AhoyEmail
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in ahoy_email.gemspec
4
+ gemspec path: "../../"
5
+
6
+ gem "actionmailer", "~> 4.2.0"
data/test/test_helper.rb CHANGED
@@ -10,3 +10,5 @@ Combustion.path = "test/internal"
10
10
  Combustion.initialize! :all
11
11
 
12
12
  ActionMailer::Base.delivery_method = :test
13
+
14
+ ActiveRecord::Base.belongs_to_required_by_default = true if ActiveRecord::VERSION::MAJOR >= 5
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ahoy_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
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-07-28 00:00:00.000000000 Z
11
+ date: 2016-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 0.1.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 0.1.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -144,6 +144,7 @@ extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
146
  - ".gitignore"
147
+ - ".travis.yml"
147
148
  - CHANGELOG.md
148
149
  - Gemfile
149
150
  - LICENSE.txt
@@ -164,6 +165,7 @@ files:
164
165
  - test/gemfiles/actionmailer32.gemfile
165
166
  - test/gemfiles/actionmailer40.gemfile
166
167
  - test/gemfiles/actionmailer41.gemfile
168
+ - test/gemfiles/actionmailer42.gemfile
167
169
  - test/internal/config/database.yml
168
170
  - test/internal/config/routes.rb
169
171
  - test/internal/db/schema.rb
@@ -189,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
191
  version: '0'
190
192
  requirements: []
191
193
  rubyforge_project:
192
- rubygems_version: 2.6.1
194
+ rubygems_version: 2.5.1
193
195
  signing_key:
194
196
  specification_version: 4
195
197
  summary: Simple, powerful email tracking for Rails
@@ -197,9 +199,9 @@ test_files:
197
199
  - test/gemfiles/actionmailer32.gemfile
198
200
  - test/gemfiles/actionmailer40.gemfile
199
201
  - test/gemfiles/actionmailer41.gemfile
202
+ - test/gemfiles/actionmailer42.gemfile
200
203
  - test/internal/config/database.yml
201
204
  - test/internal/config/routes.rb
202
205
  - test/internal/db/schema.rb
203
206
  - test/mailer_test.rb
204
207
  - test/test_helper.rb
205
- has_rdoc: