class IPFS::Commands::Add
Public Class Methods
call(client, file)
click to toggle source
# File lib/ipfs/commands/add.rb, line 9 def self.call(client, file) parse query(client, file) end
Private Class Methods
multiform(file)
click to toggle source
# File lib/ipfs/commands/add.rb, line 22 def self.multiform(file) HTTP::FormData.create(file: HTTP::FormData::File.new(file)) end
parse(response)
click to toggle source
# File lib/ipfs/commands/add.rb, line 26 def self.parse(response) Content::Link.parse_single JSON.parse(response) end
query(client, file)
click to toggle source
# File lib/ipfs/commands/add.rb, line 15 def self.query(client, file) form = multiform(file) HTTP.get("#{client.api_url}/add?stream-channels=true", body: form.to_s, headers: { 'Content-Type' => form.content_type }).to_s end