Module: ExceptionResource

Defined in:
lib/exception_resource.rb,
lib/exception_resource/version.rb

Constant Summary collapse

VERSION =
"0.1.4"

Class Method Summary collapse

Class Method Details

.create(exception) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/exception_resource.rb', line 15

def self.create(exception)
  url = Addressable::URI.parse(site)
  return false unless url

  url.path = "/" if url.path.empty?
  url.path += "exceptions"

  response = nil
  Net::HTTP.start(url.host, url.port) do |request|
    response = request.post(url.request_uri, to_query(exception))
  end
  response.code == "201"
end

.create!(exception) ⇒ Object



29
30
31
32
# File 'lib/exception_resource.rb', line 29

def self.create!(exception)
  create(exception)
  raise exception
end

.siteObject



11
12
13
# File 'lib/exception_resource.rb', line 11

def self.site
  @site
end

.site=(value) ⇒ Object



7
8
9
# File 'lib/exception_resource.rb', line 7

def self.site=(value)
  @site = value
end