change_manager 0.0.4 → 0.0.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: b05f62f04068ffdb14ead7b37764a3edd32bd365
4
- data.tar.gz: 3a7757b9719377b560c49ada541709d2cddffb7e
3
+ metadata.gz: 2fd44f858a21ebcaebde6626363c013b5528853e
4
+ data.tar.gz: 49e0c7558d83ef0887740b830b1991a4dca0654a
5
5
  SHA512:
6
- metadata.gz: 0b13450eab0c7258f07f674b76bcd26aa2f68a0ff57d6c3d495e363a8292a8ab21b7d212f19f84c3c1dcc8363a5369899efdea994fa2b6d646ed6b2ccc23a72f
7
- data.tar.gz: 580c7990da85f5330c9d098048a8975d3b3102030a8aed7ef8c6b23fd5805986065fbbbf189ab2ae0b763b3c64bff41dfdd792343122f4d98a839b9204513df7
6
+ metadata.gz: 5d2a9c2987747c450a177c4b2b1fa323d250aefebfdcdbec54c1a66251003c4d6a3a56109010424d9c91d5ea3ac024f59fbced5f3328e3d6fc66253688b22d8b
7
+ data.tar.gz: 5024082c31b67fa5b6ad1d6e266ac3f73a3cdaa1a4b3dcfe2412875e4b03cbf56024d4601021e7e7ff3ac72a26e9112ba731002ccbf7d35f6bd64745b516a100
@@ -10,12 +10,16 @@ module ChangeManager
10
10
  puts 'notify method called'
11
11
  unless Change.find(change_id).cancelled?
12
12
  change = Change.find(change_id)
13
- verified_changes = cancel_all_changes(group_similar_changes(change.owner, change.target))
14
- mailer = ChangeManager::NotificationMailer
15
- puts 'email sent' if mailer.send_email(mailer.construct_email(verified_changes))
13
+ verified_changes = process_changes(change)
14
+ notify_users(verified_changes) unless verified_changes.empty?
16
15
  end
17
16
  end
18
17
 
18
+ private
19
+ def self.process_changes(change)
20
+ cancel_all_changes(group_similar_changes(change.owner, change.target))
21
+ end
22
+
19
23
  def self.group_similar_changes(owner, target)
20
24
  similar_changes = Change.where(owner: owner, target: target, cancelled: false)
21
25
  if similar_changes.length > 1
@@ -44,5 +48,10 @@ module ChangeManager
44
48
  verified_changes
45
49
  end
46
50
 
51
+ def self.notify_users(changes)
52
+ mailer = ChangeManager::NotificationMailer
53
+ mailer.send_email(mailer.construct_email(changes))
54
+ end
55
+
47
56
  end
48
57
  end
@@ -1,4 +1,4 @@
1
- class CreateChangeManageChanges < ActiveRecord::Migration
1
+ class CreateChangeManagerChanges < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :change_manager_changes do |t|
4
4
  t.string :change_type
@@ -1,3 +1,3 @@
1
1
  module ChangeManager
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: change_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Lawhorn