Class: PostmonRuby::Http

Inherits:
Object
  • Object
show all
Defined in:
lib/postmon_ruby/http/http.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get(uri) ⇒ Object



4
5
6
7
8
# 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

Instance Method Details

#[](key) ⇒ Object



10
11
12
13
# File 'lib/postmon_ruby/http/http.rb', line 10

def [](key)
  @json = json unless @json 
  @json[key]
end

#not_found?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/postmon_ruby/http/http.rb', line 15

def not_found?
  @response.is_a?(Net::HTTPNotFound)
end