voltron-notify 0.1.8 → 0.1.9

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: a04574134da60686957218850a216519895e16b7
4
- data.tar.gz: 59e67db3dcfc17a5e29f43ff6aa6c289425e9fbe
3
+ metadata.gz: 6cdac4cb0e2b131d7b6a088ea7a952cc422a1263
4
+ data.tar.gz: 9d41eb541fe1686afdca60334d0525583489ebbe
5
5
  SHA512:
6
- metadata.gz: 7989905b87687408ccb33d4377a9593efc607d855443518e853a3502d8c70bb5c11315156cffd2197218dd010385372ab35b6becce91bf753ef6c1d125d173e5
7
- data.tar.gz: 7818586e3df9333880066dc55d3667dc3429610b3ea54d9e3118423e5bf5259223904609c2d0ecc80ccac6e09719d613272b6b8db8cf4c012f225ba59118a46e
6
+ metadata.gz: 679e4b2d86d9901e23c7df5db41e01cefebd8ef34d2cba4182f7130093d948c61fe09f49fe59c61f2c3d5707c98614e4fee8c5fbdefca95409c6e1480f61dc62
7
+ data.tar.gz: a3758d441c5b7cf86332fff0e784f187d5211b7cec6c2797000f8350740e27458f36092cb6df62ec2b5ec309990e387dcc9fb578739c9fcde2b85e5d24498284
data/README.md CHANGED
@@ -88,6 +88,35 @@ end
88
88
 
89
89
  Note that both SMS and Email notifications have validations on the :to/:from fields, the email subject, and the SMS body text. Since `notifications` is an association, any errors in the actual notification content will bubble up, possibly preventing the `notifyable` model from saving. For that reason, it may be more logical to instead use a @notifyable.notifications.build / @notifyable.save syntax to properly handle errors that may occur.
90
90
 
