tinybucket 1.3.0 → 1.4.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/.rubocop.yml +10 -1
- data/Gemfile +8 -7
- data/README.md +28 -5
- data/Rakefile +1 -0
- data/lib/faraday_middleware/follow_oauth_redirects.rb +5 -2
- data/lib/tinybucket.rb +2 -0
- data/lib/tinybucket/api.rb +3 -0
- data/lib/tinybucket/api/base_api.rb +2 -0
- data/lib/tinybucket/api/branch_restrictions_api.rb +6 -5
- data/lib/tinybucket/api/branches_api.rb +48 -0
- data/lib/tinybucket/api/build_status_api.rb +15 -1
- data/lib/tinybucket/api/comments_api.rb +7 -6
- data/lib/tinybucket/api/commits_api.rb +25 -4
- data/lib/tinybucket/api/diff_api.rb +4 -3
- data/lib/tinybucket/api/helper.rb +3 -0
- data/lib/tinybucket/api/helper/api_helper.rb +2 -0
- data/lib/tinybucket/api/helper/branch_restrictions_helper.rb +2 -0
- data/lib/tinybucket/api/helper/branches_helper.rb +29 -0
- data/lib/tinybucket/api/helper/build_status_helper.rb +11 -0
- data/lib/tinybucket/api/helper/comments_helper.rb +2 -0
- data/lib/tinybucket/api/helper/commits_helper.rb +8 -0
- data/lib/tinybucket/api/helper/diff_helper.rb +2 -0
- data/lib/tinybucket/api/helper/pull_requests_helper.rb +2 -0
- data/lib/tinybucket/api/helper/repo_helper.rb +2 -0
- data/lib/tinybucket/api/helper/repos_helper.rb +2 -0
- data/lib/tinybucket/api/helper/team_helper.rb +2 -0
- data/lib/tinybucket/api/helper/user_helper.rb +2 -0
- data/lib/tinybucket/api/pull_requests_api.rb +4 -3
- data/lib/tinybucket/api/repo_api.rb +4 -3
- data/lib/tinybucket/api/repos_api.rb +3 -1
- data/lib/tinybucket/api/team_api.rb +4 -2
- data/lib/tinybucket/api/user_api.rb +3 -1
- data/lib/tinybucket/api_factory.rb +2 -0
- data/lib/tinybucket/client.rb +3 -2
- data/lib/tinybucket/config.rb +5 -1
- data/lib/tinybucket/connection.rb +21 -8
- data/lib/tinybucket/constants.rb +2 -0
- data/lib/tinybucket/enumerator.rb +2 -0
- data/lib/tinybucket/error.rb +2 -0
- data/lib/tinybucket/error/base_error.rb +2 -0
- data/lib/tinybucket/error/conflict.rb +2 -0
- data/lib/tinybucket/error/not_found.rb +2 -0
- data/lib/tinybucket/error/service_error.rb +2 -0
- data/lib/tinybucket/iterator.rb +4 -2
- data/lib/tinybucket/model.rb +3 -0
- data/lib/tinybucket/model/base.rb +2 -2
- data/lib/tinybucket/model/branch.rb +48 -0
- data/lib/tinybucket/model/branch_restriction.rb +4 -2
- data/lib/tinybucket/model/build_status.rb +3 -1
- data/lib/tinybucket/model/comment.rb +4 -2
- data/lib/tinybucket/model/commit.rb +6 -2
- data/lib/tinybucket/model/concerns.rb +2 -0
- data/lib/tinybucket/model/concerns/acceptable_attributes.rb +2 -0
- data/lib/tinybucket/model/concerns/api_callable.rb +2 -0
- data/lib/tinybucket/model/concerns/enumerable.rb +2 -0
- data/lib/tinybucket/model/concerns/reloadable.rb +2 -0
- data/lib/tinybucket/model/concerns/repository_keys.rb +2 -0
- data/lib/tinybucket/model/error_response.rb +4 -2
- data/lib/tinybucket/model/page.rb +4 -2
- data/lib/tinybucket/model/profile.rb +4 -2
- data/lib/tinybucket/model/pull_request.rb +4 -2
- data/lib/tinybucket/model/repository.rb +31 -5
- data/lib/tinybucket/model/team.rb +4 -2
- data/lib/tinybucket/null_logger.rb +2 -0
- data/lib/tinybucket/parser.rb +5 -0
- data/lib/tinybucket/parser/base_parser.rb +3 -2
- data/lib/tinybucket/parser/branch_parser.rb +13 -0
- data/lib/tinybucket/parser/branch_restriction_parser.rb +2 -0
- data/lib/tinybucket/parser/branch_restrictions_parser.rb +2 -0
- data/lib/tinybucket/parser/branches_parser.rb +11 -0
- data/lib/tinybucket/parser/build_status_parser.rb +2 -0
- data/lib/tinybucket/parser/builds_parser.rb +11 -0
- data/lib/tinybucket/parser/comment_parser.rb +2 -0
- data/lib/tinybucket/parser/comments_parser.rb +2 -0
- data/lib/tinybucket/parser/commit_parser.rb +2 -0
- data/lib/tinybucket/parser/commits_parser.rb +2 -0
- data/lib/tinybucket/parser/profile_parser.rb +2 -0
- data/lib/tinybucket/parser/profiles_parser.rb +2 -0
- data/lib/tinybucket/parser/pull_request_parser.rb +2 -0
- data/lib/tinybucket/parser/pull_requests_parser.rb +2 -0
- data/lib/tinybucket/parser/repo_parser.rb +2 -0
- data/lib/tinybucket/parser/repos_parser.rb +2 -0
- data/lib/tinybucket/parser/team_parser.rb +2 -0
- data/lib/tinybucket/parser/teams_parser.rb +2 -0
- data/lib/tinybucket/request.rb +2 -0
- data/lib/tinybucket/resource.rb +3 -0
- data/lib/tinybucket/resource/base.rb +6 -0
- data/lib/tinybucket/resource/branch_restrictions.rb +2 -0
- data/lib/tinybucket/resource/branches.rb +35 -0
- data/lib/tinybucket/resource/commit/base.rb +2 -0
- data/lib/tinybucket/resource/commit/build_statuses.rb +6 -3
- data/lib/tinybucket/resource/commit/comments.rb +2 -0
- data/lib/tinybucket/resource/commits.rb +13 -0
- data/lib/tinybucket/resource/forks.rb +2 -0
- data/lib/tinybucket/resource/pull_request/base.rb +2 -0
- data/lib/tinybucket/resource/pull_request/comments.rb +2 -0
- data/lib/tinybucket/resource/pull_request/commits.rb +2 -0
- data/lib/tinybucket/resource/pull_requests.rb +2 -0
- data/lib/tinybucket/resource/repos.rb +2 -0
- data/lib/tinybucket/resource/team/base.rb +2 -0
- data/lib/tinybucket/resource/team/followers.rb +2 -0
- data/lib/tinybucket/resource/team/following.rb +2 -0
- data/lib/tinybucket/resource/team/members.rb +2 -0
- data/lib/tinybucket/resource/team/repos.rb +2 -0
- data/lib/tinybucket/resource/user/base.rb +2 -0
- data/lib/tinybucket/resource/user/followers.rb +2 -0
- data/lib/tinybucket/resource/user/following.rb +2 -0
- data/lib/tinybucket/resource/user/repos.rb +2 -0
- data/lib/tinybucket/resource/watchers.rb +2 -0
- data/lib/tinybucket/response.rb +2 -0
- data/lib/tinybucket/response/handler.rb +2 -0
- data/lib/tinybucket/version.rb +3 -1
- data/tinybucket.gemspec +1 -1
- metadata +11 -193
- data/.coveralls.yml +0 -1
- data/.gitignore +0 -33
- data/.rspec +0 -1
- data/.travis.yml +0 -13
- data/Guardfile +0 -13
- data/spec/fixtures/branch_restriction.json +0 -17
- data/spec/fixtures/build_status.json +0 -16
- data/spec/fixtures/comment.json +0 -30
- data/spec/fixtures/commit.json +0 -83
- data/spec/fixtures/profile.json +0 -29
- data/spec/fixtures/pull_request.json +0 -106
- data/spec/fixtures/repositories/get.json +0 -78
- data/spec/fixtures/repositories/test_owner/get.json +0 -78
- data/spec/fixtures/repositories/test_owner/test_repo/branch-restrictions/1/get.json +0 -17
- data/spec/fixtures/repositories/test_owner/test_repo/branch-restrictions/get.json +0 -101
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/approve/post.json +0 -16
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/comments/1/get.json +0 -38
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/comments/get.json +0 -40
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/get.json +0 -83
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/statuses/build/post.json +0 -16
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/statuses/build/test_status/get.json +0 -16
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/statuses/build/test_status/put.json +0 -16
- data/spec/fixtures/repositories/test_owner/test_repo/commits/get.json +0 -73
- data/spec/fixtures/repositories/test_owner/test_repo/diff/1/get.json +0 -21
- data/spec/fixtures/repositories/test_owner/test_repo/forks/get.json +0 -78
- data/spec/fixtures/repositories/test_owner/test_repo/get.json +0 -71
- data/spec/fixtures/repositories/test_owner/test_repo/patch/1/get.json +0 -29
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/approve/delete.json +0 -3
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/approve/post.json +0 -3
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/comments/1/get.json +0 -30
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/comments/get.json +0 -44
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/commits/get.json +0 -66
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/decline/post.json +0 -116
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/diff/get.txt +0 -13
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/get.json +0 -164
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/merge/post.json +0 -123
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get.json +0 -112
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_declined.json +0 -112
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_merged.json +0 -112
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_open.json +0 -112
- data/spec/fixtures/repositories/test_owner/test_repo/watchers/get.json +0 -32
- data/spec/fixtures/repository.json +0 -72
- data/spec/fixtures/team.json +0 -32
- data/spec/fixtures/teams/test_team/followers/get.json +0 -36
- data/spec/fixtures/teams/test_team/following/get.json +0 -39
- data/spec/fixtures/teams/test_team/get.json +0 -32
- data/spec/fixtures/teams/test_team/members/get.json +0 -36
- data/spec/fixtures/teams/test_team/repositories/get.json +0 -125
- data/spec/fixtures/users/test_owner/followers/get.json +0 -65
- data/spec/fixtures/users/test_owner/following/get.json +0 -100
- data/spec/fixtures/users/test_owner/get.json +0 -29
- data/spec/lib/tinybucket/api/branch_restrictions_api_spec.rb +0 -77
- data/spec/lib/tinybucket/api/build_status_api_spec.rb +0 -65
- data/spec/lib/tinybucket/api/comments_api_spec.rb +0 -132
- data/spec/lib/tinybucket/api/commits_api_spec.rb +0 -152
- data/spec/lib/tinybucket/api/diff_api_spec.rb +0 -5
- data/spec/lib/tinybucket/api/pull_requests_api_spec.rb +0 -259
- data/spec/lib/tinybucket/api/repo_api_spec.rb +0 -99
- data/spec/lib/tinybucket/api/repos_api_spec.rb +0 -27
- data/spec/lib/tinybucket/api/team_api_spec.rb +0 -82
- data/spec/lib/tinybucket/api/user_api_spec.rb +0 -73
- data/spec/lib/tinybucket/api_factory_spec.rb +0 -18
- data/spec/lib/tinybucket/client_spec.rb +0 -100
- data/spec/lib/tinybucket/connection_spec.rb +0 -30
- data/spec/lib/tinybucket/error/service_error_spec.rb +0 -23
- data/spec/lib/tinybucket/model/branch_restriction_spec.rb +0 -35
- data/spec/lib/tinybucket/model/build_status_spec.rb +0 -66
- data/spec/lib/tinybucket/model/comment_spec.rb +0 -37
- data/spec/lib/tinybucket/model/commit_spec.rb +0 -108
- data/spec/lib/tinybucket/model/page_spec.rb +0 -28
- data/spec/lib/tinybucket/model/profile_spec.rb +0 -52
- data/spec/lib/tinybucket/model/pull_request_spec.rb +0 -141
- data/spec/lib/tinybucket/model/repository_spec.rb +0 -131
- data/spec/lib/tinybucket/model/team_spec.rb +0 -70
- data/spec/lib/tinybucket/null_logger_spec.rb +0 -53
- data/spec/lib/tinybucket/resource/branch_restrictions_spec.rb +0 -60
- data/spec/lib/tinybucket/resource/commit/build_statuses_spec.rb +0 -50
- data/spec/lib/tinybucket/resource/commit/comments_spec.rb +0 -49
- data/spec/lib/tinybucket/resource/commits_spec.rb +0 -43
- data/spec/lib/tinybucket/resource/forks_spec.rb +0 -36
- data/spec/lib/tinybucket/resource/pull_request/comments_spec.rb +0 -41
- data/spec/lib/tinybucket/resource/pull_request/commits_spec.rb +0 -41
- data/spec/lib/tinybucket/resource/pull_requests_spec.rb +0 -59
- data/spec/lib/tinybucket/resource/repos_spec.rb +0 -76
- data/spec/lib/tinybucket/resource/team/followers_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/team/following_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/team/members_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/team/repos_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/user/followers_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/user/following_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/user/repos_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/watchers_spec.rb +0 -38
- data/spec/lib/tinybucket_spec.rb +0 -42
- data/spec/spec_helper.rb +0 -45
- data/spec/support/api_response_macros.rb +0 -74
- data/spec/support/fixture_macros.rb +0 -5
- data/spec/support/model_macros.rb +0 -103
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed12324002ab5952c612faf543af7d705047ed6c
|
4
|
+
data.tar.gz: db4392d5bbb95d6e40169ca48742baaa9051d8cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ecc10dd11258c440125c0c302540ce6aec02024a00e19d0d82216afc65c5a73048d0bc7c7474f339e7c0b0b4d512785a59aac3998ceef55d3cc1507c7b0dff0
|
7
|
+
data.tar.gz: 72b1d6d150ce83c0b804264159fa37de12d7ab76992ceae6be809f2a80147ba700a62cffd151e51e2098bfee5f5f1a22dcab6b2ea064e84c1eeae980b3713bed
|
data/.rubocop.yml
CHANGED
@@ -2,7 +2,7 @@ AllCops:
|
|
2
2
|
Include:
|
3
3
|
- 'lib/**/*.rb'
|
4
4
|
Exclude:
|
5
|
-
- '
|
5
|
+
- '*.rb'
|
6
6
|
- 'spec/**/*'
|
7
7
|
- 'features/**/*'
|
8
8
|
- 'test/**/*'
|
@@ -44,5 +44,14 @@ Style/AlignHash:
|
|
44
44
|
Style/RaiseArgs:
|
45
45
|
Enabled: false
|
46
46
|
|
47
|
+
Style/RedundantFreeze:
|
48
|
+
Enabled: false
|
49
|
+
|
47
50
|
Metrics/AbcSize:
|
48
51
|
Max: 18
|
52
|
+
|
53
|
+
Metrics/LineLength:
|
54
|
+
Max: 100
|
55
|
+
IgnoredPatterns: [
|
56
|
+
'^\s*#'
|
57
|
+
]
|
data/Gemfile
CHANGED
@@ -3,12 +3,7 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in bitbucket.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem '
|
7
|
-
gem 'rspec', '~> 3.4'
|
8
|
-
gem 'rspec-mocks', '~> 3.4'
|
9
|
-
gem 'webmock', '~> 1.24'
|
10
|
-
gem 'rubocop', '~> 0.41'
|
11
|
-
|
6
|
+
gem 'simple-auth', '~> 0.3.1'
|
12
7
|
gem 'yard', '~> 0.8.7'
|
13
8
|
gem 'yardstick', '~> 0.9'
|
14
9
|
|
@@ -23,10 +18,16 @@ group :development, :test do
|
|
23
18
|
|
24
19
|
gem 'guard-rubocop'
|
25
20
|
gem 'gem-release'
|
21
|
+
|
22
|
+
gem 'rake', '~> 10.4'
|
23
|
+
gem 'rspec', '~> 3.4'
|
24
|
+
gem 'rspec-mocks', '~> 3.4'
|
25
|
+
gem 'webmock', '~> 1.24'
|
26
|
+
gem 'rubocop', '~> 0.46.0'
|
26
27
|
end
|
27
28
|
|
28
29
|
group :test do
|
29
30
|
gem 'simplecov', '~> 0.11', require: false
|
30
31
|
gem 'coveralls', '~> 0.8', require: false
|
31
|
-
gem 'codeclimate-test-reporter', require: nil
|
32
|
+
gem 'codeclimate-test-reporter', '~> 1.0.0', require: nil
|
32
33
|
end
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ And then execute:
|
|
27
27
|
|
28
28
|
Or install it yourself as:
|
29
29
|
|
30
|
-
$ gem install
|
30
|
+
$ gem install tinybucket
|
31
31
|
|
32
32
|
## Usage
|
33
33
|
|
@@ -54,7 +54,11 @@ Tinybucket.configure do |config|
|
|
54
54
|
# optional, default: nil (disable request cache)
|
55
55
|
config.cache_store_options = { store: Rails.cache, logger: logger }
|
56
56
|
|
57
|
-
# Configure
|
57
|
+
# Configure access_token if you can prepare OAuth2 access_token.
|
58
|
+
config.access_token = 'your_access_token'
|
59
|
+
|
60
|
+
# Configure oauth_token/oauth_secret if you want to use OAuth1.0 authentication.
|
61
|
+
# (This config will be ignored if you configure OAuth2 access_token.)
|
58
62
|
config.oauth_token = 'key'
|
59
63
|
config.oauth_secret = 'secret'
|
60
64
|
end
|
@@ -76,15 +80,15 @@ repos = repos('my_name').select do |repo|
|
|
76
80
|
end.map(&:full_name)
|
77
81
|
```
|
78
82
|
|
79
|
-
This enumerable feature depends on [Paging through object collections](https://
|
83
|
+
This enumerable feature depends on [Paging through object collections](https://developer.atlassian.com/bitbucket/api/2/reference/meta/pagination) at Bitbucket Cloud REST API.
|
80
84
|
|
81
85
|
#### NOTE: About `size` attribute
|
82
86
|
|
83
|
-
[object collections wrapper](https://
|
87
|
+
[object collections wrapper](https://developer.atlassian.com/bitbucket/api/2/reference/meta/pagination) has `size` attribute at Bitbucket Cloud REST API.
|
84
88
|
|
85
89
|
The `size` attribute describe as `optional` attribute.
|
86
90
|
|
87
|
-
In tinybucket gem, collection size depend on `side` attribute of [object collections wrapper](https://
|
91
|
+
In tinybucket gem, collection size depend on `side` attribute of [object collections wrapper](https://developer.atlassian.com/bitbucket/api/2/reference/meta/pagination) in Bitbucket Cloud REST API.
|
88
92
|
|
89
93
|
So enumerator's `size` attribute may return `nil`.
|
90
94
|
|
@@ -261,6 +265,25 @@ commit.approve
|
|
261
265
|
commit.unapprove
|
262
266
|
```
|
263
267
|
|
268
|
+
##### branches Resource
|
269
|
+
|
270
|
+
###### Collection Methods
|
271
|
+
|
272
|
+
```ruby
|
273
|
+
repo = bucket.repo('someone', 'great_repo')
|
274
|
+
|
275
|
+
# [x ] GET a list of branches
|
276
|
+
branches = repo.branches(options)
|
277
|
+
```
|
278
|
+
|
279
|
+
###### Object Methods
|
280
|
+
```ruby
|
281
|
+
repo = bucket.repo('someone', 'great_repo')
|
282
|
+
|
283
|
+
# [x] GET a specific branch
|
284
|
+
branch = repo.branch(branch_name)
|
285
|
+
```
|
286
|
+
|
264
287
|
##### branch-restrictions Resource
|
265
288
|
|
266
289
|
###### Collection Methods
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
require 'faraday_middleware'
|
3
5
|
|
@@ -13,8 +15,9 @@ module FaradayMiddleware
|
|
13
15
|
env = super(env, request_body, response)
|
14
16
|
|
15
17
|
# update Authentication Header
|
16
|
-
env
|
17
|
-
oauth_header(env).to_s
|
18
|
+
if oauth_signed_request?(env)
|
19
|
+
env[:request_headers][OAuth::AUTH_HEADER] = oauth_header(env).to_s
|
20
|
+
end
|
18
21
|
|
19
22
|
env
|
20
23
|
end
|
data/lib/tinybucket.rb
CHANGED
data/lib/tinybucket/api.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tinybucket
|
2
4
|
module Api
|
3
5
|
# BranchRestrictions API client
|
4
6
|
#
|
5
|
-
# @see https://
|
7
|
+
# @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/branch-restrictions
|
6
8
|
# branch-restrictions Resource
|
7
9
|
#
|
8
10
|
# @!attribute [rw] repo_owner
|
9
11
|
# @return [String] repository owner name.
|
10
12
|
# @!attribute [rw] repo_slug
|
11
|
-
# @return [String]
|
12
|
-
# repo_slug})
|
13
|
+
# @return [String] {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D repository slug}.
|
13
14
|
class BranchRestrictionsApi < BaseApi
|
14
15
|
include Tinybucket::Api::Helper::BranchRestrictionsHelper
|
15
16
|
|
@@ -17,7 +18,7 @@ module Tinybucket
|
|
17
18
|
|
18
19
|
# Send 'GET the branch-restrictions' request.
|
19
20
|
#
|
20
|
-
# @see https://
|
21
|
+
# @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/branch-restrictions#get
|
21
22
|
# GET the branch-restrictions
|
22
23
|
#
|
23
24
|
# @param options [Hash]
|
@@ -32,7 +33,7 @@ module Tinybucket
|
|
32
33
|
|
33
34
|
# Send 'GET a specific restriction' request.
|
34
35
|
#
|
35
|
-
# @see https://
|
36
|
+
# @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/branch-restrictions/%7Bid%7D#get
|
36
37
|
# GET a specific restriction
|
37
38
|
#
|
38
39
|
# @param restriction_id [String] The restriction's identifier
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tinybucket
|
4
|
+
module Api
|
5
|
+
# Branches Api client
|
6
|
+
#
|
7
|
+
# @!attribute [rw] repo_owner
|
8
|
+
# @return [String] repository owner name.
|
9
|
+
# @!attribute [rw] repo_slug
|
10
|
+
# @return [String] {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D repo_slug}.
|
11
|
+
class BranchesApi < BaseApi
|
12
|
+
include Tinybucket::Api::Helper::BranchesHelper
|
13
|
+
|
14
|
+
attr_accessor :repo_owner, :repo_slug
|
15
|
+
|
16
|
+
# Send 'GET a branches list for a repository' request
|
17
|
+
#
|
18
|
+
# @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/refs/branches#get
|
19
|
+
# GET a branches list for a repository
|
20
|
+
#
|
21
|
+
# @param options [Hash]
|
22
|
+
# @return [Tinybucket::Model::Page]
|
23
|
+
def list(options = {})
|
24
|
+
get_path(
|
25
|
+
path_to_list,
|
26
|
+
options,
|
27
|
+
Tinybucket::Parser::BranchesParser
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Send 'GET an individual branch' request
|
32
|
+
#
|
33
|
+
# @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/refs/branches/%7Bname%7D#get
|
34
|
+
# GET an individual branch
|
35
|
+
#
|
36
|
+
# @param name [String] The branch name
|
37
|
+
# @param options [Hash]
|
38
|
+
# @return [Tinybucket::Model::Branch]
|
39
|
+
def find(name, options = {})
|
40
|
+
get_path(
|
41
|
+
path_to_find(name),
|
42
|
+
options,
|
43
|
+
Tinybucket::Parser::BranchParser
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tinybucket
|
2
4
|
module Api
|
3
5
|
# BuildStatus Api client
|
@@ -7,7 +9,19 @@ module Tinybucket
|
|
7
9
|
class BuildStatusApi < BaseApi
|
8
10
|
include Tinybucket::Api::Helper::BuildStatusHelper
|
9
11
|
|
10
|
-
attr_accessor :repo_owner, :repo_slug
|
12
|
+
attr_accessor :revision, :repo_owner, :repo_slug
|
13
|
+
|
14
|
+
# Send 'GET a builds list for a commit' request
|
15
|
+
#
|
16
|
+
# @param options [Hash]
|
17
|
+
# @return [Tinybucket::Model::Page]
|
18
|
+
def list(options = {})
|
19
|
+
get_path(
|
20
|
+
path_to_list,
|
21
|
+
options,
|
22
|
+
Tinybucket::Parser::BuildsParser
|
23
|
+
)
|
24
|
+
end
|
11
25
|
|
12
26
|
# Send 'GET the build status for a commit' request
|
13
27
|
#
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tinybucket
|
2
4
|
module Api
|
3
5
|
# Comments Api client
|
@@ -5,8 +7,7 @@ module Tinybucket
|
|
5
7
|
# @!attribute [rw] repo_owner
|
6
8
|
# @return [String] repository owner name.
|
7
9
|
# @!attribute [rw] repo_slug
|
8
|
-
# @return [String]
|
9
|
-
# repo_slug})
|
10
|
+
# @return [String] {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D repository slug}.
|
10
11
|
# @!attribute [rw] commented_to
|
11
12
|
# @return [Tinybucket::Model::Commit, Tinybucket::Model::PullRequest]
|
12
13
|
class CommentsApi < BaseApi
|
@@ -21,10 +22,10 @@ module Tinybucket
|
|
21
22
|
# This method send different request depend on 'commented_to' attribute.
|
22
23
|
#
|
23
24
|
# @note When 'commented_to' is {Tinybucket::Model::Commit} instance,
|
24
|
-
# this method send {https://
|
25
|
+
# this method send {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bsha%7D/comments#get
|
25
26
|
# GET a list of commit comments}.
|
26
27
|
# @note When 'commented_to' is {Tinybucket::Model::PullRequest} instance,
|
27
|
-
# this method send {https://
|
28
|
+
# this method send {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bsha%7D/comments#get
|
28
29
|
# GET a list of pull request comments}.
|
29
30
|
#
|
30
31
|
# @param options [Hash]
|
@@ -43,10 +44,10 @@ module Tinybucket
|
|
43
44
|
# This method send different request depend on 'commented_to' attribute.
|
44
45
|
#
|
45
46
|
# @note When 'commented_to' is {Tinybucket::Model::Commit} instance,
|
46
|
-
# this method send {https://
|
47
|
+
# this method send {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bsha%7D/comments/%7Bcomment_id%7D#get
|
47
48
|
# GET an individual commit comment}.
|
48
49
|
# @note When 'commented_to' is {Tinybucket::Model::PullRequest} instance,
|
49
|
-
# this method send {https://
|
50
|
+
# this method send {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bsha%7D/comments/%7Bcomment_id%7D#get
|
50
51
|
# GET an individual pull request comment}.
|
51
52
|
#
|
52
53
|
# @param comment_id [String] comment identifier
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tinybucket
|
2
4
|
module Api
|
3
5
|
# Commits Api client
|
@@ -5,8 +7,7 @@ module Tinybucket
|
|
5
7
|
# @!attribute [rw] repo_owner
|
6
8
|
# @return [String] repository owner name.
|
7
9
|
# @!attribute [rw] repo_slug
|
8
|
-
# @return [String]
|
9
|
-
# repo_slug})
|
10
|
+
# @return [String] {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D repository slug}.
|
10
11
|
class CommitsApi < BaseApi
|
11
12
|
include Tinybucket::Api::Helper::CommitsHelper
|
12
13
|
|
@@ -14,7 +15,7 @@ module Tinybucket
|
|
14
15
|
|
15
16
|
# Send 'GET a commits list for a repository' request
|
16
17
|
#
|
17
|
-
# @see https://
|
18
|
+
# @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commits#get
|
18
19
|
# GET a commits list for a repository
|
19
20
|
#
|
20
21
|
# @note This method does not support 'compare commits across branches'
|
@@ -32,7 +33,7 @@ module Tinybucket
|
|
32
33
|
|
33
34
|
# Send 'GET an individual commit' request
|
34
35
|
#
|
35
|
-
# @see https://
|
36
|
+
# @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commits/%7Brevision%7D#get
|
36
37
|
# GET an individual commit
|
37
38
|
#
|
38
39
|
# @param revision [String] A SHA1 value for the commit.
|
@@ -47,6 +48,8 @@ module Tinybucket
|
|
47
48
|
end
|
48
49
|
|
49
50
|
# Send 'POST a commit approval' request
|
51
|
+
# @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/approve#post
|
52
|
+
# POST a commit approval request
|
50
53
|
#
|
51
54
|
# @param revision [String]
|
52
55
|
# @param options [Hash]
|
@@ -60,6 +63,8 @@ module Tinybucket
|
|
60
63
|
end
|
61
64
|
|
62
65
|
# Send 'DELETE a commit approval' request
|
66
|
+
# @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/approve#delete
|
67
|
+
# DELETE a commit approval (unapprove the commit)
|
63
68
|
#
|
64
69
|
# @param revision [String]
|
65
70
|
# @param options [Hash]
|
@@ -71,6 +76,22 @@ module Tinybucket
|
|
71
76
|
logger.debug 'Already unapproved: ' + e.inspect
|
72
77
|
true
|
73
78
|
end
|
79
|
+
|
80
|
+
# Send 'GET commits for a branch' request
|
81
|
+
#
|
82
|
+
# @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commits
|
83
|
+
# GET an individual commit
|
84
|
+
#
|
85
|
+
# @param name [String] The branch name or a SHA1 value for the commit.
|
86
|
+
# @param options [Hash]
|
87
|
+
# @return [Tinybucket::Model::Commit]
|
88
|
+
def branch(name, options = {})
|
89
|
+
get_path(
|
90
|
+
path_to_branch(name),
|
91
|
+
options,
|
92
|
+
Tinybucket::Parser::CommitsParser
|
93
|
+
)
|
94
|
+
end
|
74
95
|
end
|
75
96
|
end
|
76
97
|
end
|
@@ -1,15 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tinybucket
|
2
4
|
module Api
|
3
5
|
# Diff Api client
|
4
6
|
#
|
5
|
-
# @see https://
|
7
|
+
# @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/diff/%7Bspec%7D
|
6
8
|
# diff Resource
|
7
9
|
#
|
8
10
|
# @!attribute [rw] repo_owner
|
9
11
|
# @return [String] repository owner name.
|
10
12
|
# @!attribute [rw] repo_slug
|
11
|
-
# @return [String]
|
12
|
-
# repo_slug})
|
13
|
+
# @return [String] {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D repository slug}.
|
13
14
|
class DiffApi < BaseApi
|
14
15
|
include Tinybucket::Api::Helper::DiffHelper
|
15
16
|
|