Module: Venture

Extended by:
T::Sig
Includes:
Typed
Defined in:
lib/venture.rb,
lib/venture/response.rb

Overview

typed: strict

Defined Under Namespace

Classes: Response

Class Method Summary collapse

Class Method Details

.get(url) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/venture.rb', line 18

def self.get(url)
  response = Net::HTTP.get_response(URI(url))
  status_code = response.code.to_i

  if status_code < 400
    Success.new(Response.new(status_code: HTTP::StatusCode.from_i(status_code)))
  else
    Failure.new(Response.new(status_code: HTTP::StatusCode.from_i(status_code)))
  end
end