Sha256: fb7e296a138d3d692111d773414b69e9d81d30270d61ada13f635c71a265201d
Contents?: true
Size: 612 Bytes
Versions: 1
Compression:
Stored size: 612 Bytes
Contents
# typed: strict require "net/http" require "sorbet-runtime" require "sorbet-http" require "sorbet-result" require_relative "venture/response" # Sorbet-aware HTTP Client module Venture extend T::Sig include Typed sig { params(url: String).returns(Result[Response, Response]) } 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
venture-0.0.1 | lib/venture.rb |