Class: Slkecho::HTTP

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

Class Method Summary collapse

Class Method Details

.get(uri, headers: nil) ⇒ Object



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

def get(uri, headers: nil)
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = uri.scheme == "https"
  http.get(uri, headers)
end

.post(uri, headers: nil, body: nil) ⇒ Object



15
16
17
18
19
# File 'lib/slkecho/http.rb', line 15

def post(uri, headers: nil, body: nil)
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = uri.scheme == "https"
  http.post(uri, body, headers)
end