Class: Ipfs::DagStream

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ DagStream

Returns a new instance of DagStream.



7
8
9
10
11
12
13
# File 'lib/ruby-ipfs-http-client/dagstream.rb', line 7

def initialize(response)
  if response.status.code == 200
    @content = response.body.to_s
  else
    raise Error::InvalidDagStream, JSON.parse(response.body)['Message']
  end
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



5
6
7
# File 'lib/ruby-ipfs-http-client/dagstream.rb', line 5

def content
  @content
end

Instance Method Details

#to_sObject Also known as: to_str



15
16
17
# File 'lib/ruby-ipfs-http-client/dagstream.rb', line 15

def to_s
  @content
end