summaryrefslogtreecommitdiff
path: root/lib/gitlab_access_status.rb
blob: 494349deff4d13f1a39d8d63cecd521654e20a7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require 'json'

class GitAccessStatus
  attr_reader :message, :gl_repository, :repository_path, :gitaly, :geo_node

  def initialize(status, message, gl_repository, repository_path, gitaly, geo_node)
    @status = status
    @message = message
    @gl_repository = gl_repository
    @repository_path = repository_path
    @gitaly = gitaly
    @geo_node = geo_node
  end

  def self.create_from_json(json)
    values = JSON.parse(json)
    self.new(values["status"],
             values["message"],
             values["gl_repository"],
             values["repository_path"],
             values["gitaly"],
             values["geo_node"])
  end

  def allowed?
    @status
  end
end