summaryrefslogtreecommitdiff
path: root/lib/gitlab_access_status.rb
blob: 14ec1efab257934b2a80f0fb7ef7c38eb0f6000b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'json'

class GitAccessStatus
  attr_accessor :status, :message
  alias_method :allowed?, :status

  def initialize(status, message = '')
    @status = status
    @message = message
  end

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

  def to_json
    { status: @status, message: @message }.to_json
  end
end