development_notification 0.1.3 → 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
  SHA1:
3
- metadata.gz: fa8acdb52671206f355b55f8ba4ce31de3814aeb
4
- data.tar.gz: b39316615517d9fd3fbf5c5a9684a299ce786b7d
3
+ metadata.gz: 057b1d2eebadf0cbd3e250b83a1b3f84c63a989b
4
+ data.tar.gz: c4797eb0d6bf04f13ada5c0aec985cd94d06313f
5
5
  SHA512:
6
- metadata.gz: f8d14b5351eaae50c32b1fb6be4301d3150f62e0767a008ae0d0d5f62b68279435ce8ba7772e0451723f8cce7e6ad0a900d35d426cfdb1a94d40cd4d69d6fd59
7
- data.tar.gz: 9b9c79718071ea829cc19730e7c4f2a040ce9b9f4acd9f102029109e0defb2e7499bb17ce29ec097e7546908cd508c97caa4789058ac4ee355c7d9e3845bf172
6
+ metadata.gz: e46b59ea251b1ed71d4879ffb51868cbb2b0188ee2264094443f2967ca59aeebb6124d2df9322627cd4f9b50901ee15917bc0a250cfbcc2508286ac9c528d6c3
7
+ data.tar.gz: a409e905ff6c4f30601a7c3b2c8f95ab847ac163a87fb759b1c03233bd46625803f1a6f00594d6d8608ef3ac870f79bc5f8167d7c7c70424c028c9ffc642f141
data/README.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Installation
4
4
 
5
+ __Rails5__
6
+
7
+ ```
8
+ gem 'development_notification', "2.0.0" # and bundle
9
+ ```
10
+
11
+ __Rails4__
12
+
5
13
  ```
6
14
  gem 'development_notification', "0.1.3" # and bundle
7
15
  ```
@@ -30,12 +38,20 @@ After setup you gain access to:
30
38
  * DevelopmentNotification::Email.send_email(parameter_hash) #=> sends emails
31
39
 
32
40
  ### Email sending :bear: (the good stuff) :honeybee:
33
- DevelopmentNotification::Email.send_email(title: "Systemside identifier", to: ["dump@example1.com", "dump@example2.com"], from: "creative@inbox.lv", fromname: "Creative", subject: "test", template: "html body")
41
+ ```
42
+ DevelopmentNotification::Email.send_email(
43
+ title: "Systemside identifier",
44
+ to: ["dump@example1.com", "dump@example2.com"],
45
+ from: "creative@inbox.lv",
46
+ fromname: "Creative",
47
+ subject: "test",
48
+ template: "html body"
49
+ )
50
+ ```
34
51
 
35
52
  `to:` key accepts both array of strings and a single string
36
53
 
37
54
  ## Gotchas
38
- * Engine uses smart migration inclusion, this works well in development, but production deployment that migrates selectively (like mina) may fail at detecting migrations. Be sure to __force migration__ in production.
39
55
  * Sometimes production does not load the gem. Append `require: false` in gemfile, and add the line `require 'development_notification'` to `/config/application.rb`
40
56
 
41
57
  ## Development
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -1,9 +1,5 @@
1
1
  module DevelopmentNotification
2
- class Email < ActiveRecord::Base
3
- # def self.params
4
- # return %i|title to_address subject body response status|
5
- # end
6
-
2
+ class Email < ApplicationRecord
7
3
  validates :title, presence: true
8
4
  validates :to_address, presence: true
9
5
  validates :subject, presence: true
@@ -13,7 +9,10 @@ module DevelopmentNotification
13
9
  mail_object = nil
14
10
 
15
11
  [to].flatten.each do |to_email|
16
- mailer = Leadersend::Mail.new(title: title, to: to_email, from: from, fromname: fromname, subject: subject, template: template)
12
+ mailer = Leadersend::Mail.new(
13
+ title: title, to: to_email, from: from,
14
+ fromname: fromname, subject: subject, template: template
15
+ )
17
16
  leadersend_response_hash = mailer.send
18
17
 
19
18
  mail_object = DevelopmentNotification::Email.create_from_leadersend_response_hash(leadersend_response_hash)
@@ -34,7 +33,7 @@ module DevelopmentNotification
34
33
 
35
34
  def self.create_from_leadersend_response_hash(**hash)
36
35
  hash[:status] = self.statuses[hash[:status]]
37
- sent_mail = self.new(hash.symbolize_keys, :without_protection => true)
36
+ sent_mail = new(hash.symbolize_keys) # .merge(without_protection: true)
38
37
  sent_mail.save
39
38
  return sent_mail
40
39
  end
@@ -1,6 +1,5 @@
1
- class CreateDevelopmentNotificationEmails < ActiveRecord::Migration
1
+ class CreateDevelopmentNotificationEmails < ActiveRecord::Migration[4.2]
2
2
  def change
3
- return if table_exists?(:development_notification_emails)
4
3
  create_table :development_notification_emails do |t|
5
4
  t.string :title, index: true, null: false
6
5
  t.string :to_address, index: true, null: false
@@ -10,6 +9,6 @@ class CreateDevelopmentNotificationEmails < ActiveRecord::Migration
10
9
  t.integer :status, index: true, null: false, default: 0
11
10
 
12
11
  t.timestamps
13
- end
12
+ end unless table_exists?(:development_notification_emails)
14
13
  end
15
14
  end
@@ -1,3 +1,3 @@
1
1
  module DevelopmentNotification
2
- VERSION = "0.1.3"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: development_notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Creative
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2017-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4'
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: leadersend
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 2.3.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 2.3.1
111
125
  description: Enables sending simple emails to app owners. Wraps [Leadersend](http://www.leadersend.com)
112
126
  mail delivery service and defines a DevelopmentNotification::Email model for logging.
113
127
  email:
@@ -119,6 +133,7 @@ files:
119
133
  - MIT-LICENSE
120
134
  - README.md
121
135
  - Rakefile
136
+ - app/models/application_record.rb
122
137
  - app/models/development_notification/email.rb
123
138
  - config/routes.rb
124
139
  - db/migrate/20151106101824_create_development_notification_emails.rb
@@ -145,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
160
  version: '0'
146
161
  requirements: []
147
162
  rubyforge_project:
148
- rubygems_version: 2.4.5.1
163
+ rubygems_version: 2.4.8
149
164
  signing_key:
150
165
  specification_version: 4
151
166
  summary: Allow your rails app to send emails to dev team.