{"id":19437288,"url":"https://github.com/reenhanced/bitbucket","last_synced_at":"2025-04-24T21:31:47.489Z","repository":{"id":21984512,"uuid":"25309443","full_name":"reenhanced/bitbucket","owner":"reenhanced","description":"Gem for connecting to the Bitbucket API via RESTful resources (formerly: https://github.com/vongrippen/bitbucket)","archived":false,"fork":false,"pushed_at":"2015-03-25T19:08:43.000Z","size":372,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T20:03:40.175Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reenhanced.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-16T15:48:02.000Z","updated_at":"2015-03-25T19:08:39.000Z","dependencies_parsed_at":"2022-08-18T03:11:33.854Z","dependency_job_id":null,"html_url":"https://github.com/reenhanced/bitbucket","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reenhanced%2Fbitbucket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reenhanced%2Fbitbucket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reenhanced%2Fbitbucket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reenhanced%2Fbitbucket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reenhanced","download_url":"https://codeload.github.com/reenhanced/bitbucket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250713002,"owners_count":21475120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T15:14:15.223Z","updated_at":"2025-04-24T21:31:47.194Z","avatar_url":"https://github.com/reenhanced.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BitBucketAPI\n\n[![Gem Version](https://badge.fury.io/rb/bitbucket_rest_api.png)](http://badge.fury.io/rb/bitbucket_rest_api)\n\n[Wiki](https://github.com/vongrippen/bitbucket/wiki) | [RDocs](http://rubydoc.info/github/vongrippen/bitbucket/master/frames)\n\nA Ruby wrapper for the BitBucket REST API.\n\n## Installation\n\nInstall the gem by issuing\n\n```ruby\ngem install bitbucket_rest_api\n```\n\nor put it in your Gemfile and run `bundle install`\n\n```ruby\ngem \"bitbucket_rest_api\"\n```\n\n## Usage\n\nCreate a new client instance\n\n```ruby\nbitbucket = BitBucket.new\n```\n\nAt this stage you can also supply various configuration parameters, such as `:user`,`:repo`, `:oauth_token`, `:oauth_secret`, `:basic_auth` which are used throughout the API. These can be passed directly as hash options:\n\n```ruby\nbitbucket = BitBucket.new oauth_token: 'request_token', oauth_secret: 'request_secret'\n```\n\nAlternatively, you can configure the BitBucket settings by passing a block:\n\n```ruby\nbitbucket = BitBucket.new do |config|\n  config.oauth_token   = 'request_token'\n  config.oauth_secret  = 'request_secret'\n  config.client_id     = 'consumer_key'\n  config.client_secret = 'consumer_secret'\n  config.adapter       = :net_http\nend\n```\n\nYou can authenticate either using OAuth authentication or through basic authentication by passing your login and password credentials\n\n```ruby\nbitbucket = BitBucket.new login:'vongrippen', password:'...'\n```\n\nor use convenience method:\n\n```ruby\nbitbucket = BitBucket.new basic_auth: 'login:password'\n```\n\nYou can interact with BitBucket interface, for example repositories, by issuing following calls that correspond directly to the BitBucket API hierarchy\n\n```ruby\nbitbucket.repos.changesets.all  'user-name', 'repo-name'\nbitbucket.repos.keys.list     'user-name', 'repo-name'\n```\n\nThe response is of type [Hashie::Mash] and allows to traverse all the json response attributes like method calls.\n\n## Inputs\n\nSome API methods apart from required parameters such as username or repository name\nallow you to switch the way the data is returned to you, for instance by passing\na block you can iterate over the list of repositories\n\n```ruby\nbitbucket.repos.list do |repo|\n    puts repo.slug\nend\n```\n\n## Advanced Configuration\n\nThe `bitbucket_rest_api` gem will use the default middleware stack which is exposed by calling `stack` on client instance. However, this stack can be freely modified with methods such as `insert`, `insert_after`, `delete` and `swap`. For instance to add your `CustomMiddleware` do\n\n```ruby\nbitbucket = BitBucket.new do |config|\n  config.stack.insert_after BitBucket::Response::Helpers, CustomMiddleware\nend\n```\n\nFurthermore, you can build your entire custom stack and specify other connection options such as `adapter`\n\n```ruby\nbitbucket = BitBucket.new do |config|\n  config.adapter :excon\n\n  config.stack do |builder|\n    builder.use BitBucket::Response::Helpers\n    builder.use BitBucket::Response::Jsonize\n  end\nend\n```\n\n## API\n\nMain API methods are grouped into the following classes that can be instantiated on their own\n\n```ruby\nBitBucket         - full API access\n\nBitBucket::Repos           BitBucket::Issues\n```\n\nSome parts of BitBucket API require you to be authenticated, for instance the following are examples of APIs only for the authenticated user\n\n```ruby\nBitBucket::Issues::Create\n```\n\nYou can find out supported methods by calling `actions` on a class instance in your `irb`:\n\n```ruby\n\u003e\u003e BitBucket::Repos.actions                 \u003e\u003e bitbucket.issues.actions\n---                                         ---\n|--\u003e all                                    |--\u003e all\n|--\u003e branches                               |--\u003e comments\n|--\u003e collaborators                          |--\u003e create\n|--\u003e commits                                |--\u003e edit\n|--\u003e contribs                               |--\u003e events\n|--\u003e contributors                           |--\u003e find\n|--\u003e create                                 |--\u003e get\n|--\u003e downloads                              |--\u003e labels\n|--\u003e edit                                   |--\u003e list\n|--\u003e find                                   |--\u003e list_repo\n|--\u003e forks                                  |--\u003e list_repository\n|--\u003e get                                    |--\u003e milestones\n|--\u003e hooks                                  ...\n...\n```\n\n## Configuration\n\nCertain methods require authentication. To get your BitBucket OAuth credentials,\nregister an app with BitBucket.\n\n```ruby\nBitBucket.configure do |config|\n  config.oauth_token   = YOUR_OAUTH_REQUEST_TOKEN          # Different for each user\n  config.oauth_secret  = YOUR_OAUTH_REQUEST_TOKEN_SECRET   # Differenct for each user\n  config.client_id     = YOUR_OAUTH_CONSUMER_TOKEN\n  config.client_secret = YOUR_OAUTH_CONSUMER_TOKEN_SECRET\n  config.basic_auth    = 'login:password'\nend\n\nor\n\nBitBucket.new(:oauth_token =\u003e YOUR_OAUTH_REQUEST_TOKEN, :oauth_secret =\u003e YOUR_OAUTH_REQUEST_TOKEN_SECRET)\nBitBucket.new(:basic_auth =\u003e 'login:password')\n```\n\n## Development\n\nQuestions or problems? Please post them on the [issue tracker](https://bitbucket.com/vongrippen/bitbucket/issues). You can contribute changes by forking the project and submitting a pull request. You can ensure the tests are passing by running `bundle` and `rake`.\n\n## Copyright\n\nCopyright (c) 2012 James M Cochran.\nOriginal github_api gem Copyright (c) 2011-2012 Piotr Murach. See LICENSE.txt for further details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freenhanced%2Fbitbucket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freenhanced%2Fbitbucket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freenhanced%2Fbitbucket/lists"}