ghn 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ghn.rb +14 -5
  3. data/lib/ghn/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 322c70c53b59f5426ba9f87346e27442a717096f
4
- data.tar.gz: a2aed9fec15c19db8391ecaec76bdcbcaa37d67e
3
+ metadata.gz: 2e5724f6a16a8915d8823faff64964dbed206ec7
4
+ data.tar.gz: 7d632305fbee13434ffb8af94ee8dec38c6979e0
5
5
  SHA512:
6
- metadata.gz: ebdea9873cf0bf277073058c0c8c86fc26cba5b38523ae41148f5759d5ad2276b5904bfef530edde0cf481a2635b9dc93a9d06063c26abf25a78cf5fb2cff19d
7
- data.tar.gz: 71379cdd861e8676b04f24e9123d072feb4508baa8f36b1d242976b7499b72b3eafc49dbbdb3fa6d8ce397e534ef405293b4177f9216219cc5ab85c6898c0c0a
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, number = if notification.subject.url.match(/pulls/)
41
- ['pull', notification.subject.url.match(/[^\/]+\z/).to_a.first]
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
@@ -1,3 +1,3 @@
1
1
  class Ghn
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
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.5
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-01-20 00:00:00.000000000 Z
11
+ date: 2014-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github_api