summaryrefslogtreecommitdiff
path: root/lib/git_access_status.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/git_access_status.rb')
-rw-r--r--lib/git_access_status.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/git_access_status.rb b/lib/git_access_status.rb
new file mode 100644
index 0000000..783bc0c
--- /dev/null
+++ b/lib/git_access_status.rb
@@ -0,0 +1,28 @@
+require 'json'
+
+class GitAccessStatus
+ attr_reader :message, :gl_repository, :gl_username, :repository_path, :gitaly
+
+ def initialize(status, message, gl_repository:, gl_username:, repository_path:, gitaly:)
+ @status = status
+ @message = message
+ @gl_repository = gl_repository
+ @gl_username = gl_username
+ @repository_path = repository_path
+ @gitaly = gitaly
+ end
+
+ def self.create_from_json(json)
+ values = JSON.parse(json)
+ new(values["status"],
+ values["message"],
+ gl_repository: values["gl_repository"],
+ gl_username: values["gl_username"],
+ repository_path: values["repository_path"],
+ gitaly: values["gitaly"])
+ end
+
+ def allowed?
+ @status
+ end
+end