tinybucket2 1.0.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 +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 +26 -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/issues_helper.rb +29 -0
- data/lib/tinybucket/api/helper/projects_helper.rb +28 -0
- data/lib/tinybucket/api/helper/pull_requests_helper.rb +58 -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/issues_api.rb +48 -0
- data/lib/tinybucket/api/projects_api.rb +26 -0
- data/lib/tinybucket/api/pull_requests_api.rb +117 -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/issue.rb +48 -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 +160 -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 +59 -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/issues.rb +35 -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 +50 -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 +248 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 1b3bbc5f80275a1a0fd2da53eab7ab2e19ec3edd89f275e53e0db68dbe2f3970
|
|
4
|
+
data.tar.gz: b5c2991791c12fb99e8c40d6fdde1dae46b5b39f01b88a10bad0611e4ce04d12
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: edcf4de6b9f1117cea5f5ec5d72f0257a326f6f4791c7e7a14e4fbe4373cdad5f036d3e49f8a277082d6dde20fb19c8ee6f0f5cdab5128bba29011052524a009
|
|
7
|
+
data.tar.gz: 375c470e363403cfb271489be4b4c67d17e51df98060c2b2ff8b01fbd118704da89a2e611d0c009c5f8e45d29796c7d61bfe66c0e29761cab2f4e06099939bd6
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
Include:
|
|
3
|
+
- 'lib/**/*.rb'
|
|
4
|
+
Exclude:
|
|
5
|
+
- '*.rb'
|
|
6
|
+
- 'spec/**/*'
|
|
7
|
+
- 'features/**/*'
|
|
8
|
+
- 'test/**/*'
|
|
9
|
+
- 'Gemfile'
|
|
10
|
+
- 'Guardfile'
|
|
11
|
+
- 'Rakefile'
|
|
12
|
+
- '*.gemspec'
|
|
13
|
+
|
|
14
|
+
Metrics/ClassLength:
|
|
15
|
+
Max: 150
|
|
16
|
+
|
|
17
|
+
MethodLength:
|
|
18
|
+
Max: 30
|
|
19
|
+
|
|
20
|
+
Documentation:
|
|
21
|
+
Enabled: false
|
|
22
|
+
|
|
23
|
+
AndOr:
|
|
24
|
+
Enabled: false
|
|
25
|
+
|
|
26
|
+
ParenthesesAroundCondition:
|
|
27
|
+
Enabled: false
|
|
28
|
+
|
|
29
|
+
Style/MethodCallWithoutArgsParentheses:
|
|
30
|
+
Enabled: false
|
|
31
|
+
|
|
32
|
+
# why use this option ?
|
|
33
|
+
#RedundantBegin:
|
|
34
|
+
# Enabled: false
|
|
35
|
+
|
|
36
|
+
NumericLiterals:
|
|
37
|
+
Enabled: false
|
|
38
|
+
|
|
39
|
+
CyclomaticComplexity:
|
|
40
|
+
Max: 15
|
|
41
|
+
|
|
42
|
+
Next:
|
|
43
|
+
Enabled: false
|
|
44
|
+
|
|
45
|
+
Layout/AlignHash:
|
|
46
|
+
Enabled: false
|
|
47
|
+
|
|
48
|
+
Style/RaiseArgs:
|
|
49
|
+
Enabled: false
|
|
50
|
+
|
|
51
|
+
Style/RedundantFreeze:
|
|
52
|
+
Enabled: false
|
|
53
|
+
|
|
54
|
+
Metrics/AbcSize:
|
|
55
|
+
Max: 18
|
|
56
|
+
|
|
57
|
+
Metrics/LineLength:
|
|
58
|
+
Max: 100
|
|
59
|
+
IgnoredPatterns: [
|
|
60
|
+
'^\s*#',
|
|
61
|
+
'ruby wrapper for the Bitbucket REST API*'
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
Style/SymbolArray:
|
|
65
|
+
Enabled: false
|
|
66
|
+
|
|
67
|
+
Style/FormatStringToken:
|
|
68
|
+
Enabled: false
|
|
69
|
+
|
|
70
|
+
Style/RescueStandardError:
|
|
71
|
+
Enabled: false
|
|
72
|
+
|
|
73
|
+
Style/PercentLiteralDelimiters:
|
|
74
|
+
Enabled: false
|
|
75
|
+
|
|
76
|
+
Layout/SpaceAroundOperators:
|
|
77
|
+
Enabled: false
|
|
78
|
+
|
|
79
|
+
Layout/ExtraSpacing:
|
|
80
|
+
Enabled: false
|
|
81
|
+
|
|
82
|
+
Style/SafeNavigation:
|
|
83
|
+
Enabled: false
|
|
84
|
+
|
|
85
|
+
Lint/DuplicateMethods:
|
|
86
|
+
Enabled: false
|
data/Gemfile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Specify your gem's dependencies in bitbucket.gemspec
|
|
4
|
+
gemspec
|
|
5
|
+
|
|
6
|
+
gem 'simple-auth', '~> 0.3.1'
|
|
7
|
+
gem 'yard', '~> 0.9.12'
|
|
8
|
+
gem 'yardstick', '~> 0.9.9'
|
|
9
|
+
|
|
10
|
+
group :development, :test do
|
|
11
|
+
gem 'pry'
|
|
12
|
+
gem 'pry-stack_explorer'
|
|
13
|
+
gem 'pry-byebug'
|
|
14
|
+
gem 'pry-rescue'
|
|
15
|
+
|
|
16
|
+
gem 'guard-rspec'
|
|
17
|
+
gem 'guard-spork'
|
|
18
|
+
|
|
19
|
+
gem 'guard-rubocop'
|
|
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.52.1'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
group :test do
|
|
30
|
+
gem 'simplecov', '~> 0.13.0', require: false
|
|
31
|
+
gem 'codeclimate-test-reporter', '~> 1.0.8', require: nil
|
|
32
|
+
end
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 hirakiuc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
tinybucket gem
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
A Ruby client library for Bitbucket REST API v2 with OAuth Authentication.
|
|
5
|
+
|
|
6
|
+
**WARNING** This gem is under development.
|
|
7
|
+
|
|
8
|
+
This gem is inspired by [vongrippen/bitbucket](https://github.com/vongrippen/bitbucket). Thanks.
|
|
9
|
+
|
|
10
|
+
[](https://badge.fury.io/rb/tinybucket)
|
|
11
|
+
[](https://travis-ci.org/hirakiuc/tinybucket)
|
|
12
|
+
[](https://codeclimate.com/github/hirakiuc/tinybucket)
|
|
13
|
+
[](https://codeclimate.com/github/hirakiuc/tinybucket/coverage)
|
|
14
|
+
[](http://inch-ci.org/github/hirakiuc/tinybucket)
|
|
15
|
+
|
|
16
|
+
[yard doc](http://www.rubydoc.info/github/hirakiuc/tinybucket/master) (master branch)
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
Add this line to your application's Gemfile:
|
|
21
|
+
|
|
22
|
+
gem 'tinybucket'
|
|
23
|
+
|
|
24
|
+
And then execute:
|
|
25
|
+
|
|
26
|
+
$ bundle
|
|
27
|
+
|
|
28
|
+
Or install it yourself as:
|
|
29
|
+
|
|
30
|
+
$ gem install tinybucket
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
**WARNING** These specs will be changed at any time.
|
|
35
|
+
|
|
36
|
+
NOTE: `x` mark means `Already implemented.`.
|
|
37
|
+
|
|
38
|
+
### Configure
|
|
39
|
+
|
|
40
|
+
```ruby
|
|
41
|
+
logger = Logger.new($stdout)
|
|
42
|
+
logger.level = Logger::WARN
|
|
43
|
+
|
|
44
|
+
Tinybucket.configure do |config|
|
|
45
|
+
# Configure logger if you want.
|
|
46
|
+
#
|
|
47
|
+
# optional, default: nil (no logging)
|
|
48
|
+
config.logger = logger
|
|
49
|
+
|
|
50
|
+
# Configure cache_store options if you need.
|
|
51
|
+
#
|
|
52
|
+
# see https://github.com/plataformatec/faraday-http-cache
|
|
53
|
+
#
|
|
54
|
+
# optional, default: nil (disable request cache)
|
|
55
|
+
config.cache_store_options = { store: Rails.cache, logger: logger }
|
|
56
|
+
|
|
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.)
|
|
62
|
+
config.oauth_token = 'key'
|
|
63
|
+
config.oauth_secret = 'secret'
|
|
64
|
+
end
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Pagination
|
|
68
|
+
|
|
69
|
+
After v1.0.0, tinybucket gem support [lazy enumerator](http://ruby-doc.org/core-2.2.0/Enumerator/Lazy.html) !
|
|
70
|
+
|
|
71
|
+
This feature make your code more rubyish, like this.
|
|
72
|
+
|
|
73
|
+
```ruby
|
|
74
|
+
# get enumerator to enumerate repositories.
|
|
75
|
+
repos = bucket.repos('myname')
|
|
76
|
+
|
|
77
|
+
# Select repositories which has 2 pull requests to be reviewed.
|
|
78
|
+
repos = repos('my_name').select do |repo|
|
|
79
|
+
repo.pull_requests.size > 2
|
|
80
|
+
end.map(&:full_name)
|
|
81
|
+
```
|
|
82
|
+
|
|
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.
|
|
84
|
+
|
|
85
|
+
#### NOTE: About `size` attribute
|
|
86
|
+
|
|
87
|
+
[object collections wrapper](https://developer.atlassian.com/bitbucket/api/2/reference/meta/pagination) has `size` attribute at Bitbucket Cloud REST API.
|
|
88
|
+
|
|
89
|
+
The `size` attribute describe as `optional` attribute.
|
|
90
|
+
|
|
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.
|
|
92
|
+
|
|
93
|
+
So enumerator's `size` attribute may return `nil`.
|
|
94
|
+
|
|
95
|
+
### init
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
bucket = Tinybucket.new
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Endpoints
|
|
102
|
+
|
|
103
|
+
#### teams Endpoint
|
|
104
|
+
|
|
105
|
+
```ruby
|
|
106
|
+
# [x] GET the team profile
|
|
107
|
+
team = bucket.team('team name')
|
|
108
|
+
|
|
109
|
+
# [x] GET the team members
|
|
110
|
+
members = team.members
|
|
111
|
+
|
|
112
|
+
# [x] GET the team followers
|
|
113
|
+
followers = team.followers
|
|
114
|
+
|
|
115
|
+
# [x] GET a list of accounts the team is following
|
|
116
|
+
following = team.following
|
|
117
|
+
|
|
118
|
+
# [x] GET the team's repositories
|
|
119
|
+
repos = team.repos
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### users Endpoint
|
|
123
|
+
|
|
124
|
+
```ruby
|
|
125
|
+
# [x] GET the user profile
|
|
126
|
+
user = bucket.user('user name')
|
|
127
|
+
|
|
128
|
+
# [x] GET the list of followers
|
|
129
|
+
followers = user.followers
|
|
130
|
+
|
|
131
|
+
# [x] GET a list of accounts the user is following
|
|
132
|
+
followings = user.followings
|
|
133
|
+
|
|
134
|
+
# [x] GET the user's repositories
|
|
135
|
+
repos = user.repos
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### repositories Endpoint
|
|
139
|
+
|
|
140
|
+
```ruby
|
|
141
|
+
# [x] GET a list of all public repositories
|
|
142
|
+
repos = bucket.repos
|
|
143
|
+
|
|
144
|
+
# [x] GET a list of repositories owned by the account 'someone'
|
|
145
|
+
repos = bucket.repos('someone')
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
##### repository Resource
|
|
149
|
+
|
|
150
|
+
###### Collection Methods
|
|
151
|
+
|
|
152
|
+
```ruby
|
|
153
|
+
repos = bucket.repos('myname')
|
|
154
|
+
|
|
155
|
+
# [ ] POST a new repository
|
|
156
|
+
repos.create(params)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
###### Object Methods
|
|
160
|
+
|
|
161
|
+
```ruby
|
|
162
|
+
# [x] GET a repository
|
|
163
|
+
repo = bucket.repo('someone', 'great_repo')
|
|
164
|
+
|
|
165
|
+
# [x] Load a repository
|
|
166
|
+
# (Load the repository attributes from Bitbucket WebAPI)
|
|
167
|
+
repo.load
|
|
168
|
+
|
|
169
|
+
# [ ] DELETE a repository
|
|
170
|
+
repo.destroy
|
|
171
|
+
|
|
172
|
+
# [x] GET a list of watchers
|
|
173
|
+
watchers = repo.watchers
|
|
174
|
+
|
|
175
|
+
# [x] GET a list of forks
|
|
176
|
+
repos = repo.forks
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
##### pullrequests Resource
|
|
180
|
+
|
|
181
|
+
###### Collection Methods
|
|
182
|
+
|
|
183
|
+
```ruby
|
|
184
|
+
repo = bucket.repo('someone', 'great_repo')
|
|
185
|
+
|
|
186
|
+
# [x ] GET a list of pull requests
|
|
187
|
+
pull_requests = repo.pull_requests(options)
|
|
188
|
+
|
|
189
|
+
# [ ] POST (create) a new pull request
|
|
190
|
+
pull_requests.create(params)
|
|
191
|
+
|
|
192
|
+
# [ ] GET the log of all of a repository's pull request activity
|
|
193
|
+
activities = pull_requests.activities(options)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
###### Object Methods
|
|
197
|
+
|
|
198
|
+
```ruby
|
|
199
|
+
repo = bucket.repo('someone', 'great_repo')
|
|
200
|
+
|
|
201
|
+
# [x] GET a specific pull request
|
|
202
|
+
pull_request = repo.pull_request(pr_id)
|
|
203
|
+
|
|
204
|
+
# [ ] PUT a pull request update
|
|
205
|
+
pull_request.update(params)
|
|
206
|
+
|
|
207
|
+
# [x] GET the commits for a pull request
|
|
208
|
+
commits = pull_request.commits
|
|
209
|
+
|
|
210
|
+
# [x] POST a pull request approval
|
|
211
|
+
pull_request.approve
|
|
212
|
+
|
|
213
|
+
# [x] DELETE a pull request approval
|
|
214
|
+
pull_request.unapprove
|
|
215
|
+
|
|
216
|
+
# [x] GET the diff for a pull request
|
|
217
|
+
diff = pull_request.diff
|
|
218
|
+
|
|
219
|
+
# [ ] GET the activity for a pull request
|
|
220
|
+
activities = pull_request.activities(options)
|
|
221
|
+
|
|
222
|
+
# [x] Accept and merge a pull request
|
|
223
|
+
pull_request.merge(options)
|
|
224
|
+
|
|
225
|
+
# [x] Decline or reject a pull request
|
|
226
|
+
pull_request.decline(options)
|
|
227
|
+
|
|
228
|
+
# [x] GET a list of pull request comments
|
|
229
|
+
comments = pull_request.comments
|
|
230
|
+
|
|
231
|
+
# [x] GET an individual pull request comment
|
|
232
|
+
comment = pull_request.comment(comment_id)
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
##### commits or commit Resource
|
|
236
|
+
|
|
237
|
+
###### Collection Methods
|
|
238
|
+
|
|
239
|
+
```ruby
|
|
240
|
+
repo = bucket.repo('someone', 'great_repo')
|
|
241
|
+
|
|
242
|
+
# [x] GET a commits list for a repository or compare commits across branches
|
|
243
|
+
# branchortag, include, exclude options
|
|
244
|
+
commits = repo.commits(options)
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
###### Object Methods
|
|
248
|
+
|
|
249
|
+
```ruby
|
|
250
|
+
repo = bucket.repo('someone', 'great_repo')
|
|
251
|
+
|
|
252
|
+
# [x] GET an individual commit
|
|
253
|
+
commit = repo.commit('revision')
|
|
254
|
+
|
|
255
|
+
# [x] GET a list of commit comments
|
|
256
|
+
comments = commit.comments
|
|
257
|
+
|
|
258
|
+
# [x] GET an individual commit comment
|
|
259
|
+
comment = commit.comment(comment_id)
|
|
260
|
+
|
|
261
|
+
# [x] POST a commit approval
|
|
262
|
+
commit.approve
|
|
263
|
+
|
|
264
|
+
# [x] DELETE a commit approval
|
|
265
|
+
commit.unapprove
|
|
266
|
+
```
|
|
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
|
+
|
|
287
|
+
##### branch-restrictions Resource
|
|
288
|
+
|
|
289
|
+
###### Collection Methods
|
|
290
|
+
|
|
291
|
+
```ruby
|
|
292
|
+
repo = bucket.repo('someone', 'great_repo')
|
|
293
|
+
|
|
294
|
+
# [x] GET the branch-restrictions
|
|
295
|
+
restrictions = repo.branch_restrictions
|
|
296
|
+
|
|
297
|
+
# [ ] POST the branch-restrictions
|
|
298
|
+
new_restriction = restrictions.create(params)
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
###### Object Methods
|
|
302
|
+
|
|
303
|
+
```ruby
|
|
304
|
+
repo = bucket.repo('someone', 'great_repo').find
|
|
305
|
+
|
|
306
|
+
# [x] GET a specific restriction
|
|
307
|
+
restriction = repo.branch_restriction(restriction_id)
|
|
308
|
+
|
|
309
|
+
# [ ] PUT a branch restriction update
|
|
310
|
+
restriction.update(params)
|
|
311
|
+
|
|
312
|
+
# [ ] DELETE the branch restriction
|
|
313
|
+
restriction.destroy
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
##### diff Resource
|
|
317
|
+
|
|
318
|
+
```ruby
|
|
319
|
+
repo = bucket.repo('someone', 'great_repo')
|
|
320
|
+
COMMIT_ID = '7e968c5'
|
|
321
|
+
|
|
322
|
+
# [x] GET a diff
|
|
323
|
+
diff = repo.diff(COMMIT_ID)
|
|
324
|
+
|
|
325
|
+
# [x] GET a patch
|
|
326
|
+
patch = repo.patch(COMMIT_ID)
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
##### statuses/build Resource
|
|
330
|
+
|
|
331
|
+
###### Collection Methods
|
|
332
|
+
|
|
333
|
+
```ruby
|
|
334
|
+
repo = bucket.repo('someone', 'great_repo')
|
|
335
|
+
|
|
336
|
+
COMMIT_ID = '7e968c5'
|
|
337
|
+
commit = repo.commit(COMMIT_ID)
|
|
338
|
+
|
|
339
|
+
BUILD_STATUS_KEY = 'tinybucket'
|
|
340
|
+
|
|
341
|
+
# [x] POST a build status for a commit
|
|
342
|
+
commit.build_statuses.create(
|
|
343
|
+
key: BUILD_STATUS_KEY,
|
|
344
|
+
state: 'INPROGRESS',
|
|
345
|
+
name: 'Name of build',
|
|
346
|
+
url: 'link to the build result',
|
|
347
|
+
description: 'about build'
|
|
348
|
+
)
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
###### Object Methods
|
|
352
|
+
|
|
353
|
+
```
|
|
354
|
+
repo = bucket.repo('someone', 'great_repo')
|
|
355
|
+
|
|
356
|
+
COMMIT_ID = '7e968c5'
|
|
357
|
+
commit = repo.commit(COMMIT_ID)
|
|
358
|
+
|
|
359
|
+
BUILD_STATUS_KEY = 'tinybucket'
|
|
360
|
+
|
|
361
|
+
# [x] GET the build status for a commit
|
|
362
|
+
status = commit.build_status(BUILD_STATUS_KEY)
|
|
363
|
+
|
|
364
|
+
# [x] PUT a build status for a commit
|
|
365
|
+
status.update(
|
|
366
|
+
state: 'SUCCESSFUL',
|
|
367
|
+
name: 'Name of build',
|
|
368
|
+
url: 'link to the build result',
|
|
369
|
+
description: 'about build'
|
|
370
|
+
)
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
## Contribution
|
|
374
|
+
|
|
375
|
+
1. Fork it ( https://github.com/[my-github-username]/bitbucket/fork )
|
|
376
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
377
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
378
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
379
|
+
5. Create a new Pull Request
|
|
380
|
+
|
|
381
|
+
## License
|
|
382
|
+
|
|
383
|
+
See LICENSE file.
|
|
384
|
+
|
|
385
|
+
## Author
|
|
386
|
+
|
|
387
|
+
[hirakiuc](https://github.com/hirakiuc)
|