diff options
author | Valery Sizov <vsv2711@gmail.com> | 2014-11-14 13:46:51 +0200 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2014-11-14 13:46:51 +0200 |
commit | 80f5af48e2c66c3f61218f9c7e85f74c634ea8df (patch) | |
tree | 743748dd5efa7651e06b131ca65a190f4f9f9d46 /lib/gitlab_access_status.rb | |
parent | dbdcc5f400df466944ad5e55e8e03dee55de865f (diff) | |
download | gitlab-shell-80f5af48e2c66c3f61218f9c7e85f74c634ea8df.tar.gz |
Show error message when git access is rejected
Diffstat (limited to 'lib/gitlab_access_status.rb')
-rw-r--r-- | lib/gitlab_access_status.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/gitlab_access_status.rb b/lib/gitlab_access_status.rb new file mode 100644 index 0000000..597fcbb --- /dev/null +++ b/lib/gitlab_access_status.rb @@ -0,0 +1,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
\ No newline at end of file |