Module: DolphinKit::HTTP

Defined in:
lib/dolphin_kit/helpers/http.rb

Class Method Summary collapse

Class Method Details

.get(url, params: {}) ⇒ Object



7
8
9
10
11
# File 'lib/dolphin_kit/helpers/http.rb', line 7

def get(url, params: {})
  uri = URI(url)
  uri.query = URI.encode_www_form(params) unless params.empty?
  Net::HTTP.get_response(uri)
end

.post(url, form: {}) ⇒ Object



13
14
15
16
# File 'lib/dolphin_kit/helpers/http.rb', line 13

def post(url, form: {})
  uri = URI(url)
  Net::HTTP.post_form(uri, **form)
end