zenhub_ruby 0.1.1 → 0.2.1

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: 481f5482147c50065cce36312f9a581e5eacccd0
4
- data.tar.gz: e1e5af1336b9b4928469a41136a058d37b370a53
3
+ metadata.gz: bf5604f261a94ca08a4707fc261fce766a8c1d14
4
+ data.tar.gz: 8cd4002e430ca6350d73e058dc76da87425056b6
5
5
  SHA512:
6
- metadata.gz: 7e0b4ab352e5d9765b0e4f189935833b325d3d9379109c0e62387bd688ffe4a8a4e304d644ece79323d6731bf30d295b8feb5558bb9ee47b552709f0f9dd2ffb
7
- data.tar.gz: 0a2c07982b27dde6fb8e7a6381d509490254b6d1716a372c460bc3aac1a096a4ebe8f03d6fa2e84d23b934d0f4623fd0fa4bfecda6107f5a4276ba821be1aeec
6
+ metadata.gz: ee0aa1dabe2c5b08ba3e883857e05c298d1e588d6f83284ec05917d2186af0e606519b5db7ddfc4a85c6afcc047574830cce2ef5715b006b80b84b92fea9a401
7
+ data.tar.gz: 580b73608e8c6dfe933c6adfa794285b1b519e64dc3b642514665bccb2e02f4f9add1b6d7028898c4ed00bc4a241bac65e6dbc129e67231e5e26a79c61d3aa26
data/.gitignore CHANGED
@@ -6,4 +6,3 @@
6
6
  /doc/
7
7
  /pkg/
8
8
  /tmp/
9
- .env
data/README.md CHANGED
@@ -25,25 +25,31 @@ Or install it yourself as:
25
25
  ```ruby
26
26
  require 'zenhub_ruby'
27
27
 
28
- client = ZenhubRuby::Client.new('YOUR_ACCESS_TOKEN')
28
+ client = ZenhubRuby::Client.new('ZENHUB_ACCESS_TOKEN', 'GITHUB_ACCESS_TOKEN')
29
+ ```
30
+
31
+ or
32
+
33
+ ```ruby
34
+ client = ZenhubRuby.new('ZENHUB_ACCESS_TOKEN', 'GITHUB_ACCESS_TOKEN')
29
35
  ```
30
36
 
31
37
  ### Get issue data
32
38
 
33
39
  ```ruby
34
- client.issue_data(REPO_ID, ISSUE_NUMBER)
40
+ client.issue_data('REPO_NAME(ex: "tkm-kj/zenhub_ruby")', ISSUE_NUMBER)
35
41
  ```
36
42
 
37
43
  ### Get issue events
38
44
 
39
45
  ```ruby
40
- client.issue_events(REPO_ID, ISSUE_NUMBER)
46
+ client.issue_events('REPO_NAME', ISSUE_NUMBER)
41
47
  ```
42
48
 
43
49
  ### Get the ZenHub Board data for a repository
44
50
 
45
51
  ```ruby
46
- client.board_data(REPO_ID)
52
+ client.board_data('REPO_NAME')
47
53
  ```
48
54
 
49
55
  ## Contributing
@@ -1,5 +1,9 @@
1
1
  require 'zenhub_ruby/client'
2
2
 
3
3
  module ZenhubRuby
4
- VERSION = "0.1.1"
4
+ class << self
5
+ def new(zenhub_access_token, github_access_token)
6
+ Client.new(zenhub_access_token, github_access_token)
7
+ end
8
+ end
5
9
  end
@@ -1,15 +1,18 @@
1
1
  require 'zenhub_ruby/connection'
2
2
  require 'zenhub_ruby/client/api'
3
+ require 'zenhub_ruby/github'
4
+ require 'zenhub_ruby/version'
3
5
 
4
6
  module ZenhubRuby
5
7
  class Client
6
- include ZenhubRuby::Connection
7
- include ZenhubRuby::Client::Api
8
+ include Connection
9
+ include Client::Api
8
10
 
