class PostmonRuby::Http
Public Class Methods
get(uri)
click to toggle source
# File lib/postmon_ruby/http/http.rb, line 4 def self.get(uri) instance = PostmonRuby::Http.new instance.instance_variable_set("@response", Net::HTTP.get_response(uri)) instance end
Public Instance Methods
[](key)
click to toggle source
# File lib/postmon_ruby/http/http.rb, line 10 def [](key) @json = json unless @json @json[key] end
not_found?()
click to toggle source
# File lib/postmon_ruby/http/http.rb, line 15 def not_found? @response.is_a?(Net::HTTPNotFound) end
Private Instance Methods
json()
click to toggle source
# File lib/postmon_ruby/http/http.rb, line 21 def json return {} if not_found? JSON.parse(@response.body) end