tinybucket 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df8de5bb4a23d41681373aca721509d6ed520902
4
- data.tar.gz: a0e0d3fc7485d3f065ae93aef7b92d7b32f31b8b
3
+ metadata.gz: 8f31ef006e2349c6b675693438c0495738f12f8e
4
+ data.tar.gz: 8e6936028ede63f3fb2329fee38a642ae24c6977
5
5
  SHA512:
6
- metadata.gz: 5456f3c17cbe2ee7fde00fc7609059da637326575cebe64ec717ea8dde55130205d6a3c1a73e5bd8a7d9f7f830f79c4a4362f934b5901ca5362e00335cdeb33b
7
- data.tar.gz: fc4c4969316d1294247c251d02a8e06219095f3701a77f46b5013a028515160ea80806025565fc39317a0b0e251485de781edaf7a154ec28eda880617212b080
6
+ metadata.gz: 233c5f18bf339318144d37ddb80ab00ce3867e276ccd2fd0efb39ca105d1453a0b6434e12cab2fababcac270d50d4b1df2de953e7a05c4a1f1ce264aaa75bd53
7
+ data.tar.gz: d7be4ba5300b87cfe0f18dabc5820564e0fa98f6c4b6515b7f26e19412a8c22575933d80c8add582311a80bc44d6c9c6d1145b46f5a93acf0ac0c4d15588ec04
data/README.md CHANGED
@@ -7,7 +7,7 @@ A Ruby client library for Bitbucket REST API v2 with OAuth Authentication.
7
7
 
8
8
  This gem is inspired by [vongrippen/bitbucket](https://github.com/vongrippen/bitbucket). Thanks.
9
9
 
10
- [![GitHub version](https://badge.fury.io/gh/hirakiuc%2Ftinybucket.png)](http://badge.fury.io/gh/hirakiuc%2Ftinybucket)
10
+ [![Gem Version](https://badge.fury.io/rb/tinybucket.png)](http://badge.fury.io/rb/tinybucket)
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)
@@ -167,7 +167,7 @@ activities = repo.pull_requests_activities(options) # TODO: fix method name.
167
167
  # [ ] GET the activity for a pull request
168
168
  activities = pull_request.activities(options)
169
169
 
170
- # [ ] Accept and merge a pull request
170
+ # [x] Accept and merge a pull request
171
171
  pull_request.merge(options)
172
172
 
173
173
  # [x] Decline or reject a pull request
@@ -38,6 +38,12 @@ module Tinybucket
38
38
  'decline')
39
39
  end
40
40
 
41
+ def path_to_merge(pr_id)
42
+ build_path(base_path,
43
+ [pr_id, 'pullrequest_id'],
44
+ 'merge')
45
+ end
46
+
41
47
  def base_path
42
48
  build_path('/repositories',
43
49
  [repo_owner, 'repo_owner'],
@@ -46,6 +46,11 @@ module Tinybucket
46
46
  (result['approved'] == false)
47
47
  end
48
48
 
49
+ def merge(pr_id, options = {})
50
+ result = post_path(path_to_merge(pr_id), options)
51
+ (result['state'] == 'MERGED')
52
+ end
53
+
49
54
  def diff(pr_id, options = {})
50
55
  get_path(path_to_diff(pr_id), options)
51
56
  end
@@ -45,6 +45,10 @@ module Tinybucket
45
45
  pull_request_api(options).diff(id, options)
46
46
  end
47
47
 
48
+ def merge(options = {})
49
+ pull_request_api(options).merge(id, options)
50
+ end
51
+
48
52
  private
49
53
 
50
54
  def comment_api(options)
@@ -1,3 +1,3 @@
1
1
  module Tinybucket
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
@@ -0,0 +1,123 @@
1
+ {
2
+ "description": "test",
3
+ "links": {
4
+ "decline": {
5
+ "href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2819/decline"
6
+ },
7
+ "commits": {
8
+ "href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2819/commits"
9
+ },
10
+ "self": {
11
+ "href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2819"
12
+ },
13
+ "comments": {
14
+ "href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2819/comments"
15
+ },
16
+ "merge": {
17
+ "href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2819/merge"
18
+ },
19
+ "html": {
20
+ "href": "https://bitbucket.org/tutorials/tutorials.bitbucket.org/pull-request/2819"
21
+ },
22
+ "activity": {
23
+ "href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2819/activity"
24
+ },
25
+ "diff": {
26
+ "href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2819/diff"
27
+ },
28
+ "approve": {
29
+ "href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/pullrequests/2819/approve"
30
+ }
31
+ },
32
+ "title": "testing",
33
+ "close_source_branch": false,
34
+ "reviewers": [],
35
+ "destination": {
36
+ "commit": {
37
+ "hash": "382c3b9528dc",
38
+ "links": {
39
+ "self": {
40
+ "href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/commit/382c3b9528dc"
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": "d3d92dca839c",
76
+ "links": {
77
+ "self": {
78
+ "href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/commit/d3d92dca839c"
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": "MERGED",
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-19T20:53:29.288706+00:00",
112
+ "participants": [],
113
+ "updated_on": "2013-11-19T20:54:32.387720+00:00",
114
+ "merge_commit": {
115
+ "hash": "cd2506b7e620",
116
+ "links": {
117
+ "self": {
118
+ "href": "https://bitbucket.org/api/2.0/repositories/tutorials/tutorials.bitbucket.org/commit/cd2506b7e620"
119
+ }
120
+ }
121
+ },
122
+ "id": 2819
123
+ }
@@ -134,4 +134,14 @@ RSpec.describe Tinybucket::Model::PullRequest do
134
134
  it { expect(subject).to be_instance_of(String) }
135
135
 
136
136
  end
137
- end
137
+ describe 'merge' do
138
+ let(:request_method) { :post }
139
+ let(:request_path) do
140
+ "/repositories/#{owner}/#{slug}/pullrequests/1/merge"
141
+ end
142
+
143
+ subject { model.merge }
144
+
145
+ it { expect(subject).to be_truthy }
146
+ end
147
+ end
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - hirakiuc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-08 00:00:00.000000000 Z
11
+ date: 2015-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -322,6 +322,7 @@ files:
322
322
  - spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/decline/post.json
323
323
  - spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/diff/get.txt
324
324
  - spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/get.json
325
+ - spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/merge/post.json
325
326
  - spec/fixtures/repositories/test_owner/test_repo/pullrequests/get.json
326
327
  - spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_declined.json
327
328
  - spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_merged.json
@@ -384,7 +385,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
384
385
  version: '0'
385
386
  requirements: []
386
387
  rubyforge_project:
387
- rubygems_version: 2.2.2
388
+ rubygems_version: 2.4.5.1
388
389
  signing_key:
389
390
  specification_version: 4
390
391
  summary: ruby wrapper for the Bitbucket REST API (v2) with oauth
@@ -414,6 +415,7 @@ test_files:
414
415
  - spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/decline/post.json
415
416
  - spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/diff/get.txt
416
417
  - spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/get.json
418
+ - spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/merge/post.json
417
419
  - spec/fixtures/repositories/test_owner/test_repo/pullrequests/get.json
418
420
  - spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_declined.json
419
421
  - spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_merged.json