Skip to content

Refresh gem #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
Gemfile.lock
coverage
rdoc
doc
.yardoc
.bundle
pkg
*.swp
log
*.sqlite3
features/settings.yml
*.gem
*.sqlite3
*.swp
.bundle
.ruby-gemset
.tags
TAGS
.tags_sorted_by_file
.yardoc
/.idea
Gemfile.lock
TAGS
coverage
doc
features/settings.yml
log
pkg
rdoc
tags
/.idea
.ruby-gemset
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.1
3.1.5
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
source "http://rubygems.org"

source 'https://rubygems.org'
gemspec
24 changes: 11 additions & 13 deletions bitbucket_rest_api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,27 @@ Gem::Specification.new do |gem|
gem.name = 'bitbucket_rest_api'
gem.authors = [ "Mike Cochran" ]
gem.email = "[email protected]"
gem.homepage = 'https://github.com/vongrippen/bitbucket'
gem.summary = %q{ Ruby wrapper for the BitBucket API supporting OAuth and Basic Authentication }
gem.description = %q{ Ruby wrapper for the BitBucket API supporting OAuth and Basic Authentication }
gem.homepage = 'https://github.com/codeship/bitbucket'
gem.summary = %q{ Ruby wrapper for the Bitbucket API supporting OAuth and basic authentication }
gem.description = %q{ Ruby wrapper for the Bitbucket API supporting OAuth and basic authentication }
gem.version = BitBucket::VERSION::STRING.dup
gem.license = "MIT"

gem.files = Dir['Rakefile', '{features,lib,spec}/**/*', 'README*', 'LICENSE*']
gem.require_paths = %w[ lib ]

gem.add_dependency 'hashie'
gem.add_dependency 'faraday', '~> 0.9.0'
gem.add_dependency 'multi_json', '>= 1.7.5', '< 2.0'
gem.add_dependency 'faraday_middleware', '~> 0.9.0'
gem.add_dependency 'nokogiri', '>= 1.5.2'
gem.add_dependency 'simple_oauth', '~> 0.2.0'
gem.add_dependency 'faraday', '>= 1', '< 2'
gem.add_dependency 'multi_json', '>= 1.15.0', '< 2.0'
gem.add_dependency 'faraday_middleware', '~> 1.2.0'
gem.add_dependency 'nokogiri', '>= 1.15.6'
gem.add_dependency 'simple_oauth', '~> 0.3.1'

gem.add_development_dependency 'rspec', '>= 0'
gem.add_development_dependency 'rspec', '>= 3'
gem.add_development_dependency 'rack-test'
gem.add_development_dependency 'webmock', '~> 1.8.0'
gem.add_development_dependency 'vcr', '~> 2.2.0'
gem.add_development_dependency 'simplecov', '~> 0.6.1'
gem.add_development_dependency 'webmock', '~> 3.23.0'
gem.add_development_dependency 'simplecov', '~> 0.22.0'
gem.add_development_dependency 'rake'
gem.add_development_dependency 'bundler'
gem.add_development_dependency 'pry-byebug'
gem.add_development_dependency 'mocha', '~> 1.4.0'
end
2 changes: 1 addition & 1 deletion lib/bitbucket_rest_api/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module BitBucket
module VERSION
MAJOR = 0
MINOR = 1
PATCH = 7
PATCH = 8

STRING = [MAJOR, MINOR, PATCH].compact.join('.')
end
Expand Down
30 changes: 18 additions & 12 deletions spec/bitbucket_rest_api/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,33 @@
require 'bitbucket_rest_api/request'

describe BitBucket::Request do
let(:fake_api) { (Class.new { include BitBucket::Request })}
let(:faraday_connection) { Faraday.new(:url => 'https://api.bitbucket.org') }
let(:fake_api) do
Class.new do
include BitBucket::Request

def connection(*args)
Faraday.new(:url => 'https://api.bitbucket.org')
end

def new_access_token
'12345'
end
end
end

describe "request" do
it "raises an ArgumentError if an unsupported HTTP verb is used" do
expect { fake_api.new.request(:i_am_a_teapot, {}, '/') }.to raise_error(ArgumentError)
end

context "with a connection" do
before do
(fake_api).any_instance.stubs(:connection).returns(faraday_connection)
(fake_api).any_instance.stubs(:new_access_token).returns("12345")
end

it "supports get" do
stub_request(:get, "https://api.bitbucket.org/1.0/endpoint").
with(:headers => {
'Accept' => '*/*',
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'Authorization' => 'Bearer 12345',
'User-Agent' => 'Faraday v0.9.2'
'User-Agent' => "Faraday v#{Faraday::VERSION}"
})

fake_api.new.request(:get, '/1.0/endpoint', {}, {})
Expand All @@ -35,7 +41,7 @@
'Accept' => '*/*',
'Content-Type'=>'application/x-www-form-urlencoded',
'Authorization' => 'Bearer 12345',
'User-Agent' => 'Faraday v0.9.2'
'User-Agent' => "Faraday v#{Faraday::VERSION}"
})

fake_api.new.request(:put, '/1.0/endpoint', { 'data' => { 'key' => 'value'} }, {})
Expand All @@ -48,7 +54,7 @@
'Accept' => '*/*',
'Content-Type'=>'application/x-www-form-urlencoded',
'Authorization' => 'Bearer 12345',
'User-Agent' => 'Faraday v0.9.2'
'User-Agent' => "Faraday v#{Faraday::VERSION}"
})

fake_api.new.request(:patch, '/1.0/endpoint', { 'data' => { 'key' => 'value'} }, {})
Expand All @@ -59,7 +65,7 @@
with(:headers => {
'Accept' => '*/*',
'Authorization' => 'Bearer 12345',
'User-Agent' => 'Faraday v0.9.2'
'User-Agent' => "Faraday v#{Faraday::VERSION}"
})
fake_api.new.request(:delete, '/1.0/endpoint', {}, {})
end
Expand All @@ -71,7 +77,7 @@
'Accept' => '*/*',
'Content-Type'=>'application/x-www-form-urlencoded',
'Authorization' => 'Bearer 12345',
'User-Agent' => 'Faraday v0.9.2'
'User-Agent' => "Faraday v#{Faraday::VERSION}"
})

fake_api.new.request(:post, '/1.0/endpoint', { 'data' => { 'key' => 'value'} }, {})
Expand Down
7 changes: 0 additions & 7 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,15 @@

require 'webmock/rspec'
require 'pry'
require 'vcr'

require 'bitbucket_rest_api'

RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
config.mock_with :mocha
end

config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
end

# VCR.configure do |config|
# config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
# config.hook_into :webmock
# end