Class: Ipfs::Commands::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ipfs-http-client/commands/base.rb

Direct Known Subclasses

Add, AddDir, Cat, CatToFile, Ls, PinRm

Class Method Summary collapse

Class Method Details

.http_get(client, path_with_query, args = nil) {|response| ... } ⇒ Object

Yields:

  • (response)


10
11
12
13
14
15
# File 'lib/ipfs-http-client/commands/base.rb', line 10

def self.http_get(client, path_with_query, args = nil)
  url = "#{client.base_url}#{path_with_query}"
  response = HTTP.get(*[url, args].compact)
  yield response if block_given?
  response
end

.parse(str) ⇒ Object



17
18
19
# File 'lib/ipfs-http-client/commands/base.rb', line 17

def self.parse(str)
  JSON.parse(str)
end