Module: Ipfs::Command

Defined in:
lib/ruby-ipfs-http-client/api/command.rb,
lib/ruby-ipfs-http-client/api/files/ls.rb,
lib/ruby-ipfs-http-client/api/files/add.rb,
lib/ruby-ipfs-http-client/api/files/cat.rb,
lib/ruby-ipfs-http-client/api/generic/id.rb,
lib/ruby-ipfs-http-client/api/generic/version.rb

Defined Under Namespace

Classes: Add, Cat, Id, Ls, Version

Class Method Summary collapse

Class Method Details

.build_request(path, **arguments) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ruby-ipfs-http-client/api/command.rb', line 14

def self.build_request(path, **arguments)
  keys = arguments.keys

  if keys.include?(:multihash)
    BasicRequest.new(path, multihash: arguments[:multihash])
  elsif keys.include?(:filepath)
    FileUploadRequest.new(path, arguments[:filepath])
  else
    BasicRequest.new(path)
  end
end