tinybucket 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/tinybucket/api/helper/pull_requests_helper.rb +6 -0
- data/lib/tinybucket/api/pull_requests_api.rb +5 -0
- data/lib/tinybucket/model/pull_request.rb +4 -0
- data/lib/tinybucket/version.rb +1 -1
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/decline/post.json +116 -0
- data/spec/lib/tinybucket/model/pull_request_spec.rb +11 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1269b0935055e587255a2efa9485d568d075c581
|
4
|
+
data.tar.gz: 142e74c98d8bcee9cdd98cb3561b68cdc7002901
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6ad29db68508a71f16670550762f6461588f55397f140d3375c801da2e27569c96ac402d272aa0492f1b6fc4bbc10e046a259a3a83e8bbb06eaa93b4fd72f98
|
7
|
+
data.tar.gz: b77657f858c70b6a869bbfc76f4a89f97e74489d7014106741fec697aa1380f4d913e97b0cd8c6d1529000d89a56b45f559d57fd5955cfd0c0a255164918ab54
|
data/README.md
CHANGED
@@ -37,12 +37,12 @@ NOTE: `x` mark means `Already implemented.`.
|
|
37
37
|
### init
|
38
38
|
|
39
39
|
```
|
40
|
-
bucket = Tinybucket.new(
|
40
|
+
bucket = Tinybucket.new(oauth_token: 'key', oauth_secret: 'secret')
|
41
41
|
```
|
42
42
|
|
43
43
|
```
|
44
44
|
bucket = Tinybucket.new do |config|
|
45
|
-
config.
|
45
|
+
config.oauth_token = 'key'
|
46
46
|
config.oauth_secret = 'secret'
|
47
47
|
end
|
48
48
|
```
|
@@ -153,7 +153,7 @@ activities = pull_request.activities(options)
|
|
153
153
|
# [ ] Accept and merge a pull request
|
154
154
|
pull_request.merge(options)
|
155
155
|
|
156
|
-
# [
|
156
|
+
# [x] Decline or reject a pull request
|
157
157
|
pull_request.decline(options)
|
158
158
|
|
159
159
|
# [x] GET a list of pull request comments
|
@@ -36,6 +36,11 @@ module Tinybucket
|
|
36
36
|
(result['approved'] == true)
|
37
37
|
end
|
38
38
|
|
39
|
+
def decline(pr_id, options = {})
|
40
|
+
result = post_path(path_to_decline(pr_id), options)
|
41
|
+
(result['state'] == 'DECLINED')
|
42
|
+
end
|
43
|
+
|
39
44
|
def unapprove(pr_id, options = {})
|
40
45
|
result = delete_path(path_to_approve(pr_id), options)
|
41
46
|
(result['approved'] == false)
|
data/lib/tinybucket/version.rb
CHANGED
@@ -0,0 +1,116 @@
|
|
1
|
+
{
|
2
|
+
"description": "",
|
3
|
+
"links": {
|
4
|
+
"decline": {
|
5
|
+
"href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2820/decline"
|
6
|
+
},
|
7
|
+
"commits": {
|
8
|
+
"href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2820/commits"
|
9
|
+
},
|
10
|
+
"self": {
|
11
|
+
"href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2820"
|
12
|
+
},
|
13
|
+
"comments": {
|
14
|
+
"href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2820/comments"
|
15
|
+
},
|
16
|
+
"merge": {
|
17
|
+
"href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2820/merge"
|
18
|
+
},
|
19
|
+
"html": {
|
20
|
+
"href": "https://bitbucket.org/tutorials/tutorials.bitbucket.org/pull-request/2820"
|
21
|
+
},
|
22
|
+
"activity": {
|
23
|
+
"href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2820/activity"
|
24
|
+
},
|
25
|
+
"diff": {
|
26
|
+
"href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2820/diff"
|
27
|
+
},
|
28
|
+
"approve": {
|
29
|
+
"href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2820/approve"
|
30
|
+
}
|
31
|
+
},
|
32
|
+
"title": "test",
|
33
|
+
"close_source_branch": false,
|
34
|
+
"reviewers": [],
|
35
|
+
"destination": {
|
36
|
+
"commit": {
|
37
|
+
"hash": "cd2506b7e620",
|
38
|
+
"links": {
|
39
|
+
"self": {
|
40
|
+
"href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/commit/cd2506b7e620"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
},
|
44
|
+
"repository": {
|
45
|
+
"links": {
|
46
|
+
"self": {
|
47
|
+
"href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org"
|
48
|
+
},
|
49
|
+
"avatar": {
|
50
|
+
"href": "https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2012/Nov/28/tutorials.bitbucket.org-logo-1456883302-9_avatar.png"
|
51
|
+
}
|
52
|
+
},
|
53
|
+
"full_name": "tutorials/tutorials.bitbucket.org",
|
54
|
+
"name": "tutorials.bitbucket.org"
|
55
|
+
},
|
56
|
+
"branch": {
|
57
|
+
"name": "default"
|
58
|
+
}
|
59
|
+
},
|
60
|
+
"reason": "",
|
61
|
+
"closed_by": {
|
62
|
+
"username": "tutorials",
|
63
|
+
"display_name": "first name last",
|
64
|
+
"links": {
|
65
|
+
"self": {
|
66
|
+
"href": "https://bitbucket.org/api/2.0/users/tutorials"
|
67
|
+
},
|
68
|
+
"avatar": {
|
69
|
+
"href": "https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2013/Jul/17/tutorials-avatar-1826704565-4_avatar.png"
|
70
|
+
}
|
71
|
+
}
|
72
|
+
},
|
73
|
+
"source": {
|
74
|
+
"commit": {
|
75
|
+
"hash": "067c283803a7",
|
76
|
+
"links": {
|
77
|
+
"self": {
|
78
|
+
"href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/commit/067c283803a7"
|
79
|
+
}
|
80
|
+
}
|
81
|
+
},
|
82
|
+
"repository": {
|
83
|
+
"links": {
|
84
|
+
"self": {
|
85
|
+
"href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org"
|
86
|
+
},
|
87
|
+
"avatar": {
|
88
|
+
"href": "https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2012/Nov/28/tutorials.bitbucket.org-logo-1456883302-9_avatar.png"
|
89
|
+
}
|
90
|
+
},
|
91
|
+
"full_name": "tutorials/tutorials.bitbucket.org",
|
92
|
+
"name": "tutorials.bitbucket.org"
|
93
|
+
},
|
94
|
+
"branch": {
|
95
|
+
"name": "againwithatest"
|
96
|
+
}
|
97
|
+
},
|
98
|
+
"state": "DECLINED",
|
99
|
+
"author": {
|
100
|
+
"username": "tutorials",
|
101
|
+
"display_name": "first name last",
|
102
|
+
"links": {
|
103
|
+
"self": {
|
104
|
+
"href": "https://bitbucket.org/api/2.0/users/tutorials"
|
105
|
+
},
|
106
|
+
"avatar": {
|
107
|
+
"href": "https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2013/Jul/17/tutorials-avatar-1826704565-4_avatar.png"
|
108
|
+
}
|
109
|
+
}
|
110
|
+
},
|
111
|
+
"created_on": "2013-11-19T21:13:26.746009+00:00",
|
112
|
+
"participants": [],
|
113
|
+
"updated_on": "2013-11-19T21:14:04.620150+00:00",
|
114
|
+
"merge_commit": null,
|
115
|
+
"id": 2820
|
116
|
+
}
|
@@ -72,6 +72,17 @@ RSpec.describe Tinybucket::Model::PullRequest do
|
|
72
72
|
it { expect(subject).to be_truthy }
|
73
73
|
end
|
74
74
|
|
75
|
+
describe 'decline' do
|
76
|
+
let(:request_method) { :post }
|
77
|
+
let(:request_path) do
|
78
|
+
"/repositories/#{owner}/#{slug}/pullrequests/1/decline"
|
79
|
+
end
|
80
|
+
|
81
|
+
subject { model.decline }
|
82
|
+
|
83
|
+
it { expect(subject).to be_truthy }
|
84
|
+
end
|
85
|
+
|
75
86
|
describe 'commits' do
|
76
87
|
let(:request_path) do
|
77
88
|
"/repositories/#{owner}/#{slug}/pullrequests/1/commits"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tinybucket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hirakiuc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -314,6 +314,7 @@ files:
|
|
314
314
|
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/comments/1/get.json
|
315
315
|
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/comments/get.json
|
316
316
|
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/commits/get.json
|
317
|
+
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/decline/post.json
|
317
318
|
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/diff/get.txt
|
318
319
|
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/get.json
|
319
320
|
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/get.json
|
@@ -375,7 +376,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
375
376
|
version: '0'
|
376
377
|
requirements: []
|
377
378
|
rubyforge_project:
|
378
|
-
rubygems_version: 2.4.
|
379
|
+
rubygems_version: 2.4.5
|
379
380
|
signing_key:
|
380
381
|
specification_version: 4
|
381
382
|
summary: ruby wrapper for the Bitbucket REST API (v2) with oauth
|
@@ -400,6 +401,7 @@ test_files:
|
|
400
401
|
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/comments/1/get.json
|
401
402
|
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/comments/get.json
|
402
403
|
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/commits/get.json
|
404
|
+
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/decline/post.json
|
403
405
|
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/diff/get.txt
|
404
406
|
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/get.json
|
405
407
|
- spec/fixtures/repositories/test_owner/test_repo/pullrequests/get.json
|