ruboty-ragoon 0.7.0 → 0.8.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: 393bed05a2b908beb562b554fa4f77c656efef3d
4
- data.tar.gz: 4e16daecefe917506e8cb53fae6423695c35ea41
3
+ metadata.gz: f38c825988c1a28d883cc2106c27c52f673eb12c
4
+ data.tar.gz: ec4c0ee75affa8f8ae23d1af236c0e660017b149
5
5
  SHA512:
6
- metadata.gz: 8ad88e8e82d40b94d0d542de730b81b7844fd96bcecdbbb512436185e2c9cbfdc9cdf6057dd920dc275faeabeac211dbe09e3ce313051a5a3c7f278c985bbd90
7
- data.tar.gz: e12240d9e404ee8004da3e02c463483b29601443343459165326a4ce9acc6b2bed6f5c22f0f9ef4f42a5bc25ca7f586f5449b3ab71b4adde9c3fa8539b5dc269
6
+ metadata.gz: a31fdc35c0bbaf76c558c865271080d0c35e6f30f5883c577e8504b055db39cccdaeda8f3bef64d2d7379ec775ef12738ff705ce83f03ca937e0647cdadebccb
7
+ data.tar.gz: 5a2102ccdc90e87ce7b8cdb295ecdb5d3d1ea143181cc549b57082661acb8a8610ee3fef98c93a8bd89a60d16d7c3dc081cbddb3ac7aa3af553c54c66b8e83d4
@@ -4,9 +4,10 @@ module Ruboty::Actions::Ragoon
4
4
 
5
5
  def call
6
6
  notifications = ::Ruboty::Ragoon::Notification.new(message.robot.brain)
7
+
7
8
  notifications.retrieve
8
9
  unless notifications.empty?
9
- reply = [":new: #{notifications.unread_count}件の新着通知があります #{notification_url}"]
10
+ reply = [":new: #{notifications.unread_count}件の新着通知があります #{notifications.list_url}"]
10
11
 
11
12
  if private?
12
13
  reply += notifications.list.find_all(&:unread).map(&:format)
@@ -15,11 +16,5 @@ module Ruboty::Actions::Ragoon
15
16
  message.reply(reply.join("\n"))
16
17
  end
17
18
  end
18
-
19
- private
20
-
21
- def notification_url
22
- "#{::Ragoon::garoon_endpoint.gsub(/\?.*\Z/, '')}/notification/index"
23
- end
24
19
  end
25
20
  end
@@ -3,14 +3,15 @@ module Ruboty
3
3
  class Notification
4
4
  include NotifyOnce
5
5
 
6
- attr_reader :list, :brain
6
+ attr_reader :list, :brain
7
7
 
8
8
  def initialize(brain)
9
- @brain = brain
9
+ @brain = brain
10
+ @service = ::Ragoon::Services::Notification.new
10
11
  end
11
12
 
12
13
  def retrieve
13
- new_notifications = ::Ragoon::Services::Notification.new.retrieve
14
+ new_notifications = @service.retrieve
14
15
  .map { |data| Item.new(data) }
15
16
  .find_all { |item| item.unread }
16
17
 
@@ -28,6 +29,10 @@ module Ruboty
28
29
  unread_count == 0
29
30
  end
30
31
 
32
+ def list_url
33
+ "#{@service.garoon_endpoint.gsub(/\?.*\Z/, '')}/notification/index"
34
+ end
35
+
31
36
  class Item
32
37
  attr_accessor :id, :module_type, :module_icon, :unread, :recieved_at, :subject, :url
33
38
 
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Ragoon
3
- VERSION = '0.7.0'
3
+ VERSION = '0.8.0'
4
4
  end
5
5
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_dependency 'ruboty'
22
- spec.add_dependency 'ragoon', '~> 0.6.0'
22
+ spec.add_dependency 'ragoon', '~> 0.7.0'
23
23
  spec.add_dependency 'tilt'
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.12'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-ragoon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SHIOYA, Hiromu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-22 00:00:00.000000000 Z
11
+ date: 2016-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruboty
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.6.0
33
+ version: 0.7.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.6.0
40
+ version: 0.7.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: tilt
43
43
  requirement: !ruby/object:Gem::Requirement