summaryrefslogtreecommitdiff
path: root/lib/bitbucket
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-11-19 21:44:19 -0800
committerStan Hu <stanhu@gmail.com>2016-11-21 16:47:29 -0800
commitc7c4d657b427c6fa146319ccc5aa17e87d3d0e0b (patch)
treea08bf7131eb387a22bf47488481c03befa3f75fe /lib/bitbucket
parent4d7303a98e970c29079cc03a449c71f3cdaa1214 (diff)
downloadgitlab-ce-c7c4d657b427c6fa146319ccc5aa17e87d3d0e0b.tar.gz
Clean up Bitbucket connection based on review comments
Diffstat (limited to 'lib/bitbucket')
-rw-r--r--lib/bitbucket/client.rb2
-rw-r--r--lib/bitbucket/connection.rb16
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/bitbucket/client.rb b/lib/bitbucket/client.rb
index 0d4cfd600b8..33e977d655d 100644
--- a/lib/bitbucket/client.rb
+++ b/lib/bitbucket/client.rb
@@ -1,7 +1,7 @@
module Bitbucket
class Client
def initialize(options = {})
- @connection = options.fetch(:connection, Connection.new(options))
+ @connection = Connection.new(options)
end
def issues(repo)
diff --git a/lib/bitbucket/connection.rb b/lib/bitbucket/connection.rb
index 201e7e3b808..c375fe16aee 100644
--- a/lib/bitbucket/connection.rb
+++ b/lib/bitbucket/connection.rb
@@ -7,12 +7,12 @@ module Bitbucket
def initialize(options = {})
@api_version = options.fetch(:api_version, DEFAULT_API_VERSION)
@base_uri = options.fetch(:base_uri, DEFAULT_BASE_URI)
- @query = options.fetch(:query, DEFAULT_QUERY)
+ @default_query = options.fetch(:query, DEFAULT_QUERY)
- @token = options.fetch(:token)
- @expires_at = options.fetch(:expires_at)
- @expires_in = options.fetch(:expires_in)
- @refresh_token = options.fetch(:refresh_token)
+ @token = options[:token]
+ @expires_at = options[:expires_at]
+ @expires_in = options[:expires_in]
+ @refresh_token = options[:refresh_token]
end
def client
@@ -24,13 +24,13 @@ module Bitbucket
end
def query(params = {})
- @query.merge!(params)
+ @default_query.merge!(params)
end
- def get(path, query = {})
+ def get(path, extra_query = {})
refresh! if expired?
- response = connection.get(build_url(path), params: @query.merge(query))
+ response = connection.get(build_url(path), params: @default_query.merge(extra_query))
response.parsed
end