Class: DoingStream::Stream::JSONStream

Inherits:
Stream
  • Object
show all
Defined in:
lib/doing_stream/stream/json_stream.rb

Instance Attribute Summary

Attributes inherited from Stream

#user

Instance Method Summary collapse

Methods inherited from Stream

#entry_class, #initialize, #name, #uri

Constructor Details

This class inherits a constructor from DoingStream::Stream::Stream

Instance Method Details

#bodyObject



6
7
8
# File 'lib/doing_stream/stream/json_stream.rb', line 6

def body
  @body ||= Curl::Easy.perform(uri.to_s).body_str
end

#entriesObject



14
15
16
17
18
# File 'lib/doing_stream/stream/json_stream.rb', line 14

def entries
  @entries ||= json.map do |entry|
    entry_class.new(name, entry)
  end
end

#jsonObject



10
11
12
# File 'lib/doing_stream/stream/json_stream.rb', line 10

def json
  JSON.parse body
end