class Status::Request

Attributes

conn[R]

Public Class Methods

new(type=:github) click to toggle source
# File lib/status/request.rb, line 37
def initialize(type=:github)
  @klass = {:github => GithubRequest, :ci => CiRequest}[type]
  @klass = @klass.new
  @site = RestClient::Resource.new(@klass.url, @klass.options, :headers => { :accept => :json, :content_type => :json })
end

Public Instance Methods

get(path) click to toggle source
# File lib/status/request.rb, line 43
def get(path)
  begin
    MultiJson.decode @site[path].get
  rescue Exception => e
    raise NotFoundException.new(@klass, e)
  end
end
post(path, data) click to toggle source
# File lib/status/request.rb, line 51
def post(path, data)
  begin
    MultiJson.decode @site[path].post(MultiJson.encode(data))
  rescue Exception => e
    raise NotFoundException.new(@klass, e)
  end
end