diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..b1b25a5 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.2.2 diff --git a/.rvmrc b/.rvmrc deleted file mode 100644 index ea7c5ec..0000000 --- a/.rvmrc +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -environment_id="ruby-1.9.2-p290@bitbucket_api" - -# -# First we attempt to load the desired environment directly from the environment -# file. This is very fast and efficicent compared to running through the entire -# CLI and selector. If you want feedback on which environment was used then -# insert the word 'use' after --create as this triggers verbose mode. -# -if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \ - && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] ; then - \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id" - - [[ -s ".rvm/hooks/after_use" ]] && . ".rvm/hooks/after_use" -else - # If the environment file has not yet been created, use the RVM CLI to select. - rvm --create "$environment_id" -fi - -# Ensure that Bundler is installed. Install it if it is not. -if ! command -v bundle >/dev/null; then - printf "The rubygem 'bundler' is not installed. Installing it now.\n" - gem install bundler -fi - -# Bundle while reducing excess noise. -printf "Bundling your gems. This may take a few minutes on a fresh clone.\n" -bundle | grep -v '^Using ' | grep -v ' is complete' | sed '/^$/d' diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..1e0bf5c --- /dev/null +++ b/bin/console @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +require 'bundler/setup' +require 'bitbucket_rest_api' + +require 'pry' +Pry.start diff --git a/lib/bitbucket_rest_api/repos/commits.rb b/lib/bitbucket_rest_api/repos/commits.rb index e743cdc..25dd830 100644 --- a/lib/bitbucket_rest_api/repos/commits.rb +++ b/lib/bitbucket_rest_api/repos/commits.rb @@ -6,7 +6,7 @@ class Repos::Commits < API def get(user_name, repo_name) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? - get_request("/1.0/repositories/#{user}/#{repo.downcase}/commits") + get_request("/2.0/repositories/#{user}/#{repo.downcase}/commits") end diff --git a/spec/bitbucket_rest_api/repos/commits_spec.rb b/spec/bitbucket_rest_api/repos/commits_spec.rb new file mode 100644 index 0000000..e2b2f63 --- /dev/null +++ b/spec/bitbucket_rest_api/repos/commits_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe BitBucket::Repos::Commits do + let(:commits) { BitBucket::Repos::Commits.new } + + describe '.get' do + before do + expect(commits).to receive(:request).with( + :get, + '/2.0/repositories/mock_username/mock_repo/commits', + {}, + {} + ) + end + + it 'should send a GET request for the commits belonging to the given repo' do + commits.get('mock_username', 'mock_repo') + end + end +end