zenhub_ruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a14e2084faadd08af3422e4b48c9da858daf389a
4
+ data.tar.gz: e2c8942b6966b8ff6e563a35d6cc1720c9796c85
5
+ SHA512:
6
+ metadata.gz: 290ace6a6c01e305a11503a707e98dad638e6c1c31ce5dea28513c19e3c5faa3d9086929910e49a9da6c2ddca4ac0939ce6453eb1e47e0f9f2a5ddcf85dc5f34
7
+ data.tar.gz: 092e799506bd795310e56365814a5cf77c84aa5001ad06c9232cf55c1670152dee20551c3e50551eb4511fb4563c8d36d5e2c5f4c2f44c24fe353a20831b426f
@@ -0,0 +1,3 @@
1
+ ACCESS_TOKEN='access_token'
2
+ ISSUE_NUMBER=77
3
+ REPO_ID=7777
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /tmp/
9
+ .env
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in zenhub_ruby.gemspec
4
+ gemspec
@@ -0,0 +1,59 @@
1
+ # zenhub_ruby
2
+
3
+ Ruby client of [ZenHub API](https://github.com/ZenHubIO/API)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'zenhub_ruby'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install zenhub_ruby
20
+
21
+ ## Usage
22
+
23
+ ### Setup
24
+
25
+ ```ruby
26
+ require 'zenhub_ruby'
27
+
28
+ client = ZenhubRuby::Client.new('YOUR_ACCESS_TOKEN')
29
+ ```
30
+
31
+ ### Get issue data
32
+
33
+ ```ruby
34
+ client.issue_data(repo_id: 'REPO_ID', issue_number: 'ISSUE_NUMBER')
35
+ ```
36
+
37
+ ### Get issue events
38
+
39
+ ```ruby
40
+ client.issue_events(repo_id: 'REPO_ID', issue_number: 'ISSUE_NUMBER')
41
+ ```
42
+
43
+ ### Get the ZenHub Board data for a repository
44
+
45
+ ```ruby
46
+ client.board_data(repo_id: 'REPO_ID')
47
+ ```
48
+
49
+ ## Contributing
50
+
51
+ 1. Fork it
52
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
53
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
54
+ 4. Push to the branch (`git push origin my-new-feature`)
55
+ 5. Create new Pull Request
56
+
57
+ ## License
58
+
59
+ MIT
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,5 @@
1
+ require 'zenhub_ruby/client'
2
+
3
+ module ZenhubRuby
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,15 @@
1
+ require 'zenhub_ruby/connection'
2
+ require 'zenhub_ruby/client/api'
3
+
4
+ module ZenhubRuby
5
+ class Client
6
+ include ZenhubRuby::Connection
7
+ include ZenhubRuby::Client::Api
8
+
9
+ attr_reader :access_token
10
+
11
+ def initialize(access_token)
12
+ @access_token = access_token
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ module ZenhubRuby
2
+ class Client
3
+ module Api
4
+ def issue_data(repo_id: nil, issue_number: nil)
5
+ get "/p1/repositories/#{repo_id}/issues/#{issue_number}"
6
+ end
7
+
8
+ def issue_events(repo_id: nil, issue_number: nil)
9
+ get "/p1/repositories/#{repo_id}/issues/#{issue_number}/events"
10
+ end
11
+
12
+ def board_data(repo_id: nil)
13
+ get "/p1/repositories/#{repo_id}/board"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,37 @@
1
+ require 'faraday'
2
+ require 'faraday_middleware'
3
+
4
+ module ZenhubRuby
5
+ module Connection
6
+ END_POINT = 'https://api.zenhub.io'.freeze
7
+
8
+ def get(path)
9
+ api_connection.get(path)
10
+ end
11
+
12
+ private
13
+
14
+ def api_connection
15
+ @api_connection ||= Faraday::Connection.new(END_POINT, connect_options)
16
+ end
17
+
18
+ def connect_options
19
+ @connect_options ||= {
20
+ builder: middleware,
21
+ headers: {
22
+ accept: 'application/json',
23
+ user_agent: "ZenhubRuby v#{VERSION}",
24
+ x_authentication_token: access_token
25
+ }
26
+ }
27
+ end
28
+
29
+ def middleware
30
+ @middleware ||= Faraday::RackBuilder.new do |builder|
31
+ builder.request :url_encoded
32
+ builder.adapter :net_http
33
+ builder.response :json, content_type: /\bjson$/
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'zenhub_ruby'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "zenhub_ruby"
8
+ spec.version = ZenhubRuby::VERSION
9
+ spec.authors = ["Takumi Kaji"]
10
+ spec.email = ["ivezuki3@gmail.com"]
11
+
12
+ spec.summary = %q{Ruby client of ZenHub API.}
13
+ spec.description = %q{Ruby client of ZenHub API.}
14
+ spec.homepage = 'https://github.com/tkm-kj/zenhub_ruby'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "faraday"
23
+ spec.add_dependency "faraday_middleware"
24
+ spec.add_development_dependency "bundler", "~> 1.11"
25
+ spec.add_development_dependency "dotenv"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rspec"
28
+ spec.add_development_dependency "vcr"
29
+ spec.add_development_dependency "webmock"
30
+ end
metadata ADDED
@@ -0,0 +1,168 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zenhub_ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Takumi Kaji
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-05-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday_middleware
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.11'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.11'
55
+ - !ruby/object:Gem::Dependency
56
+ name: dotenv
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: vcr
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: Ruby client of ZenHub API.
126
+ email:
127
+ - ivezuki3@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".env.sample"
133
+ - ".gitignore"
134
+ - ".rspec"
135
+ - Gemfile
136
+ - README.md
137
+ - Rakefile
138
+ - lib/zenhub_ruby.rb
139
+ - lib/zenhub_ruby/client.rb
140
+ - lib/zenhub_ruby/client/api.rb
141
+ - lib/zenhub_ruby/connection.rb
142
+ - zenhub_ruby.gemspec
143
+ homepage: https://github.com/tkm-kj/zenhub_ruby
144
+ licenses:
145
+ - MIT
146
+ metadata: {}
147
+ post_install_message:
148
+ rdoc_options: []
149
+ require_paths:
150
+ - lib
151
+ required_ruby_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ requirements: []
162
+ rubyforge_project:
163
+ rubygems_version: 2.5.1
164
+ signing_key:
165
+ specification_version: 4
166
+ summary: Ruby client of ZenHub API.
167
+ test_files: []
168
+ has_rdoc: