7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/mstdn_ivory/request.rb', line 7
def request(method, path, options)
request_url = self.base_url + path
http_client = HTTP.timeout(:per_operation, connect: self.timeout[:connect], read: self.timeout[:read], write: self.timeout[:write])
res = http_client.(self.).public_send(method, request_url, {form: options})
json_data = Oj.load(res)
case json_data
when Array
json_data.map { |elm| MstdnIvory::DotAccessableHash.new.merge(elm) }
when Hash
MstdnIvory::DotAccessableHash.new.merge(json_data)
end
end
|