From 80f5af48e2c66c3f61218f9c7e85f74c634ea8df Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Fri, 14 Nov 2014 13:46:51 +0200 Subject: Show error message when git access is rejected --- lib/gitlab_access_status.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/gitlab_access_status.rb (limited to 'lib/gitlab_access_status.rb') 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 -- cgit v1.2.1