tinybucket 0.1.5 → 0.1.6
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 +4 -4
- data/README.md +2 -2
- 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/merge/post.json +123 -0
- data/spec/lib/tinybucket/model/pull_request_spec.rb +11 -1
- 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: 8f31ef006e2349c6b675693438c0495738f12f8e
         | 
| 4 | 
            +
              data.tar.gz: 8e6936028ede63f3fb2329fee38a642ae24c6977
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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 | 
            -
            [](http://badge.fury.io/rb/tinybucket)
         | 
| 11 11 | 
             
            [](https://travis-ci.org/hirakiuc/tinybucket)
         | 
| 12 12 | 
             
            [](https://codeclimate.com/github/hirakiuc/tinybucket)
         | 
| 13 13 | 
             
            [](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 | 
            -
            # [ | 
| 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
         | 
| @@ -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
         | 
    
        data/lib/tinybucket/version.rb
    CHANGED
    
    
| @@ -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 | 
            -
             | 
| 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. | 
| 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- | 
| 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. | 
| 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
         |