Module: KisHttp
- Defined in:
- lib/kis_http.rb,
lib/kis_http/headers.rb,
lib/kis_http/options.rb,
lib/kis_http/version.rb
Overview
Defined Under Namespace
Classes: Error, Headers, Options
Constant Summary
collapse
- VERSION =
'0.1.1'.freeze
Class Method Summary
collapse
Class Method Details
.get(url, **kwargs) ⇒ Object
11
12
13
14
15
|
# File 'lib/kis_http.rb', line 11
def get(url, **kwargs)
request(url, **kwargs) do |uri|
Net::HTTP::Get.new(uri)
end
end
|
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/kis_http/headers.rb', line 72
def self.(obj)
if obj.is_a? KisHttp::
obj
elsif obj.is_a? Hash
KisHttp::.new(**obj)
elsif obj.is_a? Array
KisHttp::.new(**obj.to_h)
else
raise 'Invalid object type for Headers!'
end
end
|
.Options(obj) ⇒ Object
137
138
139
140
141
142
143
144
145
146
147
|
# File 'lib/kis_http/options.rb', line 137
def self.Options(obj)
if obj.is_a? KisHttp::Options
obj
elsif obj.is_a? Hash
KisHttp::Options.new(**obj)
elsif obj.is_a? Array
KisHttp::Options.new(**obj.to_h)
else
raise 'Invalid object type for Options!'
end
end
|
.post(url, **kwargs) ⇒ Object
17
18
19
20
21
|
# File 'lib/kis_http.rb', line 17
def post(url, **kwargs)
request(url, **kwargs) do |uri|
Net::HTTP::Post.new(uri)
end
end
|
.put(url, **kwargs) ⇒ Object
23
24
25
26
27
|
# File 'lib/kis_http.rb', line 23
def put(url, **kwargs)
request(url, **kwargs) do |uri|
Net::HTTP::Put.new(uri)
end
end
|