ghn 0.0.5 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ghn.rb +14 -5
- data/lib/ghn/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e5724f6a16a8915d8823faff64964dbed206ec7
|
|
4
|
+
data.tar.gz: 7d632305fbee13434ffb8af94ee8dec38c6979e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7cf318c5737801e38bfcc0c2057cdb09693125615c7cde9636088276e8802955d9b162335a723c7811588a31003dc9d8cf4ef94f146264c51126e22cad4072e1
|
|
7
|
+
data.tar.gz: 54217e8cfed126854d31c73a8c8c311b79c65bb7933792a13b2e8ec1a1357db63448dfbccfa1b2a956162404eb42b11c81d65af6554348e07765d6158d364600
|
data/lib/ghn.rb
CHANGED
|
@@ -37,11 +37,8 @@ class Ghn
|
|
|
37
37
|
|
|
38
38
|
client.activity.notifications.list(params).map { |notification|
|
|
39
39
|
repo = notification.repository.full_name
|
|
40
|
-
type
|
|
41
|
-
|
|
42
|
-
else
|
|
43
|
-
['issues', notification.subject.url.match(/[^\/]+\z/).to_a.first]
|
|
44
|
-
end
|
|
40
|
+
type = notification_type(notification.subject.url)
|
|
41
|
+
number = notification.subject.url.match(/[^\/]+\z/).to_a.first
|
|
45
42
|
if @options.mark_as_read?
|
|
46
43
|
self.mark(notification.id)
|
|
47
44
|
"[x] https://github.com/#{repo}/#{type}/#{number}"
|
|
@@ -54,4 +51,16 @@ class Ghn
|
|
|
54
51
|
def mark(id, read = true)
|
|
55
52
|
client.activity.notifications.mark(thread_id: id, read: read)
|
|
56
53
|
end
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
def notification_type(url)
|
|
57
|
+
case url
|
|
58
|
+
when /pulls/
|
|
59
|
+
'pull'
|
|
60
|
+
when /issues/
|
|
61
|
+
'issues'
|
|
62
|
+
else
|
|
63
|
+
'commit'
|
|
64
|
+
end
|
|
65
|
+
end
|
|
57
66
|
end
|
data/lib/ghn/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ghn
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kensuke Nagae
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-02-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: github_api
|