Class: Ipfs::Commands::Base
- Inherits:
-
Object
- Object
- Ipfs::Commands::Base
show all
- Defined in:
- lib/ipfs-http-client-rb/commands/base.rb
Class Method Summary
collapse
Class Method Details
.parse(str) ⇒ Object
22
23
24
|
# File 'lib/ipfs-http-client-rb/commands/base.rb', line 22
def self.parse(str)
JSON.parse(str)
end
|
.request(client, path_with_query, args = nil) ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/ipfs-http-client-rb/commands/base.rb', line 12
def self.request(client, path_with_query, args = nil)
url = "#{client.base_url}#{path_with_query}"
response = HTTP.post(*[url, args].compact)
if response.code >= 200 && response.code <= 299
response
else
raise Error, response.body
end
end
|