tb-bjb 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +86 -0
- data/Gemfile +32 -0
- data/LICENSE +21 -0
- data/README.md +387 -0
- data/Rakefile +47 -0
- data/lib/faraday_middleware/follow_oauth_redirects.rb +71 -0
- data/lib/tinybucket.rb +76 -0
- data/lib/tinybucket/api.rb +25 -0
- data/lib/tinybucket/api/base_api.rb +44 -0
- data/lib/tinybucket/api/branch_restrictions_api.rb +51 -0
- data/lib/tinybucket/api/branches_api.rb +48 -0
- data/lib/tinybucket/api/build_status_api.rb +69 -0
- data/lib/tinybucket/api/comments_api.rb +81 -0
- data/lib/tinybucket/api/commits_api.rb +97 -0
- data/lib/tinybucket/api/diff_api.rb +40 -0
- data/lib/tinybucket/api/helper.rb +27 -0
- data/lib/tinybucket/api/helper/api_helper.rb +39 -0
- data/lib/tinybucket/api/helper/branch_restrictions_helper.rb +29 -0
- data/lib/tinybucket/api/helper/branches_helper.rb +29 -0
- data/lib/tinybucket/api/helper/build_status_helper.rb +46 -0
- data/lib/tinybucket/api/helper/comments_helper.rb +51 -0
- data/lib/tinybucket/api/helper/commits_helper.rb +42 -0
- data/lib/tinybucket/api/helper/diff_helper.rb +31 -0
- data/lib/tinybucket/api/helper/projects_helper.rb +28 -0
- data/lib/tinybucket/api/helper/pull_requests_helper.rb +67 -0
- data/lib/tinybucket/api/helper/repo_helper.rb +31 -0
- data/lib/tinybucket/api/helper/repos_helper.rb +23 -0
- data/lib/tinybucket/api/helper/team_helper.rb +45 -0
- data/lib/tinybucket/api/helper/user_helper.rb +33 -0
- data/lib/tinybucket/api/projects_api.rb +26 -0
- data/lib/tinybucket/api/pull_requests_api.rb +139 -0
- data/lib/tinybucket/api/repo_api.rb +56 -0
- data/lib/tinybucket/api/repos_api.rb +28 -0
- data/lib/tinybucket/api/team_api.rb +91 -0
- data/lib/tinybucket/api/user_api.rb +66 -0
- data/lib/tinybucket/api_factory.rb +21 -0
- data/lib/tinybucket/client.rb +107 -0
- data/lib/tinybucket/config.rb +10 -0
- data/lib/tinybucket/connection.rb +84 -0
- data/lib/tinybucket/constants.rb +7 -0
- data/lib/tinybucket/enumerator.rb +47 -0
- data/lib/tinybucket/error.rb +12 -0
- data/lib/tinybucket/error/base_error.rb +14 -0
- data/lib/tinybucket/error/conflict.rb +8 -0
- data/lib/tinybucket/error/not_found.rb +8 -0
- data/lib/tinybucket/error/service_error.rb +26 -0
- data/lib/tinybucket/iterator.rb +79 -0
- data/lib/tinybucket/model.rb +25 -0
- data/lib/tinybucket/model/base.rb +45 -0
- data/lib/tinybucket/model/branch.rb +48 -0
- data/lib/tinybucket/model/branch_restriction.rb +46 -0
- data/lib/tinybucket/model/build_status.rb +57 -0
- data/lib/tinybucket/model/comment.rb +67 -0
- data/lib/tinybucket/model/commit.rb +114 -0
- data/lib/tinybucket/model/concerns.rb +19 -0
- data/lib/tinybucket/model/concerns/acceptable_attributes.rb +34 -0
- data/lib/tinybucket/model/concerns/api_callable.rb +21 -0
- data/lib/tinybucket/model/concerns/enumerable.rb +20 -0
- data/lib/tinybucket/model/concerns/reloadable.rb +41 -0
- data/lib/tinybucket/model/concerns/repository_keys.rb +45 -0
- data/lib/tinybucket/model/error_response.rb +24 -0
- data/lib/tinybucket/model/page.rb +45 -0
- data/lib/tinybucket/model/profile.rb +70 -0
- data/lib/tinybucket/model/project.rb +44 -0
- data/lib/tinybucket/model/pull_request.rb +162 -0
- data/lib/tinybucket/model/repository.rb +219 -0
- data/lib/tinybucket/model/team.rb +96 -0
- data/lib/tinybucket/null_logger.rb +37 -0
- data/lib/tinybucket/parser.rb +15 -0
- data/lib/tinybucket/parser/collection_parser.rb +17 -0
- data/lib/tinybucket/parser/object_parser.rb +17 -0
- data/lib/tinybucket/request.rb +61 -0
- data/lib/tinybucket/resource.rb +75 -0
- data/lib/tinybucket/resource/base.rb +35 -0
- data/lib/tinybucket/resource/branch_restrictions.rb +47 -0
- data/lib/tinybucket/resource/branches.rb +35 -0
- data/lib/tinybucket/resource/commit/base.rb +14 -0
- data/lib/tinybucket/resource/commit/build_statuses.rb +50 -0
- data/lib/tinybucket/resource/commit/comments.rb +34 -0
- data/lib/tinybucket/resource/commits.rb +46 -0
- data/lib/tinybucket/resource/forks.rb +24 -0
- data/lib/tinybucket/resource/projects.rb +49 -0
- data/lib/tinybucket/resource/pull_request/base.rb +20 -0
- data/lib/tinybucket/resource/pull_request/comments.rb +32 -0
- data/lib/tinybucket/resource/pull_request/commits.rb +19 -0
- data/lib/tinybucket/resource/pull_requests.rb +52 -0
- data/lib/tinybucket/resource/repos.rb +40 -0
- data/lib/tinybucket/resource/team/base.rb +24 -0
- data/lib/tinybucket/resource/team/followers.rb +15 -0
- data/lib/tinybucket/resource/team/following.rb +15 -0
- data/lib/tinybucket/resource/team/members.rb +15 -0
- data/lib/tinybucket/resource/team/repos.rb +15 -0
- data/lib/tinybucket/resource/teams.rb +22 -0
- data/lib/tinybucket/resource/user/base.rb +26 -0
- data/lib/tinybucket/resource/user/followers.rb +15 -0
- data/lib/tinybucket/resource/user/following.rb +15 -0
- data/lib/tinybucket/resource/user/repos.rb +15 -0
- data/lib/tinybucket/resource/watchers.rb +24 -0
- data/lib/tinybucket/response.rb +9 -0
- data/lib/tinybucket/response/handler.rb +23 -0
- data/lib/tinybucket/version.rb +5 -0
- data/tinybucket.gemspec +30 -0
- metadata +244 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tinybucket
|
4
|
+
module Resource
|
5
|
+
class Watchers < Base
|
6
|
+
def initialize(repo, options)
|
7
|
+
@repo = repo
|
8
|
+
@args = [options]
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def repo_api
|
14
|
+
create_api('Repo', @repo.repo_keys)
|
15
|
+
end
|
16
|
+
|
17
|
+
def enumerator
|
18
|
+
create_enumerator(repo_api, :watchers, *@args) do |m|
|
19
|
+
inject_repo_keys(m, @repo.repo_keys)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tinybucket
|
4
|
+
module Response
|
5
|
+
class Handler < Faraday::Response::Middleware
|
6
|
+
def on_complete(env)
|
7
|
+
status_code = env[:status].to_i
|
8
|
+
|
9
|
+
return if status_code < 400
|
10
|
+
|
11
|
+
case status_code
|
12
|
+
when 404
|
13
|
+
raise Tinybucket::Error::NotFound.new(env)
|
14
|
+
when 409
|
15
|
+
raise Tinybucket::Error::Conflict.new(env)
|
16
|
+
else
|
17
|
+
Tinybucket.logger.error "Invalid response code:#{status_code}"
|
18
|
+
raise Tinybucket::Error::ServiceError.new(env)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/tinybucket.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'tinybucket/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'tb-bjb'
|
9
|
+
spec.version = Tinybucket::VERSION
|
10
|
+
spec.authors = ['hirakiuc']
|
11
|
+
spec.email = ['hirakiuc@gmail.com']
|
12
|
+
spec.summary = 'ruby wrapper for the Bitbucket REST API (v2) with oauth'
|
13
|
+
spec.description = 'ruby wrapper for the Bitbucket REST API (v2) with oauth inspired by vongrippen/bitbucket.'
|
14
|
+
spec.homepage = 'http://hirakiuc.github.io/tinybucket/'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = Dir['lib/**/*', 'LICENSE', 'Rakefile', 'Gemfile', 'tinybucket.gemspec', 'README.md', '.rubocop.yml']
|
18
|
+
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_runtime_dependency 'activemodel', ['>= 4.1.6']
|
23
|
+
spec.add_runtime_dependency 'activesupport', ['>= 4.1.6']
|
24
|
+
spec.add_runtime_dependency 'faraday', ['~> 0.9']
|
25
|
+
spec.add_runtime_dependency 'faraday_middleware', ['~> 0.10']
|
26
|
+
spec.add_runtime_dependency 'faraday-http-cache', ['~> 1.2']
|
27
|
+
spec.add_runtime_dependency 'simple_oauth', ['~> 0.3']
|
28
|
+
|
29
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,244 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tb-bjb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.6.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- hirakiuc
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-12-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activemodel
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.1.6
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.1.6
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.1.6
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.1.6
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.9'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: faraday_middleware
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.10'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: faraday-http-cache
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.2'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simple_oauth
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.3'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: bundler
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.10'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.10'
|
111
|
+
description: ruby wrapper for the Bitbucket REST API (v2) with oauth inspired by vongrippen/bitbucket.
|
112
|
+
email:
|
113
|
+
- hirakiuc@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".rubocop.yml"
|
119
|
+
- Gemfile
|
120
|
+
- LICENSE
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- lib/faraday_middleware/follow_oauth_redirects.rb
|
124
|
+
- lib/tinybucket.rb
|
125
|
+
- lib/tinybucket/api.rb
|
126
|
+
- lib/tinybucket/api/base_api.rb
|
127
|
+
- lib/tinybucket/api/branch_restrictions_api.rb
|
128
|
+
- lib/tinybucket/api/branches_api.rb
|
129
|
+
- lib/tinybucket/api/build_status_api.rb
|
130
|
+
- lib/tinybucket/api/comments_api.rb
|
131
|
+
- lib/tinybucket/api/commits_api.rb
|
132
|
+
- lib/tinybucket/api/diff_api.rb
|
133
|
+
- lib/tinybucket/api/helper.rb
|
134
|
+
- lib/tinybucket/api/helper/api_helper.rb
|
135
|
+
- lib/tinybucket/api/helper/branch_restrictions_helper.rb
|
136
|
+
- lib/tinybucket/api/helper/branches_helper.rb
|
137
|
+
- lib/tinybucket/api/helper/build_status_helper.rb
|
138
|
+
- lib/tinybucket/api/helper/comments_helper.rb
|
139
|
+
- lib/tinybucket/api/helper/commits_helper.rb
|
140
|
+
- lib/tinybucket/api/helper/diff_helper.rb
|
141
|
+
- lib/tinybucket/api/helper/projects_helper.rb
|
142
|
+
- lib/tinybucket/api/helper/pull_requests_helper.rb
|
143
|
+
- lib/tinybucket/api/helper/repo_helper.rb
|
144
|
+
- lib/tinybucket/api/helper/repos_helper.rb
|
145
|
+
- lib/tinybucket/api/helper/team_helper.rb
|
146
|
+
- lib/tinybucket/api/helper/user_helper.rb
|
147
|
+
- lib/tinybucket/api/projects_api.rb
|
148
|
+
- lib/tinybucket/api/pull_requests_api.rb
|
149
|
+
- lib/tinybucket/api/repo_api.rb
|
150
|
+
- lib/tinybucket/api/repos_api.rb
|
151
|
+
- lib/tinybucket/api/team_api.rb
|
152
|
+
- lib/tinybucket/api/user_api.rb
|
153
|
+
- lib/tinybucket/api_factory.rb
|
154
|
+
- lib/tinybucket/client.rb
|
155
|
+
- lib/tinybucket/config.rb
|
156
|
+
- lib/tinybucket/connection.rb
|
157
|
+
- lib/tinybucket/constants.rb
|
158
|
+
- lib/tinybucket/enumerator.rb
|
159
|
+
- lib/tinybucket/error.rb
|
160
|
+
- lib/tinybucket/error/base_error.rb
|
161
|
+
- lib/tinybucket/error/conflict.rb
|
162
|
+
- lib/tinybucket/error/not_found.rb
|
163
|
+
- lib/tinybucket/error/service_error.rb
|
164
|
+
- lib/tinybucket/iterator.rb
|
165
|
+
- lib/tinybucket/model.rb
|
166
|
+
- lib/tinybucket/model/base.rb
|
167
|
+
- lib/tinybucket/model/branch.rb
|
168
|
+
- lib/tinybucket/model/branch_restriction.rb
|
169
|
+
- lib/tinybucket/model/build_status.rb
|
170
|
+
- lib/tinybucket/model/comment.rb
|
171
|
+
- lib/tinybucket/model/commit.rb
|
172
|
+
- lib/tinybucket/model/concerns.rb
|
173
|
+
- lib/tinybucket/model/concerns/acceptable_attributes.rb
|
174
|
+
- lib/tinybucket/model/concerns/api_callable.rb
|
175
|
+
- lib/tinybucket/model/concerns/enumerable.rb
|
176
|
+
- lib/tinybucket/model/concerns/reloadable.rb
|
177
|
+
- lib/tinybucket/model/concerns/repository_keys.rb
|
178
|
+
- lib/tinybucket/model/error_response.rb
|
179
|
+
- lib/tinybucket/model/page.rb
|
180
|
+
- lib/tinybucket/model/profile.rb
|
181
|
+
- lib/tinybucket/model/project.rb
|
182
|
+
- lib/tinybucket/model/pull_request.rb
|
183
|
+
- lib/tinybucket/model/repository.rb
|
184
|
+
- lib/tinybucket/model/team.rb
|
185
|
+
- lib/tinybucket/null_logger.rb
|
186
|
+
- lib/tinybucket/parser.rb
|
187
|
+
- lib/tinybucket/parser/collection_parser.rb
|
188
|
+
- lib/tinybucket/parser/object_parser.rb
|
189
|
+
- lib/tinybucket/request.rb
|
190
|
+
- lib/tinybucket/resource.rb
|
191
|
+
- lib/tinybucket/resource/base.rb
|
192
|
+
- lib/tinybucket/resource/branch_restrictions.rb
|
193
|
+
- lib/tinybucket/resource/branches.rb
|
194
|
+
- lib/tinybucket/resource/commit/base.rb
|
195
|
+
- lib/tinybucket/resource/commit/build_statuses.rb
|
196
|
+
- lib/tinybucket/resource/commit/comments.rb
|
197
|
+
- lib/tinybucket/resource/commits.rb
|
198
|
+
- lib/tinybucket/resource/forks.rb
|
199
|
+
- lib/tinybucket/resource/projects.rb
|
200
|
+
- lib/tinybucket/resource/pull_request/base.rb
|
201
|
+
- lib/tinybucket/resource/pull_request/comments.rb
|
202
|
+
- lib/tinybucket/resource/pull_request/commits.rb
|
203
|
+
- lib/tinybucket/resource/pull_requests.rb
|
204
|
+
- lib/tinybucket/resource/repos.rb
|
205
|
+
- lib/tinybucket/resource/team/base.rb
|
206
|
+
- lib/tinybucket/resource/team/followers.rb
|
207
|
+
- lib/tinybucket/resource/team/following.rb
|
208
|
+
- lib/tinybucket/resource/team/members.rb
|
209
|
+
- lib/tinybucket/resource/team/repos.rb
|
210
|
+
- lib/tinybucket/resource/teams.rb
|
211
|
+
- lib/tinybucket/resource/user/base.rb
|
212
|
+
- lib/tinybucket/resource/user/followers.rb
|
213
|
+
- lib/tinybucket/resource/user/following.rb
|
214
|
+
- lib/tinybucket/resource/user/repos.rb
|
215
|
+
- lib/tinybucket/resource/watchers.rb
|
216
|
+
- lib/tinybucket/response.rb
|
217
|
+
- lib/tinybucket/response/handler.rb
|
218
|
+
- lib/tinybucket/version.rb
|
219
|
+
- tinybucket.gemspec
|
220
|
+
homepage: http://hirakiuc.github.io/tinybucket/
|
221
|
+
licenses:
|
222
|
+
- MIT
|
223
|
+
metadata: {}
|
224
|
+
post_install_message:
|
225
|
+
rdoc_options: []
|
226
|
+
require_paths:
|
227
|
+
- lib
|
228
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
229
|
+
requirements:
|
230
|
+
- - ">="
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: '0'
|
233
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
|
+
requirements:
|
235
|
+
- - ">="
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: '0'
|
238
|
+
requirements: []
|
239
|
+
rubyforge_project:
|
240
|
+
rubygems_version: 2.5.2
|
241
|
+
signing_key:
|
242
|
+
specification_version: 4
|
243
|
+
summary: ruby wrapper for the Bitbucket REST API (v2) with oauth
|
244
|
+
test_files: []
|