tinybucket 0.1.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +2 -1
- data/Gemfile +4 -4
- data/README.md +48 -20
- data/Rakefile +7 -0
- data/lib/tinybucket.rb +7 -4
- data/lib/tinybucket/api/base_api.rb +2 -19
- data/lib/tinybucket/api/branch_restrictions_api.rb +35 -11
- data/lib/tinybucket/api/comments_api.rb +38 -4
- data/lib/tinybucket/api/commits_api.rb +60 -10
- data/lib/tinybucket/api/diff_api.rb +22 -0
- data/lib/tinybucket/api/helper/api_helper.rb +0 -11
- data/lib/tinybucket/api/helper/commits_helper.rb +7 -0
- data/lib/tinybucket/api/pull_requests_api.rb +79 -22
- data/lib/tinybucket/api/repo_api.rb +37 -17
- data/lib/tinybucket/api/repos_api.rb +13 -6
- data/lib/tinybucket/api/team_api.rb +54 -29
- data/lib/tinybucket/api/user_api.rb +43 -23
- data/lib/tinybucket/api_factory.rb +2 -4
- data/lib/tinybucket/client.rb +39 -20
- data/lib/tinybucket/config.rb +1 -1
- data/lib/tinybucket/connection.rb +3 -3
- data/lib/tinybucket/enumerator.rb +44 -0
- data/lib/tinybucket/error.rb +2 -0
- data/lib/tinybucket/error/conflict.rb +6 -0
- data/lib/tinybucket/error/not_found.rb +6 -0
- data/lib/tinybucket/error/service_error.rb +8 -4
- data/lib/tinybucket/iterator.rb +77 -0
- data/lib/tinybucket/model/base.rb +6 -6
- data/lib/tinybucket/model/branch_restriction.rb +27 -0
- data/lib/tinybucket/model/comment.rb +32 -6
- data/lib/tinybucket/model/commit.rb +63 -9
- data/lib/tinybucket/model/concerns.rb +1 -0
- data/lib/tinybucket/model/concerns/enumerable.rb +18 -0
- data/lib/tinybucket/model/error_response.rb +16 -1
- data/lib/tinybucket/model/page.rb +25 -49
- data/lib/tinybucket/model/profile.rb +56 -8
- data/lib/tinybucket/model/pull_request.rb +114 -18
- data/lib/tinybucket/model/repository.rb +177 -36
- data/lib/tinybucket/model/team.rb +70 -10
- data/lib/tinybucket/request.rb +2 -0
- data/lib/tinybucket/response.rb +1 -1
- data/lib/tinybucket/response/handler.rb +21 -0
- data/lib/tinybucket/version.rb +1 -1
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/approve/post.json +16 -0
- data/spec/lib/tinybucket/api/branch_restrictions_api_spec.rb +1 -2
- data/spec/lib/tinybucket/api/comments_api_spec.rb +1 -2
- data/spec/lib/tinybucket/api/commits_api_spec.rb +92 -3
- data/spec/lib/tinybucket/api/pull_requests_api_spec.rb +34 -4
- data/spec/lib/tinybucket/api/repo_api_spec.rb +1 -2
- data/spec/lib/tinybucket/api/repos_api_spec.rb +1 -2
- data/spec/lib/tinybucket/api/team_api_spec.rb +1 -6
- data/spec/lib/tinybucket/api/user_api_spec.rb +15 -2
- data/spec/lib/tinybucket/api_factory_spec.rb +2 -7
- data/spec/lib/tinybucket/client_spec.rb +10 -25
- data/spec/lib/tinybucket/error/service_error_spec.rb +23 -0
- data/spec/lib/tinybucket/model/commit_spec.rb +27 -4
- data/spec/lib/tinybucket/model/page_spec.rb +0 -30
- data/spec/lib/tinybucket/model/profile_spec.rb +3 -3
- data/spec/lib/tinybucket/model/pull_request_spec.rb +11 -5
- data/spec/lib/tinybucket/model/repository_spec.rb +5 -5
- data/spec/lib/tinybucket/model/team_spec.rb +4 -4
- data/spec/lib/tinybucket_spec.rb +10 -27
- data/spec/spec_helper.rb +3 -2
- data/spec/support/api_response_macros.rb +2 -2
- metadata +12 -3
- data/lib/tinybucket/response/error_handler.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d07ebbc76492e41177f7ff796acae6d1c57f6444
|
4
|
+
data.tar.gz: 84b11267ed48262a4a47295f495cbfa55430c421
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d54aa23f2e5b42c4a16e7bd43319f66775cd222652116a53ec3ac9761dc86fcb30de11297bed60bb6ab26a27c8ded1e371f56f45f670e0f75b935bc94536c7b
|
7
|
+
data.tar.gz: 9646a04e42350d5f6878a0343e52afd22d929c29602ed3e192eae45874193bd2cab12bba3b58f91b573a1ecf57eb19c5db402990874dbaeef23f2ce5874fbea8
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
@@ -6,11 +6,11 @@ gemspec
|
|
6
6
|
gem 'rake', '~> 10.4'
|
7
7
|
gem 'rspec', '~> 3.4'
|
8
8
|
gem 'rspec-mocks', '~> 3.4'
|
9
|
-
gem 'webmock', '~> 1.
|
10
|
-
gem 'rubocop', '~> 0.
|
9
|
+
gem 'webmock', '~> 1.24'
|
10
|
+
gem 'rubocop', '~> 0.38'
|
11
11
|
|
12
|
-
gem 'yard', '~> 0.8'
|
13
|
-
gem 'yardstick', '~> 0.9
|
12
|
+
gem 'yard', '~> 0.8.7'
|
13
|
+
gem 'yardstick', '~> 0.9'
|
14
14
|
|
15
15
|
group :development, :test do
|
16
16
|
gem 'pry'
|
data/README.md
CHANGED
@@ -11,8 +11,9 @@ This gem is inspired by [vongrippen/bitbucket](https://github.com/vongrippen/bit
|
|
11
11
|
[![Build Status](https://travis-ci.org/hirakiuc/tinybucket.svg?branch=master)](https://travis-ci.org/hirakiuc/tinybucket)
|
12
12
|
[![Code Climate](https://codeclimate.com/github/hirakiuc/tinybucket/badges/gpa.svg)](https://codeclimate.com/github/hirakiuc/tinybucket)
|
13
13
|
[![Coverage Status](https://coveralls.io/repos/hirakiuc/tinybucket/badge.png?branch=master)](https://coveralls.io/r/hirakiuc/tinybucket?branch=master)
|
14
|
+
[![Inline docs](http://inch-ci.org/github/hirakiuc/tinybucket.svg?branch=master)](http://inch-ci.org/github/hirakiuc/tinybucket)
|
14
15
|
|
15
|
-
[
|
16
|
+
[yard doc](http://www.rubydoc.info/github/hirakiuc/tinybucket/master) (master branch)
|
16
17
|
|
17
18
|
## Installation
|
18
19
|
|
@@ -42,31 +43,58 @@ This gem use built-in null_logger in default.
|
|
42
43
|
|
43
44
|
If you want to set your logger, configure like this.
|
44
45
|
|
45
|
-
```
|
46
|
+
```ruby
|
46
47
|
logger = Logger.new($stdout)
|
47
48
|
logger.level = Logger::WARN
|
48
49
|
|
49
50
|
Tinybucket.configure do |config|
|
50
51
|
config.logger = logger
|
52
|
+
|
53
|
+
# configure oauth_token/oauth_secret
|
54
|
+
config.oauth_token = 'key'
|
55
|
+
config.oauth_secret = 'secret'
|
51
56
|
end
|
52
57
|
```
|
53
58
|
|
54
|
-
###
|
59
|
+
### Pagination
|
55
60
|
|
56
|
-
|
57
|
-
|
58
|
-
|
61
|
+
After v1.0.0, tinybucket gem support [lazy enumerator](http://ruby-doc.org/core-2.2.0/Enumerator/Lazy.html) !
|
62
|
+
|
63
|
+
This feature make your code more rubyish, like this.
|
59
64
|
|
65
|
+
```ruby
|
66
|
+
# get enumerator to enumerate repositories.
|
67
|
+
repos = bucket.repos('myname')
|
68
|
+
|
69
|
+
# Select repositories which has 2 pull requests to be reviewed.
|
70
|
+
repos = repos('my_name').select do |repo|
|
71
|
+
repo.pull_requests.size > 2
|
72
|
+
end.map(&:full_name)
|
60
73
|
```
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
74
|
+
|
75
|
+
This enumerable feature depends on [Paging through object collections](https://confluence.atlassian.com/bitbucket/version-2-423626329.html#Version2-Pagingthroughobjectcollections) at Bitbucket Cloud REST API.
|
76
|
+
|
77
|
+
#### NOTE: About `size` attribute
|
78
|
+
|
79
|
+
[object collections wrapper](https://confluence.atlassian.com/bitbucket/version-2-423626329.html#Version2-Pagingthroughobjectcollections) has `size` attribute at Bitbucket Cloud REST API.
|
80
|
+
|
81
|
+
The `size` attribute describe as `optional` attribute.
|
82
|
+
|
83
|
+
In tinybucket gem, collection size depend on `side` attribute of [object collections wrapper](https://confluence.atlassian.com/bitbucket/version-2-423626329.html#Version2-Pagingthroughobjectcollections) in Bitbucket Cloud REST API.
|
84
|
+
|
85
|
+
So enumerator's `size` attribute may return `nil`.
|
86
|
+
|
87
|
+
### init
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
bucket = Tinybucket.new
|
65
91
|
```
|
66
92
|
|
93
|
+
### Endpoints
|
94
|
+
|
67
95
|
#### teams Endpoint
|
68
96
|
|
69
|
-
```
|
97
|
+
```ruby
|
70
98
|
# [x] GET the team profile
|
71
99
|
team = bucket.team('team name')
|
72
100
|
|
@@ -85,7 +113,7 @@ repos = team.repos
|
|
85
113
|
|
86
114
|
#### users Endpoint
|
87
115
|
|
88
|
-
```
|
116
|
+
```ruby
|
89
117
|
# [x] GET the user profile
|
90
118
|
user = bucket.user('user name')
|
91
119
|
|
@@ -101,7 +129,7 @@ repos = user.repos
|
|
101
129
|
|
102
130
|
#### repositories Endpoint
|
103
131
|
|
104
|
-
```
|
132
|
+
```ruby
|
105
133
|
# [x] GET a list of all public repositories
|
106
134
|
repos = bucket.repos
|
107
135
|
|
@@ -111,7 +139,7 @@ repos = bucket.repos('someone')
|
|
111
139
|
|
112
140
|
##### repository Resource
|
113
141
|
|
114
|
-
```
|
142
|
+
```ruby
|
115
143
|
# [x] GET a repository
|
116
144
|
repo = bucket.repo('someone', 'great_repo')
|
117
145
|
|
@@ -134,7 +162,7 @@ repos = repo.forks
|
|
134
162
|
|
135
163
|
##### pullrequests Resource
|
136
164
|
|
137
|
-
```
|
165
|
+
```ruby
|
138
166
|
repo = bucket.repo('someone', 'great_repo')
|
139
167
|
|
140
168
|
# [x] GET a list of open pull requests
|
@@ -182,7 +210,7 @@ comment = pull_request.comment(comment_id)
|
|
182
210
|
|
183
211
|
##### commits or commit Resource
|
184
212
|
|
185
|
-
```
|
213
|
+
```ruby
|
186
214
|
repo = bucket.repo('someone', 'great_repo')
|
187
215
|
|
188
216
|
# [x] GET a commits list for a repository or compare commits across branches
|
@@ -198,16 +226,16 @@ comments = commit.comments
|
|
198
226
|
# [x] GET an individual commit comment
|
199
227
|
comment = commit.comment(comment_id)
|
200
228
|
|
201
|
-
# [
|
229
|
+
# [x] POST a commit approval
|
202
230
|
commit.approve
|
203
231
|
|
204
|
-
# [
|
232
|
+
# [x] DELETE a commit approval
|
205
233
|
commit.unapprove
|
206
234
|
```
|
207
235
|
|
208
236
|
##### branch-restrictions Resource
|
209
237
|
|
210
|
-
```
|
238
|
+
```ruby
|
211
239
|
repo = bucket.repo('someone', 'great_repo').find
|
212
240
|
|
213
241
|
# [x] GET the branch-restrictions
|
@@ -228,7 +256,7 @@ restriction = repo.branch_restriction(restriction_id)
|
|
228
256
|
|
229
257
|
##### diff Resource
|
230
258
|
|
231
|
-
```
|
259
|
+
```ruby
|
232
260
|
repo = bucket.repo('someone', 'great_repo').find
|
233
261
|
COMMIT_ID = '7e968c5'
|
234
262
|
|
data/Rakefile
CHANGED
@@ -14,6 +14,13 @@ require 'rspec/core/rake_task'
|
|
14
14
|
RSpec::Core::RakeTask.new(:spec)
|
15
15
|
task :test => :spec
|
16
16
|
|
17
|
+
if Dir.exist?('./features')
|
18
|
+
RSpec::Core::RakeTask.new(:features) do |t|
|
19
|
+
t.pattern = './features/**/*_spec.rb'
|
20
|
+
t.rspec_opts = '-I ./features'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
17
24
|
begin
|
18
25
|
require 'rubocop/rake_task'
|
19
26
|
RuboCop::RakeTask.new
|
data/lib/tinybucket.rb
CHANGED
@@ -14,13 +14,16 @@ require 'faraday_middleware/follow_oauth_redirects'
|
|
14
14
|
require 'active_model'
|
15
15
|
|
16
16
|
require 'logger'
|
17
|
+
require 'uri'
|
18
|
+
|
19
|
+
require 'tinybucket/enumerator'
|
20
|
+
require 'tinybucket/iterator'
|
17
21
|
|
18
22
|
require 'tinybucket/config'
|
19
23
|
require 'tinybucket/null_logger'
|
20
24
|
require 'tinybucket/api'
|
21
25
|
require 'tinybucket/api_factory'
|
22
26
|
require 'tinybucket/api/helper'
|
23
|
-
require 'tinybucket/client'
|
24
27
|
require 'tinybucket/connection'
|
25
28
|
require 'tinybucket/constants'
|
26
29
|
require 'tinybucket/error'
|
@@ -30,7 +33,7 @@ require 'tinybucket/parser'
|
|
30
33
|
require 'tinybucket/request'
|
31
34
|
require 'tinybucket/response'
|
32
35
|
|
33
|
-
require '
|
36
|
+
require 'tinybucket/client'
|
34
37
|
|
35
38
|
require 'active_support/notifications'
|
36
39
|
ActiveSupport::Notifications.subscribe('request.faraday') \
|
@@ -50,8 +53,8 @@ module Tinybucket
|
|
50
53
|
include ActiveSupport::Configurable
|
51
54
|
attr_accessor :logger, :api_client
|
52
55
|
|
53
|
-
def new
|
54
|
-
@api_client = Tinybucket::Client.new
|
56
|
+
def new
|
57
|
+
@api_client = Tinybucket::Client.new
|
55
58
|
end
|
56
59
|
|
57
60
|
def configure
|
@@ -4,27 +4,10 @@ module Tinybucket
|
|
4
4
|
include Tinybucket::Connection
|
5
5
|
include Tinybucket::Request
|
6
6
|
|
7
|
-
def initialize(config, options = {})
|
8
|
-
@config = filter_config(config)
|
9
|
-
@options = options
|
10
|
-
yield if block_given?
|
11
|
-
end
|
12
|
-
|
13
|
-
protected
|
14
|
-
|
15
|
-
def option(key)
|
16
|
-
@options[key.intern]
|
17
|
-
end
|
18
|
-
|
19
|
-
def config(key)
|
20
|
-
@config[key.intern]
|
21
|
-
end
|
22
|
-
|
23
7
|
private
|
24
8
|
|
25
|
-
def
|
26
|
-
|
27
|
-
config.select { |key, _| keys.include?(key) }
|
9
|
+
def logger
|
10
|
+
Tinybucket.logger
|
28
11
|
end
|
29
12
|
end
|
30
13
|
end
|
@@ -1,25 +1,49 @@
|
|
1
1
|
module Tinybucket
|
2
2
|
module Api
|
3
|
+
# BranchRestrictions API client
|
4
|
+
#
|
5
|
+
# @see https://confluence.atlassian.com/bitbucket/branch-restrictions-resource-387449181.html
|
6
|
+
# branch-restrictions Resource
|
7
|
+
#
|
8
|
+
# @!attribute [rw] repo_owner
|
9
|
+
# @return [String] repository owner name.
|
10
|
+
# @!attribute [rw] repo_slug
|
11
|
+
# @return [String] repository slug. (about {https://confluence.atlassian.com/bitbucket/repositories-endpoint-423626330.html#repositoriesEndpoint-Overview
|
12
|
+
# repo_slug})
|
3
13
|
class BranchRestrictionsApi < BaseApi
|
4
14
|
include Tinybucket::Api::Helper::BranchRestrictionsHelper
|
5
15
|
|
6
16
|
attr_accessor :repo_owner, :repo_slug
|
7
17
|
|
18
|
+
# Send 'GET the branch-restrictions' request.
|
19
|
+
#
|
20
|
+
# @see https://confluence.atlassian.com/bitbucket/branch-restrictions-resource-387449181.html#branch-restrictionsResource-GETthebranch-restrictions
|
21
|
+
# GET the branch-restrictions
|
22
|
+
#
|
23
|
+
# @param options [Hash]
|
24
|
+
# @return [Tinybucket::Model::Page]
|
8
25
|
def list(options = {})
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
inject_api_config(list)
|
26
|
+
get_path(
|
27
|
+
path_to_list,
|
28
|
+
options,
|
29
|
+
Tinybucket::Parser::BranchRestrictionsParser
|
30
|
+
)
|
15
31
|
end
|
16
32
|
|
33
|
+
# Send 'GET a specific restriction' request.
|
34
|
+
#
|
35
|
+
# @see https://confluence.atlassian.com/bitbucket/branch-restrictions-resource-387449181.html#branch-restrictionsResource-GETaspecificrestriction
|
36
|
+
# GET a specific restriction
|
37
|
+
#
|
38
|
+
# @param restriction_id [String] The restriction's identifier
|
39
|
+
# @param options [Hash]
|
40
|
+
# @return [Tinybucket::Model::BranchRestriction]
|
17
41
|
def find(restriction_id, options = {})
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
42
|
+
get_path(
|
43
|
+
path_to_find(restriction_id),
|
44
|
+
options,
|
45
|
+
Tinybucket::Parser::BranchRestrictionParser
|
46
|
+
)
|
23
47
|
end
|
24
48
|
end
|
25
49
|
end
|
@@ -1,5 +1,14 @@
|
|
1
1
|
module Tinybucket
|
2
2
|
module Api
|
3
|
+
# Comments Api client
|
4
|
+
#
|
5
|
+
# @!attribute [rw] repo_owner
|
6
|
+
# @return [String] repository owner name.
|
7
|
+
# @!attribute [rw] repo_slug
|
8
|
+
# @return [String] repository slug. (about {https://confluence.atlassian.com/bitbucket/repositories-endpoint-423626330.html#repositoriesEndpoint-Overview
|
9
|
+
# repo_slug})
|
10
|
+
# @!attribute [rw] commented_to
|
11
|
+
# @return [Tinybucket::Model::Commit, Tinybucket::Model::PullRequest]
|
3
12
|
class CommentsApi < BaseApi
|
4
13
|
include Tinybucket::Api::Helper::CommentsHelper
|
5
14
|
|
@@ -7,24 +16,49 @@ module Tinybucket
|
|
7
16
|
|
8
17
|
attr_accessor :commented_to
|
9
18
|
|
19
|
+
# Send 'GET a list of comments' request.
|
20
|
+
#
|
21
|
+
# This method send different request depend on 'commented_to' attribute.
|
22
|
+
#
|
23
|
+
# @note When 'commented_to' is {Tinybucket::Model::Commit} instance,
|
24
|
+
# this method send {https://confluence.atlassian.com/bitbucket/commits-or-commit-resource-389775478.html#commitsorcommitResource-GETalistofcommitcomments
|
25
|
+
# GET a list of commit comments}.
|
26
|
+
# @note When 'commented_to' is {Tinybucket::Model::PullRequest} instance,
|
27
|
+
# this method send {https://confluence.atlassian.com/bitbucket/pullrequests-resource-423626332.html#pullrequestsResource-GETalistofapullrequestcomments
|
28
|
+
# GET a list of pull request comments}.
|
29
|
+
#
|
30
|
+
# @param options [Hash]
|
31
|
+
# @return [Tinybucket::Model::Page]
|
10
32
|
def list(options = {})
|
11
33
|
list = get_path(path_to_list,
|
12
34
|
options,
|
13
35
|
Tinybucket::Parser::CommentsParser)
|
14
36
|
|
15
|
-
list.next_proc = next_proc(:list, options)
|
16
|
-
|
17
37
|
associate_with_target(list)
|
18
|
-
|
38
|
+
list
|
19
39
|
end
|
20
40
|
|
41
|
+
# Send 'GET a individual comment' request.
|
42
|
+
#
|
43
|
+
# This method send different request depend on 'commented_to' attribute.
|
44
|
+
#
|
45
|
+
# @note When 'commented_to' is {Tinybucket::Model::Commit} instance,
|
46
|
+
# this method send {https://confluence.atlassian.com/bitbucket/commits-or-commit-resource-389775478.html#commitsorcommitResource-GETanindividualcommitcomment
|
47
|
+
# GET an individual commit comment}.
|
48
|
+
# @note When 'commented_to' is {Tinybucket::Model::PullRequest} instance,
|
49
|
+
# this method send {https://confluence.atlassian.com/bitbucket/pullrequests-resource-423626332.html#pullrequestsResource-GETanindividualpullrequestcomment
|
50
|
+
# GET an individual pull request comment}.
|
51
|
+
#
|
52
|
+
# @param comment_id [String] comment identifier
|
53
|
+
# @param options [Hash]
|
54
|
+
# @return [Tinybucket::Model::Comment]
|
21
55
|
def find(comment_id, options = {})
|
22
56
|
comment = get_path(path_to_find(comment_id),
|
23
57
|
options,
|
24
58
|
Tinybucket::Parser::CommentParser)
|
25
59
|
|
26
60
|
associate_with_target(comment)
|
27
|
-
|
61
|
+
comment
|
28
62
|
end
|
29
63
|
|
30
64
|
private
|
@@ -1,25 +1,75 @@
|
|
1
1
|
module Tinybucket
|
2
2
|
module Api
|
3
|
+
# Commits Api client
|
4
|
+
#
|
5
|
+
# @!attribute [rw] repo_owner
|
6
|
+
# @return [String] repository owner name.
|
7
|
+
# @!attribute [rw] repo_slug
|
8
|
+
# @return [String] repository slug. (about {https://confluence.atlassian.com/bitbucket/repositories-endpoint-423626330.html#repositoriesEndpoint-Overview
|
9
|
+
# repo_slug})
|
3
10
|
class CommitsApi < BaseApi
|
4
11
|
include Tinybucket::Api::Helper::CommitsHelper
|
5
12
|
|
6
13
|
attr_accessor :repo_owner, :repo_slug
|
7
14
|
|
15
|
+
# Send 'GET a commits list for a repository' request
|
16
|
+
#
|
17
|
+
# @see https://confluence.atlassian.com/bitbucket/commits-or-commit-resource-389775478.html#commitsorcommitResource-GETacommitslistforarepositoryorcomparecommitsacrossbranches
|
18
|
+
# GET a commits list for a repository
|
19
|
+
#
|
20
|
+
# @note This method does not support 'compare commits across branches'
|
21
|
+
# API call, yet.
|
22
|
+
#
|
23
|
+
# @param options [Hash]
|
24
|
+
# @return [Tinybucket::Model::Page]
|
8
25
|
def list(options = {})
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
inject_api_config(list)
|
26
|
+
get_path(
|
27
|
+
path_to_list,
|
28
|
+
options,
|
29
|
+
Tinybucket::Parser::CommitsParser
|
30
|
+
)
|
15
31
|
end
|
16
32
|
|
33
|
+
# Send 'GET an individual commit' request
|
34
|
+
#
|
35
|
+
# @see https://confluence.atlassian.com/bitbucket/commits-or-commit-resource-389775478.html#commitsorcommitResource-GETanindividualcommit
|
36
|
+
# GET an individual commit
|
37
|
+
#
|
38
|
+
# @param revision [String] A SHA1 value for the commit.
|
39
|
+
# @param options [Hash]
|
40
|
+
# @return [Tinybucket::Model::Commit]
|
17
41
|
def find(revision, options = {})
|
18
|
-
|
19
|
-
|
20
|
-
|
42
|
+
get_path(
|
43
|
+
path_to_find(revision),
|
44
|
+
options,
|
45
|
+
Tinybucket::Parser::CommitParser
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Send 'POST a commit approval' request
|
50
|
+
#
|
51
|
+
# @param revision [String]
|
52
|
+
# @param options [Hash]
|
53
|
+
# @return [true, false]
|
54
|
+
def approve(revision, options = {})
|
55
|
+
result = post_path(path_to_approve(revision), options)
|
56
|
+
(result['approved'] == true)
|
57
|
+
rescue Tinybucket::Error::Conflict => e
|
58
|
+
logger.debug 'Already approved: ' + e.inspect
|
59
|
+
true
|
60
|
+
end
|
21
61
|
|
22
|
-
|
62
|
+
# Send 'DELETE a commit approval' request
|
63
|
+
#
|
64
|
+
# @param revision [String]
|
65
|
+
# @param options [Hash]
|
66
|
+
# @return [true, false]
|
67
|
+
def unapprove(revision, options = {})
|
68
|
+
delete_path(path_to_approve(revision), options)
|
69
|
+
true
|
70
|
+
rescue Tinybucket::Error::NotFound => e
|
71
|
+
logger.debug 'Already unapproved: ' + e.inspect
|
72
|
+
true
|
23
73
|
end
|
24
74
|
end
|
25
75
|
end
|