Class: DoingStream::Streams::StackOverflow

Inherits:
DoingStream::Stream::JSONStream show all
Defined in:
lib/doing_stream/streams/stack_overflow.rb

Defined Under Namespace

Classes: Entry

Constant Summary collapse

URI =
'https://api.stackexchange.com/2.0/users/<%= user %>/timeline?site=stackoverflow&pagesize=100'

Instance Attribute Summary

Attributes inherited from DoingStream::Stream::Stream

#user

Instance Method Summary collapse

Methods inherited from DoingStream::Stream::Stream

#entry_class, #initialize, #name, #uri

Constructor Details

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

Instance Method Details

#bodyObject



8
9
10
# File 'lib/doing_stream/streams/stack_overflow.rb', line 8

def body
  @body ||= Zlib::GzipReader.new(open(uri.to_s)).read
end

#entriesObject



16
17
18
# File 'lib/doing_stream/streams/stack_overflow.rb', line 16

def entries
  @entries ||= super.select { |entry| %w[answered asked badge].include? entry.data['timeline_type'] }
end

#jsonObject



12
13
14
# File 'lib/doing_stream/streams/stack_overflow.rb', line 12

def json
  super['items']
end