91
+ Also supported are Twilio status update callbacks for SMS notifications. To enable, you can add the following to your `routes.rb` file
92
+
93
+ ```ruby
94
+ Rails.application.routes.draw do
95
+
96
+ allow_notification_update(options = {})
97
+
98
+ end
99
+ ```
100
+
101
+ By default, the default options for notification updates are as follows:
102
+
103
+ ```
104
+ # The default url path that Twilio will POST updates to. Can be anything you want so long as it's a valid URL path
105
+ path: '/notification/update'
106
+
107
+ # The controller that will handle the notification update
108
+ controller: 'voltron/notification'
109
+
110
+ # The action that will perform the update
111
+ action: 'update' #
112
+ ```
113
+
114
+ If the value of `controller` or `action` are modified, it is assumed that whatever they point to will handle SMS notification updates. See the description column for "StatusCallback" parameter [here](https://www.twilio.com/docs/api/rest/sending-messages) for information on what Twilio will POST to the callback url. Or, take a look at this gems `app/controller/voltron/notification_controller.rb` file to see what it does by default.
115
+
116
+ In order for `allow_notification_update` to generate the correct callback url, please ensure the value of `Voltron.config.base_url` is a valid host name. By default it will attempt to obtain this information from the `:host` parameter of `Rails.application.config.action_controller.default_url_options` but if specified in the Voltron initializer that will
117
+
118
+ Note that `allow_notification_update` does nothing if running on a host matching `/localhost|127\.0\.0\.1/i` Since Twilio can't reach locally running apps to POST to, the app will not even provide Twilio with the callback url to try it. If you have a local app host named Twilio will try and POST to it, but will obviously fail for the reasons previously stated. Basically, this feature only works on remotely accessible hosts.
119
+
91
120
  ## Integration with ActiveJob
92
121
 
93
122
  Voltron Notify supports sending both email (via deliver_later) and SMS (via Voltron::SmsJob and perform_later). To have all notifications be handled by ActiveJob in conjunction with Sidekiq/Resque/whatever you need only set the config value `Voltron.config.notify.use_queue` to `true`. If ActiveJob is configured properly notifications will send that way instead. You may also optionally set the delay for each notification by setting the value of `Voltron.config.notify.delay` to any time value (i.e. 5.minutes, 3.months, 0.seconds)
@@ -9,11 +9,11 @@ class Voltron::NotificationController < ApplicationController
9
9
  if sms.update(update_params)
10
10
  head :ok
11
11
  else
12
- Voltron.log "(SID: #{params[:MessageSid]}) " + sms.errors.full_messages.join(""), "Notification Update", :light_yellow
12
+ Voltron.log "(SID: #{params[:MessageSid]}) " + sms.errors.full_messages.join(''), 'Notification Update', Voltron::Notify::LOG_COLOR
13
13
  head :unprocessable_entity
14
14
  end
15
15
  else
16
- Voltron.log "SMS Notification with id #{params[:MessageSid]} not found.", "Notification Update", :light_yellow
16
+ Voltron.log "SMS Notification with id #{params[:MessageSid]} not found.", 'Notification Update', Voltron::Notify::LOG_COLOR
17
17
  head :not_found
18
18
  end
19
19
  end
@@ -8,6 +8,10 @@ class Voltron::Notification::EmailNotification < ActiveRecord::Base
8
8
 
9
9
  after_create :deliver_later, if: :use_queue?
10
10
 
11
+ validates_presence_of :to, message: I18n.t('voltron.notification.email.to_blank')
12
+
13
+ validates_presence_of :subject, message: I18n.t('voltron.notification.email.subject_blank')
14
+
11
15
  attr_accessor :vars, :attachments
12
16
 
13
17
  def setup
@@ -16,20 +20,19 @@ class Voltron::Notification::EmailNotification < ActiveRecord::Base
16
20
  @vars ||= {}
17
21
  @attachments ||= {}
18
22
  @mailer_arguments = nil
19
- self.mailer_class ||= "Voltron::NotificationMailer"
20
- self.mailer_method ||= "notify"
23
+ self.mailer_class ||= Voltron.config.notify.default_mailer
24
+ self.mailer_method ||= Voltron.config.notify.default_method
25
+ template(Voltron.config.notify.default_template)
21
26
  end
22
27
 
23
28
  def request
24
- # Wrap entire request in container hash so that we can call deep_symbolize_keys on it (in case it's an array)
25
- # Wrap entire request in array and flatten so we can be sure the result is an array
26
- [{ request: (JSON.parse(request_json) rescue Hash.new) }.deep_symbolize_keys[:request]].flatten
29
+ # Wrap entire request in array, for consistency
30
+ Array.wrap({ request: (JSON.parse(request_json) rescue {}) }.with_indifferent_access[:request])
27
31
  end
28
32
 
29
33
  def response
30
- # Wrap entire response in container hash so that we can call deep_symbolize_keys on it (in case it's an array)
31
- # Wrap entire response in array and flatten so we can be sure the result is an array
32
- [{ response: (JSON.parse(response_json) rescue Hash.new) }.deep_symbolize_keys[:response]].flatten
34
+ # Wrap entire response in array, for consistency
35
+ Array.wrap({ response: (JSON.parse(response_json) rescue {}) }.with_indifferent_access[:response])
33
36
  end
34
37
 
35
38
  def after_deliver
@@ -67,7 +70,7 @@ class Voltron::Notification::EmailNotification < ActiveRecord::Base
67
70
  end
68
71
 
69
72
  def method(meth = nil)
70
- self.mailer_method = meth || mailer_method
73
+ self.mailer_method = (meth || mailer_method)
71
74
  end
72
75
 
73
76
  def arguments(*args)
@@ -76,16 +79,8 @@ class Voltron::Notification::EmailNotification < ActiveRecord::Base
76
79
 
77
80
  def template(fullpath)
78
81
  parts = fullpath.split("/")
79
- self.template_name = parts.pop.sub(/\.(html|text)\..*$/, "")
80
- self.template_path = parts.join("/")
81
- end
82
-
83
- # TODO: Move this to actual validates_* methods
84
- def error_messages
85
- output = []
86
- output << "recipient cannot be blank" if to.blank?
87
- output << "subject cannot be blank" if subject.blank?
88
- output
82
+ self.template_name = parts.pop.sub(/\.(html|text)\..*$/, '')
83
+ self.template_path = parts.join('/')
89
84
  end
90
85
 
91
86
  private
@@ -1,4 +1,4 @@
1
- require "twilio-ruby"
1
+ require 'twilio-ruby'
2
2
 
3
3
  class Voltron::Notification::SmsNotification < ActiveRecord::Base
4
4
 
@@ -14,7 +14,15 @@ class Voltron::Notification::SmsNotification < ActiveRecord::Base
14
14
 
15
15
  after_create :deliver_later, if: :use_queue?
16
16
 
17
- validates :status, presence: false, inclusion: { in: %w( accepted queued sending sent delivered received failed undelivered unknown ), message: 'must be one of: accepted, queued, sending, sent, delivered, received, failed, undelivered, or unknown' }, on: :update
17
+ validates :status, presence: false, inclusion: { in: %w( accepted queued sending sent delivered received failed undelivered unknown ), message: I18n.t('voltron.notification.sms.status_invalid') }, on: :update
18
+
19
+ validates_presence_of :to, message: I18n.t('voltron.notification.sms.to_blank')
20
+
21
+ validates_presence_of :from, message: I18n.t('voltron.notification.sms.from_blank')
22
+
23
+ validates_presence_of :message, message: I18n.t('voltron.notification.sms.message_blank')
24
+
25
+ validate :valid_phone_number
18
26
 
19
27
  def setup
20
28
  @request = []
@@ -22,17 +30,15 @@ class Voltron::Notification::SmsNotification < ActiveRecord::Base
22
30
  end
23
31
 
24
32
  def request
25
- # Ensure returned object is an array, whose containing hashes all have symbolized keys, for consistency
33
+ # Ensure returned object is an array of request hashes, for consistency
26
34
  out = Array.wrap((JSON.parse(request_json) rescue nil)).compact
27
- out.each { |i| i.try(:deep_symbolize_keys!) }
28
- out
35
+ out.map { |h| h.with_indifferent_access }
29
36
  end
30
37
 
31
38
  def response
32
- # Ensure returned object is an array, whose containing hashes all have symbolized keys, for consistency
39
+ # Ensure returned object is an array of response hashes, for consistency
33
40
  out = Array.wrap((JSON.parse(response_json) rescue nil)).compact
34
- out.each { |i| i.try(:deep_symbolize_keys!) }
35
- out
41
+ out.map { |h| h.with_indifferent_access }
36
42
  end
37
43
 
38
44
  def after_deliver
@@ -47,6 +53,9 @@ class Voltron::Notification::SmsNotification < ActiveRecord::Base
47
53
  end
48
54
 
49
55
  def deliver_now
56
+ @request = request
57
+ @response = response
58
+
50
59
  all_attachments = attachments.map(&:attachment)
51
60
 
52
61
  # If sending more than 1 attachment, iterate through all but one attachment and send each without a body...
@@ -68,15 +77,16 @@ class Voltron::Notification::SmsNotification < ActiveRecord::Base
68
77
  def deliver_later
69
78
  job = Voltron::SmsJob.set(wait: Voltron.config.notify.delay).perform_later self
70
79
  @request << job
71
- @response << { sid: nil, status: 'unknown' }
72
80
  after_deliver
73
81
  end
74
82
 
75
- def attach(url)
76
- if url.starts_with? 'http'
77
- attachments.build attachment: url
78
- else
79
- attachments.build attachment: Voltron.config.base_url + ActionController::Base.helpers.asset_url(url)
83
+ def attach(*urls)
84
+ urls.flatten.each do |url|
85
+ if url.starts_with? 'http'
86
+ attachments.build attachment: url
87
+ else
88
+ attachments.build attachment: Voltron.config.base_url + ActionController::Base.helpers.asset_url(url)
89
+ end
80
90
  end
81
91
  end
82
92
 
@@ -86,21 +96,11 @@ class Voltron::Notification::SmsNotification < ActiveRecord::Base
86
96
  to_formatted
87
97
  true
88
98
  rescue => e
89
- Voltron.log e.message, 'Notify', :light_red
99
+ Voltron.log e.message, 'Notify', Voltron::Notify::LOG_COLOR
90
100
  false
91
101
  end
92
102
  end
93
103
 
94
- # TODO: Move this to actual validates_* methods
95
- def error_messages
96
- output = []
97
- output << 'recipient cannot be blank' if to.blank?
98
- output << 'recipient is not a valid phone number' unless valid_phone?
99
- output << 'sender cannot be blank' if from.blank?
100
- output << 'message cannot be blank' if message.blank?
101
- output
102
- end
103
-
104
104
  def callback_url
105
105
  url = try(:update_voltron_notification_url, host: Voltron.config.base_url).to_s
106
106
  # Don't allow local or blank urls
@@ -110,6 +110,10 @@ class Voltron::Notification::SmsNotification < ActiveRecord::Base
110
110
 
111
111
  private
112
112
 
113
+ def valid_phone_number
114
+ errors.add :to, I18n.t('voltron.notification.sms.invalid_phone', number: to) unless valid_phone?
115
+ end
116
+
113
117
  def use_queue?
114
118
  Voltron.config.notify.use_queue
115
119
  end
@@ -11,7 +11,7 @@ module Voltron
11
11
 
12
12
  before_validation :validate
13
13
 
14
- PERMITTED_ATTRIBUTES = [:to, :from, :template]
14
+ PERMITTED_ATTRIBUTES = [:to, :from]
15
15
 
16
16
  def email(subject, **args, &block)
17
17
  # Get the remaining args as params, that will eventually become assigns in the mailer template
@@ -55,15 +55,15 @@ module Voltron
55
55
  def validate
56
56
  # Add SMS related errors to self
57
57
  sms_notifications.each do |n|
58
- n.error_messages.each do |error|
59
- self.errors.add :sms, error
58
+ unless n.valid?
59
+ n.errors.full_messages.each { |msg| self.errors.add(:base, msg) }
60
60
  end
61
61
  end
62
62
 
63
63
  # Add Email related errors to self
64
64
  email_notifications.each do |n|
65
- n.error_messages.each do |error|
66
- self.errors.add :email, error
65
+ unless n.valid?
66
+ n.errors.full_messages.each { |msg| self.errors.add(:base, msg) }
67
67
  end
68
68
  end
69
69
  end
@@ -0,0 +1,28 @@
1
+ # This file will be merged with various other Voltron related YAML files with priority
2
+ # given to what exists in this file to begin with (nothing you add/modify here will be overwritten)
3
+ # whenever you run `rails g voltron:<gem_name>:install`,
4
+ # only if the gem in question has any locale data associated with it
5
+
6
+ ---
7
+ en:
8
+ activerecord:
9
+ attributes:
10
+ voltron/notification/email_notification:
11
+ to: Recipient
12
+ subject: Subject
13
+ voltron/notification/sms_notification:
14
+ to: Recipient
15
+ from: Sender
16
+ message: Message
17
+ status: Status
18
+ voltron:
19
+ notification:
20
+ email:
21
+ to_blank: cannot be blank
22
+ subject_blank: cannot be blank
23
+ sms:
24
+ to_blank: cannot be blank
25
+ from_blank: cannot be blank
26
+ message_blank: cannot be blank
27
+ invalid_phone: number "%{number}" is not a valid phone number
28
+ status_invalid: must be one of accepted, queued, sending, sent, delivered, received, failed, undelivered, or unknown
@@ -1,19 +1,21 @@
1
+ require 'yaml'
2
+
1
3
  module Voltron
2
4
  module Notify
3
5
  module Generators
4
6
  class InstallGenerator < Rails::Generators::Base
5
7
 
6
- source_root File.expand_path("../../../templates", __FILE__)
8
+ source_root File.expand_path('../../../templates', __FILE__)
7
9
 
8
- desc "Add Voltron Notify initializer"
10
+ desc 'Add Voltron Notify initializer'
9
11
 
10
12
  def inject_initializer
11
13
 
12
- voltron_initialzer_path = Rails.root.join("config", "initializers", "voltron.rb")
14
+ voltron_initialzer_path = Rails.root.join('config', 'initializers', 'voltron.rb')
13
15
 
14
16
  unless File.exist? voltron_initialzer_path
15
17
  unless system("cd #{Rails.root.to_s} && rails generate voltron:install")
16
- puts "Voltron initializer does not exist. Please ensure you have the 'voltron' gem installed and run `rails g voltron:install` to create it"
18
+ puts 'Voltron initializer does not exist. Please ensure you have the \'voltron\' gem installed and run `rails g voltron:install` to create it'
17
19
  return false
18
20
  end
19
21
  end
@@ -34,40 +36,82 @@ module Voltron
34
36
  # config.notify.delay = 0.seconds
35
37
 
36
38
  # Twilio account id number
37
- # config.notify.sms_account_sid = ""
39
+ # config.notify.sms_account_sid = ''
38
40
 
39
41
  # Twilio authentication token
40
- # config.notify.sms_auth_token = ""
42
+ # config.notify.sms_auth_token = ''
41
43
 
42
44
  # Default from phone number. Must be the number provided by Twilio.
43
45
  # Avoid the overhead of pre-formatting the number by entering in the format "+1234567890"
44
- # config.notify.sms_from = ""
46
+ # config.notify.sms_from = ''
45
47
 
46
48
  # Default from email address. If not specified the default from in the mailer or the :from param on mail() is used
47
- # config.notify.email_from = "no-reply@example.com"
49
+ # config.notify.email_from = 'no-reply@example.com'
50
+
51
+ # The below 3 options define how email is sent. Each can be overridden within the `notification.email` block
52
+ # by using the corresponding methods: `mailer`, `method`, and `template`
53
+ # config.notify.default_mailer = Voltron::NotificationMailer
54
+
55
+ # Within the mailer you define when sending a notification, this is the method that will be called
56
+ # So in the default case, `Voltron::NotificationMailer.notify(...)` will be called
57
+ # config.notify.default_method = :notify
58
+
59
+ # The default mail view template to use
60
+ # Note that if you decide to use a custom mailer/method, this becomes irrelevant
61
+ # as you'll have the ability to set the template as you see fit within the mailer's method itself
62
+ # config.notify.default_template = 'voltron/notification_mailer/notify.html.erb'
48
63
  CONTENT
49
64
  end
50
65
  end
51
66
  end
52
67
 
53
68
  def copy_migrations
54
- copy_migration "create_voltron_notifications"
55
- copy_migration "create_voltron_notification_sms_notifications"
56
- copy_migration "create_voltron_notification_email_notifications"
57
- copy_migration "create_voltron_notification_sms_notification_attachments"
69
+ copy_migration 'create_voltron_notifications'
70
+ copy_migration 'create_voltron_notification_sms_notifications'
71
+ copy_migration 'create_voltron_notification_email_notifications'
72
+ copy_migration 'create_voltron_notification_sms_notification_attachments'
58
73
  end
59
74
 
60
75
  def copy_views
61
- copy_file "../../../app/views/voltron/notification_mailer/notify.html.erb", Rails.root.join("app", "views", "voltron", "notification_mailer", "notify.html.erb")
76
+ copy_file '../../../app/views/voltron/notification_mailer/notify.html.erb', Rails.root.join('app', 'views', 'voltron', 'notification_mailer', 'notify.html.erb')
77
+ end
78
+
79
+ def copy_locales
80
+ locale_path = Rails.root.join('config', 'locales', 'voltron.yml')
81
+ locale = YAML.load_file(locale_path).symbolize_keys rescue {}
82
+
83
+ compact_nested = Proc.new do |k, v|
84
+ v.respond_to?(:delete_if) ? (v.delete_if(&compact_nested); nil) : v.blank?
85
+ end
86
+
87
+ notification_path = File.expand_path('../../../templates/config/locales/voltron-notification.yml', __FILE__)
88
+ notification_locale = YAML.load_file(notification_path).symbolize_keys
89
+
90
+ # Remove keys that don't have values from both hashes
91
+ notification_locale.delete_if(&compact_nested)
92
+ locale.delete_if(&compact_nested)
93
+
94
+ # Merge the 2 yaml files, giving priority to the original locle file.
95
+ # We don't want to overwrite anything the user may have created on their own, or modified
96
+ notification_locale.deep_merge!(locale)
97
+
98
+ File.open(locale_path, 'w') do |f|
99
+ f.puts '# This file will be merged with various other Voltron related YAML files with priority'
100
+ f.puts '# given to what exists in this file to begin with (nothing you add/modify here will be overwritten)'
101
+ f.puts '# whenever you run `rails g voltron:<gem_name>:install`,'
102
+ f.puts '# only if the gem in question has any locale data associated with it'
103
+ f.puts
104
+ f.puts notification_locale.stringify_keys.to_yaml(line_width: -1)
105
+ end
62
106
  end
63
107
 
64
108
  protected
65
109
 
66
110
  def copy_migration(filename)
67
- if migration_exists?(Rails.root.join("db", "migrate"), filename)
68
- say_status("skipped", "Migration #{filename}.rb already exists")
111
+ if migration_exists?(Rails.root.join('db', 'migrate'), filename)
112
+ say_status('skipped', "Migration #{filename}.rb already exists")
69
113
  else
70
- copy_file "db/migrate/#{filename}.rb", Rails.root.join("db", "migrate", "#{migration_number}_#{filename}.rb")
114
+ copy_file "db/migrate/#{filename}.rb", Rails.root.join('db', 'migrate', "#{migration_number}_#{filename}.rb")
71
115
  end
72
116
  end
73
117
 
@@ -82,7 +126,7 @@ CONTENT
82
126
  def migration_number
83
127
  @migration_number ||= Time.now.strftime("%Y%m%d%H%M%S").to_i
84
128
 
85
- while migration_id_exists?(Rails.root.join("db", "migrate"), @migration_number) do
129
+ while migration_id_exists?(Rails.root.join('db', 'migrate'), @migration_number) do
86
130
  @migration_number += 1
87
131
  end
88
132
 
@@ -13,12 +13,15 @@ module Voltron
13
13
  attr_accessor :sms_account_sid, :sms_auth_token, :sms_from
14
14
 
15
15
  # Email config settings
16
- attr_accessor :email_from
16
+ attr_accessor :email_from, :default_mailer, :default_method, :default_template
17
17
 
18
18
  def initialize
19
19
  @use_queue ||= false
20
20
  @delay ||= 0.seconds
21
- @email_from ||= "no-reply@example.com"
21
+ @email_from ||= 'no-reply@example.com'
22
+ @default_mailer = Voltron::NotificationMailer
23
+ @default_method = :notify
24
+ @default_template = 'voltron/notification_mailer/notify.html.erb'
22
25
  end
23
26
 
24
27
  end
@@ -3,9 +3,9 @@ module Voltron
3
3
  module Routes
4
4
 
5
5
  def allow_notification_update(options={})
6
- path = (options[:path] || "/notification/update").gsub(/(^[\s\/]+)|([\s\/]+$)/, '')
7
- controller = (options[:controller] || "voltron/notification")
8
- action = (options[:action] || "update")
6
+ path = (options[:path] || '/notification/update').gsub(/(^[\s\/]+)|([\s\/]+$)/, '')
7
+ controller = (options[:controller] || 'voltron/notification')
8
+ action = (options[:action] || 'update')
9
9
  post path, to: "#{controller}##{action}", as: :update_voltron_notification
10
10
  end
11
11
 
@@ -4,7 +4,7 @@ module Voltron
4
4
 
5
5
  isolate_namespace Voltron
6
6
 
7
- initializer "voltron.notify.initialize" do
7
+ initializer 'voltron.notify.initialize' do
8
8
  ::ActiveRecord::Base.send :extend, ::Voltron::Notify
9
9
  ::ActionDispatch::Routing::Mapper.send :include, ::Voltron::Notify::Routes
10
10
  end
@@ -1,5 +1,5 @@
1
1
  module Voltron
2
2
  module Notify
3
- VERSION = '0.1.8'.freeze
3
+ VERSION = '0.1.9'.freeze
4
4
  end
5
5
  end
@@ -1,11 +1,13 @@
1
- require "voltron"
2
- require "voltron/notify/version"
3
- require "voltron/notify/action_dispatch/routes"
4
- require "voltron/config/notify"
1
+ require 'voltron'
2
+ require 'voltron/notify/version'
3
+ require 'voltron/notify/action_dispatch/routes'
4
+ require 'voltron/config/notify'
5
5
 
6
6
  module Voltron
7
7
  module Notify
8
8
 
9
+ LOG_COLOR = :light_yellow
10
+
9
11
  def notifyable
10
12
  include InstanceMethods
11
13
 
@@ -13,7 +15,7 @@ module Voltron
13
15
 
14
16
  after_validation :clean_notification_validation
15
17
 
16
- has_many :notifications, as: :notifyable, class_name: "::Voltron::Notification"
18
+ has_many :notifications, as: :notifyable, class_name: '::Voltron::Notification'
17
19
  end
18
20
 
19
21
  module InstanceMethods
@@ -45,4 +47,4 @@ module Voltron
45
47
  end
46
48
  end
47
49
 
48
- require "voltron/notify/engine" if defined?(Rails)
50
+ require 'voltron/notify/engine' if defined?(Rails)
@@ -1,33 +1,35 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
2
+ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "voltron/notify/version"
4
+ require 'voltron/notify/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "voltron-notify"
7
+ spec.name = 'voltron-notify'
8
8
  spec.version = Voltron::Notify::VERSION
9
- spec.authors = ["Eric Hainer"]
10
- spec.email = ["eric@commercekitchen.com"]
9
+ spec.authors = ['Eric Hainer']
10
+ spec.email = ['eric@commercekitchen.com']
11
11
 
12
12
  spec.summary = %q{Send notifications easier}
13
- spec.homepage = "https://github.com/ehainer/voltron-notify"
14
- spec.license = "MIT"
13
+ spec.homepage = 'https://github.com/ehainer/voltron-notify'
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
- spec.bindir = "exe"
17
+ spec.bindir = 'exe'
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency "rails", ">= 4.2"
22
- spec.add_dependency "twilio-ruby", "~> 4.11"
23
- spec.add_dependency "rack", ">= 1.6"
24
- spec.add_dependency "voltron", ">= 0.2.0"
21
+ spec.add_dependency 'rails', '>= 4.2'
22
+ spec.add_dependency 'twilio-ruby', '~> 4.11'
23
+ spec.add_dependency 'rack', '>= 1.6'
24
+ spec.add_dependency 'voltron', '>= 0.2.1'
25
25
 
26
- spec.add_development_dependency "simplecov", "0.11.0"
27
- spec.add_development_dependency "bundler", ">= 1.12"
28
- spec.add_development_dependency "rake", ">= 10.0"
29
- spec.add_development_dependency "rspec", ">= 3.0"
30
- spec.add_development_dependency "rspec-rails", ">= 3.4"
31
- spec.add_development_dependency "sqlite3", ">= 1.2"
32
- spec.add_development_dependency "factory_girl_rails", ">= 4.7"
26
+ spec.add_development_dependency 'simplecov', '0.11.0'
27
+ spec.add_development_dependency 'bundler', '>= 1.12'
28
+ spec.add_development_dependency 'rake', '>= 10.0'
29
+ spec.add_development_dependency 'rspec', '>= 3.0'
30
+ spec.add_development_dependency 'rspec-rails', '>= 3.4'
31
+ spec.add_development_dependency 'sqlite3', '>= 1.2'
32
+ spec.add_development_dependency 'factory_girl_rails', '>= 4.7'
33
+ spec.add_development_dependency 'letter_opener', '>= 1.0.0'
34
+ spec.add_development_dependency 'sidekiq', '~> 4.2.10'
33
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voltron-notify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hainer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-10 00:00:00.000000000 Z
11
+ date: 2017-04-08 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.2.0
61
+ version: 0.2.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.2.0
68
+ version: 0.2.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +164,34 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '4.7'
167
+ - !ruby/object:Gem::Dependency
168
+ name: letter_opener
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: 1.0.0
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: 1.0.0
181
+ - !ruby/object:Gem::Dependency
182
+ name: sidekiq
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 4.2.10
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 4.2.10
167
195
  description:
168
196
  email:
169
197
  - eric@commercekitchen.com
@@ -189,6 +217,7 @@ files:
189
217
  - app/views/voltron/notification_mailer/notify.html.erb
190
218
  - bin/console
191
219
  - bin/setup
220
+ - lib/generators/templates/config/locales/voltron-notification.yml
192
221
  - lib/generators/templates/db/migrate/create_voltron_notification_email_notifications.rb
193
222
  - lib/generators/templates/db/migrate/create_voltron_notification_sms_notification_attachments.rb
194
223
  - lib/generators/templates/db/migrate/create_voltron_notification_sms_notifications.rb