summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2016-09-06 16:13:04 -0500
committerPatricio Cano <suprnova32@gmail.com>2016-09-06 16:27:07 -0500
commita070ae4a320f8da830862e1dd11eea8b1281ab8c (patch)
treeac2083c8cc3263de7cbebe77677838514d82392a /lib
parentf53d09e1eb1323be9cd697813a6f47375c091f6a (diff)
downloadgitlab-shell-a070ae4a320f8da830862e1dd11eea8b1281ab8c.tar.gz
Style fixes and better tests.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab_lfs_authentication.rb4
-rw-r--r--lib/gitlab_shell.rb2
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/gitlab_lfs_authentication.rb b/lib/gitlab_lfs_authentication.rb
index 4b36229..196cdd7 100644
--- a/lib/gitlab_lfs_authentication.rb
+++ b/lib/gitlab_lfs_authentication.rb
@@ -11,11 +11,11 @@ class GitlabLfsAuthentication
end
def self.build_from_json(json)
- values = JSON.parse(json)
+ values = JSON.parse(json) rescue nil
self.new(values['username'], values['lfs_token'], values['repository_http_path'])
end
- def authenticate!
+ def authentication_payload
authorization = {
header: {
Authorization: "Basic #{Base64.strict_encode64("#{username}:#{lfs_token}")}"
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index d3f9bbe..971b22f 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -194,7 +194,7 @@ class GitlabShell
return unless lfs_access
- puts lfs_access.authenticate!
+ puts lfs_access.authentication_payload
end
private