9
- attr_reader :access_token
11
+ attr_reader :zenhub_access_token, :github
10
12
 
11
- def initialize(access_token)
12
- @access_token = access_token
13
+ def initialize(zenhub_access_token, github_access_token)
14
+ @zenhub_access_token = zenhub_access_token
15
+ @github = ZenhubRuby::Github.new(github_access_token)
13
16
  end
14
17
  end
15
18
  end
@@ -1,16 +1,16 @@
1
1
  module ZenhubRuby
2
2
  class Client
3
3
  module Api
4
- def issue_data(repo_id, issue_number)
5
- get "/p1/repositories/#{repo_id}/issues/#{issue_number}"
4
+ def issue_data(repo_name, issue_number)
5
+ get "/p1/repositories/#{github.repo_id(repo_name)}/issues/#{issue_number}"
6
6
  end
7
7
 
8
- def issue_events(repo_id, issue_number)
9
- get "/p1/repositories/#{repo_id}/issues/#{issue_number}/events"
8
+ def issue_events(repo_name, issue_number)
9
+ get "/p1/repositories/#{github.repo_id(repo_name)}/issues/#{issue_number}/events"
10
10
  end
11
11
 
12
- def board_data(repo_id)
13
- get "/p1/repositories/#{repo_id}/board"
12
+ def board_data(repo_name)
13
+ get "/p1/repositories/#{github.repo_id(repo_name)}/board"
14
14
  end
15
15
  end
16
16
  end
@@ -21,7 +21,7 @@ module ZenhubRuby
21
21
  headers: {
22
22
  accept: 'application/json',
23
23
  user_agent: "ZenhubRuby v#{VERSION}",
24
- x_authentication_token: access_token
24
+ x_authentication_token: zenhub_access_token
25
25
  }
26
26
  }
27
27
  end
@@ -0,0 +1,15 @@
1
+ require 'octokit'
2
+
3
+ module ZenhubRuby
4
+ class Github
5
+ attr_reader :auth
6
+
7
+ def initialize(access_token)
8
+ @auth = Octokit::Client.new(access_token: access_token)
9
+ end
10
+
11
+ def repo_id(repo_name)
12
+ auth.repo(repo_name).id
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module ZenhubRuby
2
+ VERSION = '0.2.1'
3
+ end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'zenhub_ruby'
4
+ require 'zenhub_ruby/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "zenhub_ruby"
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency "faraday"
23
23
  spec.add_dependency "faraday_middleware"
24
+ spec.add_dependency 'octokit'
24
25
  spec.add_development_dependency "bundler", "~> 1.11"
25
- spec.add_development_dependency "dotenv"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "rspec"
28
28
  spec.add_development_dependency "vcr"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zenhub_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takumi Kaji
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-06 00:00:00.000000000 Z
11
+ date: 2016-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -39,33 +39,33 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: octokit
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.11'
48
- type: :development
47
+ version: '0'
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.11'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: dotenv
56
+ name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1.11'
62
62
  type: :development
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'
68
+ version: '1.11'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -129,7 +129,6 @@ executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
- - ".env.sample"
133
132
  - ".gitignore"
134
133
  - ".rspec"
135
134
  - Gemfile
@@ -139,6 +138,8 @@ files:
139
138
  - lib/zenhub_ruby/client.rb
140
139
  - lib/zenhub_ruby/client/api.rb
141
140
  - lib/zenhub_ruby/connection.rb
141
+ - lib/zenhub_ruby/github.rb
142
+ - lib/zenhub_ruby/version.rb
142
143
  - zenhub_ruby.gemspec
143
144
  homepage: https://github.com/tkm-kj/zenhub_ruby
144
145
  licenses:
@@ -165,3 +166,4 @@ signing_key:
165
166
  specification_version: 4
166
167
  summary: Ruby client of ZenHub API.
167
168
  test_files: []
169
+ has_rdoc:
@@ -1,3 +0,0 @@
1
- ACCESS_TOKEN='access_token'
2
- ISSUE_NUMBER=77
3
- REPO_ID=7777