class RequestVia::Client
Constants
- BuildAddress
- BuildURL
- OptionsBuilder
Attributes
address[R]
net_http[R]
Public Class Methods
call(address, port: nil, open_timeout: nil, read_timeout: nil)
click to toggle source
# File lib/request_via/client.rb, line 27 def self.call(address, port: nil, open_timeout: nil, read_timeout: nil) self.new(address, port, open_timeout, read_timeout) end
new(address, port, open_timeout, read_timeout)
click to toggle source
# File lib/request_via/client.rb, line 31 def initialize(address, port, open_timeout, read_timeout) uri = Freeze.(Func::ParseURI.(address)) @address = BuildAddress.(uri, address) @build_url = BuildURL.(@address) @net_http = NetHTTP.(uri, port, open_timeout, read_timeout) @options = OptionsBuilder.(@net_http) end
Public Instance Methods
delete(path = '/', **options)
click to toggle source
# File lib/request_via/client.rb, line 56 def delete(path = '/', **options) fetch(RequestVia::Delete, path, options) end
get(path = '/', **options)
click to toggle source
# File lib/request_via/client.rb, line 40 def get(path = '/', **options) fetch(RequestVia::Get, path, options) end
head(path = '/', **options)
click to toggle source
# File lib/request_via/client.rb, line 44 def head(path = '/', **options) fetch(RequestVia::Head, path, options) end
options(path = '/', **options)
click to toggle source
# File lib/request_via/client.rb, line 60 def options(path = '/', **options) fetch(RequestVia::Options, path, options) end
patch(path = '/', **options)
click to toggle source
# File lib/request_via/client.rb, line 68 def patch(path = '/', **options) fetch(RequestVia::Patch, path, options) end
post(path = '/', **options)
click to toggle source
# File lib/request_via/client.rb, line 48 def post(path = '/', **options) fetch(RequestVia::Post, path, options) end
put(path = '/', **options)
click to toggle source
# File lib/request_via/client.rb, line 52 def put(path = '/', **options) fetch(RequestVia::Put, path, options) end
trace(path = '/', **options)
click to toggle source
# File lib/request_via/client.rb, line 64 def trace(path = '/', **options) fetch(RequestVia::Trace, path, options) end
Private Instance Methods
fetch(http_method, path, keyword_args)
click to toggle source
# File lib/request_via/client.rb, line 74 def fetch(http_method, path, keyword_args) http_method.(@build_url.(path), **@options.(keyword_args)) end