Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
b25ebfe6
Commit
b25ebfe6
authored
Nov 11, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lazily load Bitbucket connection
parent
98604883
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
lib/bitbucket/connection.rb
lib/bitbucket/connection.rb
+9
-4
No files found.
lib/bitbucket/connection.rb
View file @
b25ebfe6
...
...
@@ -13,13 +13,18 @@ module Bitbucket
@expires_at
=
options
.
fetch
(
:expires_at
)
@expires_in
=
options
.
fetch
(
:expires_in
)
@refresh_token
=
options
.
fetch
(
:refresh_token
)
end
@client
=
OAuth2
::
Client
.
new
(
provider
.
app_id
,
provider
.
app_secret
,
options
)
@connection
=
OAuth2
::
AccessToken
.
new
(
@client
,
@token
,
refresh_token:
@refresh_token
,
expires_at:
@expires_at
,
expires_in:
@expires_in
)
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
query
(
params
=
{})
@query
.
update
(
params
)
@query
.
merge!
(
params
)
end
def
get
(
path
,
query
=
{})
...
...
@@ -46,7 +51,7 @@ module Bitbucket
private
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment