summaryrefslogtreecommitdiff
path: root/lib/bitbucket
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2016-12-12 16:16:51 +0200
committerValery Sizov <valery@gitlab.com>2016-12-12 16:16:51 +0200
commit314c4746bc24a31efe88b142cd83ab36c3473cc9 (patch)
tree5031a8a29ddfe1078fb9baedf41dd4c865d95619 /lib/bitbucket
parent1d7f85aeef624a83f0b225217a23c8f5189cde54 (diff)
downloadgitlab-ce-314c4746bc24a31efe88b142cd83ab36c3473cc9.tar.gz
Specs for Bitbucket::Connections and Bitbucket::Collections
Diffstat (limited to 'lib/bitbucket')
-rw-r--r--lib/bitbucket/connection.rb20
-rw-r--r--lib/bitbucket/paginator.rb4
2 files changed, 9 insertions, 15 deletions
diff --git a/lib/bitbucket/connection.rb b/lib/bitbucket/connection.rb
index 692a596c057..c150a20761e 100644
--- a/lib/bitbucket/connection.rb
+++ b/lib/bitbucket/connection.rb
@@ -15,18 +15,6 @@ module Bitbucket
@refresh_token = options[:refresh_token]
end
- def client
- @client ||= OAuth2::Client.new(provider.app_id, provider.app_secret, options)
- end
-
- def connection
- @connection ||= OAuth2::AccessToken.new(client, @token, refresh_token: @refresh_token, expires_at: @expires_at, expires_in: @expires_in)
- end
-
- def set_default_query_parameters(params = {})
- @default_query.merge!(params)
- end
-
def get(path, extra_query = {})
refresh! if expired?
@@ -52,6 +40,14 @@ module Bitbucket
attr_reader :expires_at, :expires_in, :refresh_token, :token
+ def client
+ @client ||= OAuth2::Client.new(provider.app_id, provider.app_secret, options)
+ end
+
+ def connection
+ @connection ||= OAuth2::AccessToken.new(client, @token, refresh_token: @refresh_token, expires_at: @expires_at, expires_in: @expires_in)
+ end
+
def build_url(path)
return path if path.starts_with?(root_url)
diff --git a/lib/bitbucket/paginator.rb b/lib/bitbucket/paginator.rb
index 641a6ed79d6..b38cd99855c 100644
--- a/lib/bitbucket/paginator.rb
+++ b/lib/bitbucket/paginator.rb
@@ -7,8 +7,6 @@ module Bitbucket
@type = type
@url = url
@page = nil
-
- connection.set_default_query_parameters(pagelen: PAGE_LENGTH, sort: :created_on)
end
def items
@@ -31,7 +29,7 @@ module Bitbucket
end
def fetch_next_page
- parsed_response = connection.get(next_url)
+ parsed_response = connection.get(next_url, { pagelen: PAGE_LENGTH, sort: :created_on })
Page.new(parsed_response, type)
end
end