Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.0 on 2022-01-18 at 14:00 UTC+1 (a few minutes of down time)

Commit b25ebfe6 authored by Stan Hu's avatar Stan Hu
Browse files

Lazily load Bitbucket connection

parent 2a52f221b97a
......@@ -13,13 +13,18 @@ def initialize(options = {})
@expires_at = options.fetch(:expires_at)
@expires_in = options.fetch(:expires_in)
@refresh_token = options.fetch(:refresh_token)
@client =, provider.app_secret, options)
@connection =, @token, refresh_token: @refresh_token, expires_at: @expires_at, expires_in: @expires_in)
def client
@client ||=, provider.app_secret, options)
def connection
@connection ||=, @token, refresh_token: @refresh_token, expires_at: @expires_at, expires_in: @expires_in)
def query(params = {})
def get(path, query = {})
......@@ -46,7 +51,7 @@ def refresh!
attr_reader :connection, :expires_at, :expires_in, :refresh_token, :token
attr_reader :expires_at, :expires_in, :refresh_token, :token
def build_url(path)
return path if path.starts_with?(root_url)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment