tinybucket 0.1.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/.coveralls.yml +1 -0
- data/.gitignore +35 -0
- data/.rspec +1 -0
- data/.rubocop.yml +44 -0
- data/.travis.yml +10 -0
- data/Gemfile +22 -0
- data/Guardfile +13 -0
- data/LICENSE +21 -0
- data/README.md +237 -0
- data/Rakefile +39 -0
- data/lib/faraday_middleware/follow_oauth_redirects.rb +67 -0
- data/lib/tinybucket.rb +61 -0
- data/lib/tinybucket/api.rb +20 -0
- data/lib/tinybucket/api/base_api.rb +31 -0
- data/lib/tinybucket/api/branch_restrictions_api.rb +26 -0
- data/lib/tinybucket/api/comments_api.rb +46 -0
- data/lib/tinybucket/api/commits_api.rb +26 -0
- data/lib/tinybucket/api/diff_api.rb +17 -0
- data/lib/tinybucket/api/helper.rb +22 -0
- data/lib/tinybucket/api/helper/api_helper.rb +48 -0
- data/lib/tinybucket/api/helper/branch_restrictions_helper.rb +27 -0
- data/lib/tinybucket/api/helper/comments_helper.rb +49 -0
- data/lib/tinybucket/api/helper/commits_helper.rb +27 -0
- data/lib/tinybucket/api/helper/diff_helper.rb +29 -0
- data/lib/tinybucket/api/helper/pull_requests_helper.rb +44 -0
- data/lib/tinybucket/api/helper/repo_helper.rb +29 -0
- data/lib/tinybucket/api/helper/repos_helper.rb +21 -0
- data/lib/tinybucket/api/helper/team_helper.rb +35 -0
- data/lib/tinybucket/api/helper/user_helper.rb +31 -0
- data/lib/tinybucket/api/pull_requests_api.rb +49 -0
- data/lib/tinybucket/api/repo_api.rb +35 -0
- data/lib/tinybucket/api/repos_api.rb +19 -0
- data/lib/tinybucket/api/team_api.rb +51 -0
- data/lib/tinybucket/api/user_api.rb +44 -0
- data/lib/tinybucket/api_factory.rb +21 -0
- data/lib/tinybucket/client.rb +95 -0
- data/lib/tinybucket/connection.rb +62 -0
- data/lib/tinybucket/constants.rb +4 -0
- data/lib/tinybucket/error.rb +8 -0
- data/lib/tinybucket/error/base_error.rb +12 -0
- data/lib/tinybucket/error/service_error.rb +20 -0
- data/lib/tinybucket/model.rb +20 -0
- data/lib/tinybucket/model/base.rb +54 -0
- data/lib/tinybucket/model/branch_restriction.rb +17 -0
- data/lib/tinybucket/model/comment.rb +39 -0
- data/lib/tinybucket/model/commit.rb +39 -0
- data/lib/tinybucket/model/concerns.rb +14 -0
- data/lib/tinybucket/model/concerns/reloadable.rb +45 -0
- data/lib/tinybucket/model/concerns/repository_keys.rb +43 -0
- data/lib/tinybucket/model/error_response.rb +7 -0
- data/lib/tinybucket/model/page.rb +65 -0
- data/lib/tinybucket/model/profile.rb +37 -0
- data/lib/tinybucket/model/pull_request.rb +64 -0
- data/lib/tinybucket/model/repository.rb +96 -0
- data/lib/tinybucket/model/team.rb +39 -0
- data/lib/tinybucket/parser.rb +25 -0
- data/lib/tinybucket/parser/base_parser.rb +17 -0
- data/lib/tinybucket/parser/branch_restriction_parser.rb +9 -0
- data/lib/tinybucket/parser/branch_restrictions_parser.rb +10 -0
- data/lib/tinybucket/parser/comment_parser.rb +9 -0
- data/lib/tinybucket/parser/comments_parser.rb +10 -0
- data/lib/tinybucket/parser/commit_parser.rb +9 -0
- data/lib/tinybucket/parser/commits_parser.rb +9 -0
- data/lib/tinybucket/parser/profile_parser.rb +9 -0
- data/lib/tinybucket/parser/profiles_parser.rb +9 -0
- data/lib/tinybucket/parser/pull_request_parser.rb +9 -0
- data/lib/tinybucket/parser/pull_requests_parser.rb +10 -0
- data/lib/tinybucket/parser/repo_parser.rb +9 -0
- data/lib/tinybucket/parser/repos_parser.rb +10 -0
- data/lib/tinybucket/parser/team_parser.rb +9 -0
- data/lib/tinybucket/parser/teams_parser.rb +9 -0
- data/lib/tinybucket/request.rb +55 -0
- data/lib/tinybucket/response.rb +7 -0
- data/lib/tinybucket/response/error_handler.rb +14 -0
- data/lib/tinybucket/version.rb +3 -0
- data/spec/fixtures/commit.json +83 -0
- data/spec/fixtures/profile.json +29 -0
- data/spec/fixtures/pull_request.json +106 -0
- data/spec/fixtures/repositories/get.json +78 -0
- data/spec/fixtures/repositories/test_owner/get.json +78 -0
- data/spec/fixtures/repositories/test_owner/test_repo/branch-restrictions/1/get.json +17 -0
- data/spec/fixtures/repositories/test_owner/test_repo/branch-restrictions/get.json +101 -0
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/comments/1/get.json +38 -0
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/comments/get.json +40 -0
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/get.json +83 -0
- data/spec/fixtures/repositories/test_owner/test_repo/commits/get.json +73 -0
- data/spec/fixtures/repositories/test_owner/test_repo/diff/1/get.json +21 -0
- data/spec/fixtures/repositories/test_owner/test_repo/forks/get.json +78 -0
- data/spec/fixtures/repositories/test_owner/test_repo/get.json +71 -0
- data/spec/fixtures/repositories/test_owner/test_repo/patch/1/get.json +29 -0
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/approve/delete.json +3 -0
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/approve/post.json +3 -0
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/comments/1/get.json +30 -0
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/comments/get.json +44 -0
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/commits/get.json +66 -0
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/diff/get.txt +13 -0
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/get.json +164 -0
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get.json +112 -0
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_declined.json +112 -0
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_merged.json +112 -0
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_open.json +112 -0
- data/spec/fixtures/repositories/test_owner/test_repo/watchers/get.json +32 -0
- data/spec/fixtures/repository.json +71 -0
- data/spec/fixtures/teams/test_team/followers/get.json +36 -0
- data/spec/fixtures/teams/test_team/following/get.json +39 -0
- data/spec/fixtures/teams/test_team/get.json +32 -0
- data/spec/fixtures/teams/test_team/members/get.json +36 -0
- data/spec/fixtures/teams/test_team/repositories/get.json +125 -0
- data/spec/fixtures/users/test_owner/followers/get.json +65 -0
- data/spec/fixtures/users/test_owner/following/get.json +100 -0
- data/spec/fixtures/users/test_owner/get.json +29 -0
- data/spec/lib/tinybucket/api/branch_restrictions_api_spec.rb +78 -0
- data/spec/lib/tinybucket/api/comments_api_spec.rb +133 -0
- data/spec/lib/tinybucket/api/commits_api_spec.rb +63 -0
- data/spec/lib/tinybucket/api/diff_api_spec.rb +5 -0
- data/spec/lib/tinybucket/api/pull_requests_api_spec.rb +229 -0
- data/spec/lib/tinybucket/api/repo_api_spec.rb +100 -0
- data/spec/lib/tinybucket/api/repos_api_spec.rb +28 -0
- data/spec/lib/tinybucket/api/team_api_spec.rb +87 -0
- data/spec/lib/tinybucket/api/user_api_spec.rb +60 -0
- data/spec/lib/tinybucket/api_factory_spec.rb +23 -0
- data/spec/lib/tinybucket/client_spec.rb +102 -0
- data/spec/lib/tinybucket/connection_spec.rb +30 -0
- data/spec/lib/tinybucket/model/branch_restriction_spec.rb +29 -0
- data/spec/lib/tinybucket/model/comment_spec.rb +31 -0
- data/spec/lib/tinybucket/model/commit_spec.rb +62 -0
- data/spec/lib/tinybucket/model/page_spec.rb +58 -0
- data/spec/lib/tinybucket/model/profile_spec.rb +47 -0
- data/spec/lib/tinybucket/model/pull_request_spec.rb +122 -0
- data/spec/lib/tinybucket/model/repository_spec.rb +131 -0
- data/spec/lib/tinybucket/model/team_spec.rb +53 -0
- data/spec/lib/tinybucket_spec.rb +32 -0
- data/spec/spec_helper.rb +42 -0
- data/spec/support/api_response_macros.rb +30 -0
- data/spec/support/model_macros.rb +61 -0
- data/tinybucket.gemspec +36 -0
- metadata +437 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 5e648df2266ffd1d0190d2041c9d3f1d682f6ba4
|
|
4
|
+
data.tar.gz: 06f147a03a927985f8e6a5ae66cd97a27eab1497
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 197e8ce1138f6d37a41f0cc2f784cfb2eab61161e084b6aae615a0745906500d78f6a78b006a79fd3060b99313e2462d686ef89f1b0becf6c29eff21254a165d
|
|
7
|
+
data.tar.gz: 1c34d005415fae7dbe005f6e37d3e5bc43209363b5646f2f4bff39f3734f8e1567dabade3168fcab6bb1dfd7144871840d17b2775f702a5b086847df2105a6cd
|
data/.coveralls.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
Gemfile.lock
|
|
5
|
+
*.bundle
|
|
6
|
+
*.so
|
|
7
|
+
*.o
|
|
8
|
+
*.a
|
|
9
|
+
mkmf.log
|
|
10
|
+
app.rb
|
|
11
|
+
log/
|
|
12
|
+
*.swp
|
|
13
|
+
|
|
14
|
+
## from github ignore.
|
|
15
|
+
|
|
16
|
+
/.config
|
|
17
|
+
/coverage/
|
|
18
|
+
/InstalledFiles
|
|
19
|
+
/pkg/
|
|
20
|
+
/tmp/
|
|
21
|
+
|
|
22
|
+
## Specific to RubyMotion:
|
|
23
|
+
.dat*
|
|
24
|
+
.repl_history
|
|
25
|
+
build/
|
|
26
|
+
|
|
27
|
+
## Documentation cache and generated files:
|
|
28
|
+
/.yardoc/
|
|
29
|
+
/_yardoc/
|
|
30
|
+
/doc/
|
|
31
|
+
/rdoc/
|
|
32
|
+
|
|
33
|
+
## Environment normalisation:
|
|
34
|
+
/.bundle/
|
|
35
|
+
/lib/bundler/man/
|
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--color
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
Include:
|
|
3
|
+
- 'lib/**/*.rb'
|
|
4
|
+
Exclude:
|
|
5
|
+
- 'app.rb'
|
|
6
|
+
- 'spec/**/*'
|
|
7
|
+
- 'test/**/*'
|
|
8
|
+
|
|
9
|
+
Style/ClassLength:
|
|
10
|
+
Max: 150
|
|
11
|
+
|
|
12
|
+
MethodLength:
|
|
13
|
+
Max: 30
|
|
14
|
+
|
|
15
|
+
Documentation:
|
|
16
|
+
Enabled: false
|
|
17
|
+
|
|
18
|
+
AndOr:
|
|
19
|
+
Enabled: false
|
|
20
|
+
|
|
21
|
+
ParenthesesAroundCondition:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
MethodCallParentheses:
|
|
25
|
+
Enabled: false
|
|
26
|
+
|
|
27
|
+
# why use this option ?
|
|
28
|
+
#RedundantBegin:
|
|
29
|
+
# Enabled: false
|
|
30
|
+
|
|
31
|
+
NumericLiterals:
|
|
32
|
+
Enabled: false
|
|
33
|
+
|
|
34
|
+
CyclomaticComplexity:
|
|
35
|
+
Max: 15
|
|
36
|
+
|
|
37
|
+
Next:
|
|
38
|
+
Enabled: false
|
|
39
|
+
|
|
40
|
+
Style/AlignHash:
|
|
41
|
+
Enabled: false
|
|
42
|
+
|
|
43
|
+
Style/RaiseArgs:
|
|
44
|
+
Enabled: false
|
data/.travis.yml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
language: ruby
|
|
2
|
+
rvm: 2.1.2
|
|
3
|
+
addons:
|
|
4
|
+
code_climate:
|
|
5
|
+
repo_token: 58717000233e2eba64f18993364e4689b9c3e862a3e775d14890cd235979a7f9
|
|
6
|
+
notifications:
|
|
7
|
+
slack:
|
|
8
|
+
rooms:
|
|
9
|
+
- secure: VnXzbJEGFsHRZN0alas2Yu7o22VyXEnVlqIebI99yMZgULKh1IGA7uvGGOAyvIxTIAoY9yWm44RghBMSwYEZjoNgXNFC0EEl66sYdEgw2pEmza8ydlolFLsjX5RFIsbPSGHQArNBnV1sYuuP7452TheDn/BJTi53tnR+B4tF2JU=
|
|
10
|
+
env: CODECLIMATE_REPORT='on'
|
data/Gemfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Specify your gem's dependencies in bitbucket.gemspec
|
|
4
|
+
gemspec
|
|
5
|
+
|
|
6
|
+
group :development, :test do
|
|
7
|
+
gem 'pry'
|
|
8
|
+
gem 'pry-stack_explorer'
|
|
9
|
+
gem 'pry-byebug'
|
|
10
|
+
gem 'pry-rescue'
|
|
11
|
+
|
|
12
|
+
gem 'guard-rspec'
|
|
13
|
+
gem 'guard-spork'
|
|
14
|
+
|
|
15
|
+
gem 'guard-rubocop'
|
|
16
|
+
gem 'gem-release'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
group :test do
|
|
20
|
+
gem 'coveralls', require: false
|
|
21
|
+
gem 'codeclimate-test-reporter', require: nil
|
|
22
|
+
end
|
data/Guardfile
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
guard 'rspec', cmd: 'rspec --drb' do
|
|
2
|
+
watch(/^spec\/.+_spec\.rb$/)
|
|
3
|
+
watch(/^lib\/(.+)\.rb$/) { |m| "spec/#{m[1]}_spec.rb" }
|
|
4
|
+
watch(/^spec\/(.+)\.rb$/) { |m| "spec/#{m[1]}_spec.rb" }
|
|
5
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
|
6
|
+
|
|
7
|
+
watch(/^lib\/(.+)\.rb$/) { |m| "spec/#{m[1]}_spec.rb" }
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
guard :rubocop, all_on_start: true, cmd: ['--format', 'clang', '-c', '.rubocop.yml'] do
|
|
11
|
+
watch(/^lib\/(.+)\.rb$/)
|
|
12
|
+
watch(/\.rubocop.yml$/)
|
|
13
|
+
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,237 @@
|
|
|
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
|
+
[](http://badge.fury.io/gh/hirakiuc%2Ftinybucket)
|
|
11
|
+
[](https://travis-ci.org/hirakiuc/tinybucket)
|
|
12
|
+
[](https://codeclimate.com/github/hirakiuc/tinybucket)
|
|
13
|
+
[](https://coveralls.io/r/hirakiuc/tinybucket?branch=master)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Add this line to your application's Gemfile:
|
|
18
|
+
|
|
19
|
+
gem 'tinybucket'
|
|
20
|
+
|
|
21
|
+
And then execute:
|
|
22
|
+
|
|
23
|
+
$ bundle
|
|
24
|
+
|
|
25
|
+
Or install it yourself as:
|
|
26
|
+
|
|
27
|
+
$ gem install bitbucket
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
**WARNING** These specs will be changed at any time.
|
|
32
|
+
|
|
33
|
+
NOTE: `x` mark means `Already implemented.`.
|
|
34
|
+
|
|
35
|
+
### init
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
bucket = Tinybucket.new(oauth_key: 'key', oauth_secret: 'secret')
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
bucket = Tinybucket.new do |config|
|
|
43
|
+
config.oauth_key = 'key'
|
|
44
|
+
config.oauth_secret = 'secret'
|
|
45
|
+
end
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### repositories Endpoint
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
# [x] GET a list of all public repositories
|
|
52
|
+
repos = bucket.repos
|
|
53
|
+
|
|
54
|
+
# [x] GET a list of repositories owned by the account 'someone'
|
|
55
|
+
repos = bucket.repos('someone')
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
##### repository Resource
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
# [x] GET a repository
|
|
62
|
+
repo = bucket.repo('someone', 'great_repo')
|
|
63
|
+
|
|
64
|
+
# [x] Load a repository
|
|
65
|
+
# (Load the repository attributes from Bitbucket WebAPI)
|
|
66
|
+
repo.load
|
|
67
|
+
|
|
68
|
+
# [ ] POST a new repository
|
|
69
|
+
repo.create(params)
|
|
70
|
+
|
|
71
|
+
# [ ] DELETE a repository
|
|
72
|
+
repo.destroy
|
|
73
|
+
|
|
74
|
+
# [x] GET a list of watchers
|
|
75
|
+
watchers = repo.watchers
|
|
76
|
+
|
|
77
|
+
# [x] GET a list of forks
|
|
78
|
+
repos = repo.forks
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
##### pullrequests Resource
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
repo = bucket.repo('someone', 'great_repo')
|
|
85
|
+
|
|
86
|
+
# [x] GET a list of open pull requests
|
|
87
|
+
pull_requests = repo.pull_requests(options)
|
|
88
|
+
|
|
89
|
+
# [x] GET a specific pull request
|
|
90
|
+
pull_request = repo.pull_request(pr_id)
|
|
91
|
+
|
|
92
|
+
# [ ] POST (create) a new pull request
|
|
93
|
+
repo.pull_request.create(params)
|
|
94
|
+
|
|
95
|
+
# [ ] PUT a pull request update
|
|
96
|
+
repo.pull_request(pr_id).update(params)
|
|
97
|
+
|
|
98
|
+
# [x] GET the commits for a pull request
|
|
99
|
+
commits = pull_request.commits
|
|
100
|
+
|
|
101
|
+
# [x] POST a pull request approval
|
|
102
|
+
pull_request.approve
|
|
103
|
+
|
|
104
|
+
# [x] DELETE a pull request approval
|
|
105
|
+
pull_request.unapprove
|
|
106
|
+
|
|
107
|
+
# [ ] GET the diff for a pull request
|
|
108
|
+
diff = pull_request.diff
|
|
109
|
+
|
|
110
|
+
# [ ] GET the log of all of a repository's pull request activity
|
|
111
|
+
activities = repo.pull_requests_activities(options) # TODO: fix method name.
|
|
112
|
+
|
|
113
|
+
# [ ] GET the activity for a pull request
|
|
114
|
+
activities = pull_request.activities(options)
|
|
115
|
+
|
|
116
|
+
# [ ] Accept and merge a pull request
|
|
117
|
+
pull_request.merge(options)
|
|
118
|
+
|
|
119
|
+
# [ ] Decline or reject a pull request
|
|
120
|
+
pull_request.decline(options)
|
|
121
|
+
|
|
122
|
+
# [x] GET a list of pull request comments
|
|
123
|
+
comments = pull_request.comments
|
|
124
|
+
|
|
125
|
+
# [x] GET an individual pull request comment
|
|
126
|
+
comment = pull_request.comment(comment_id)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
##### commits or commit Resource
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
repo = bucket.repo('someone', 'great_repo')
|
|
133
|
+
|
|
134
|
+
# [x] GET a commits list for a repository or compare commits across branches
|
|
135
|
+
# branchortag, include, exclude options
|
|
136
|
+
commits = repo.commits(options)
|
|
137
|
+
|
|
138
|
+
# [x] GET an individual commit
|
|
139
|
+
commit = repo.commit('revision')
|
|
140
|
+
|
|
141
|
+
# [x] GET a list of commit comments
|
|
142
|
+
comments = commit.comments
|
|
143
|
+
|
|
144
|
+
# [x] GET an individual commit comment
|
|
145
|
+
comment = commit.comment(comment_id)
|
|
146
|
+
|
|
147
|
+
# [ ] POST a commit approval
|
|
148
|
+
commit.approve
|
|
149
|
+
|
|
150
|
+
# [ ] DELETE a commit approval
|
|
151
|
+
commit.unapprove
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
##### branch-restrictions Resource
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
repo = bucket.repo('someone', 'great_repo').find
|
|
158
|
+
|
|
159
|
+
# [x] GET the branch-restrictions
|
|
160
|
+
restrictions = repo.branch_restrictions
|
|
161
|
+
|
|
162
|
+
# [ ] POST the branch-restrictions
|
|
163
|
+
repo.create_branch_restrictions(restrictions)
|
|
164
|
+
|
|
165
|
+
# [x] GET a specific restriction
|
|
166
|
+
restriction = repo.branch_restriction(restriction_id)
|
|
167
|
+
|
|
168
|
+
# [ ] PUT a branch restriction update
|
|
169
|
+
restriction.update(params)
|
|
170
|
+
|
|
171
|
+
# [ ] DELETE the branch restriction
|
|
172
|
+
restriction.destroy
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
##### diff Resource
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
repo = bucket.repo('someone', 'great_repo').find
|
|
179
|
+
COMMIT_ID = '7e968c5'
|
|
180
|
+
|
|
181
|
+
# [x] GET a diff
|
|
182
|
+
diff = repo.diff(COMMIT_ID)
|
|
183
|
+
|
|
184
|
+
# [x] GET a patch
|
|
185
|
+
patch = repo.patch(COMMIT_ID)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### teams Endpoint
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
# [x] GET the team profile
|
|
192
|
+
team = bucket.team('team name')
|
|
193
|
+
|
|
194
|
+
# [x] GET the team members
|
|
195
|
+
members = team.members
|
|
196
|
+
|
|
197
|
+
# [x] GET the team followers
|
|
198
|
+
followers = team.followers
|
|
199
|
+
|
|
200
|
+
# [x] GET a list of accounts the team is following
|
|
201
|
+
following = team.following
|
|
202
|
+
|
|
203
|
+
# [x] GET the team's repositories
|
|
204
|
+
repos = team.repos
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### users Endpoint
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
# [x] GET the user profile
|
|
211
|
+
user = bucket.user('user name')
|
|
212
|
+
|
|
213
|
+
# [x] GET the list of followers
|
|
214
|
+
followers = user.followers
|
|
215
|
+
|
|
216
|
+
# [x] GET a list of accounts the user is following
|
|
217
|
+
followings = user.followings
|
|
218
|
+
|
|
219
|
+
# [x] GET the user's repositories
|
|
220
|
+
repos = user.repos
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Contribution
|
|
224
|
+
|
|
225
|
+
1. Fork it ( https://github.com/[my-github-username]/bitbucket/fork )
|
|
226
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
227
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
228
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
229
|
+
5. Create a new Pull Request
|
|
230
|
+
|
|
231
|
+
## License
|
|
232
|
+
|
|
233
|
+
See LICENSE file.
|
|
234
|
+
|
|
235
|
+
## Author
|
|
236
|
+
|
|
237
|
+
[hirakiuc](https://github.com/hirakiuc)
|
data/Rakefile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
|
|
4
|
+
require "bundler/gem_tasks"
|
|
5
|
+
|
|
6
|
+
desc 'cleanup rcov, doc directories'
|
|
7
|
+
task :clean do
|
|
8
|
+
rm_rf 'coverage'
|
|
9
|
+
rm_rf 'doc'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# https://github.com/sferik/twitter/blob/master/Rakefile
|
|
13
|
+
require 'rspec/core/rake_task'
|
|
14
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
15
|
+
task :test => :spec
|
|
16
|
+
|
|
17
|
+
begin
|
|
18
|
+
require 'rubocop/rake_task'
|
|
19
|
+
RuboCop::RakeTask.new
|
|
20
|
+
rescue LoadError
|
|
21
|
+
task :rubocop do
|
|
22
|
+
$stderr.puts 'Rubocop is disabled.'
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
require 'yard'
|
|
27
|
+
YARD::Rake::YardocTask.new
|
|
28
|
+
|
|
29
|
+
require 'yardstick/rake/measurement'
|
|
30
|
+
Yardstick::Rake::Measurement.new do |measurement|
|
|
31
|
+
measurement.output = 'measurement/report.txt'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
require 'yardstick/rake/verify'
|
|
35
|
+
Yardstick::Rake::Verify.new do |verify|
|
|
36
|
+
verify.threshold = 59.6
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
task :default => [:spec, :rubocop]
|