Class: DoingStream::Streams::Vimeo

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

Defined Under Namespace

Classes: Likes, Videos

Instance Attribute Summary

Attributes inherited from DoingStream::Stream::Stream

#user

Instance Method Summary collapse

Methods inherited from DoingStream::Stream::Stream

#entry_class, #name, #uri

Constructor Details

#initialize(user) ⇒ Vimeo

Returns a new instance of Vimeo.



3
4
5
6
# File 'lib/doing_stream/streams/vimeo.rb', line 3

def initialize user
  @likes = Likes.new user
  @videos = Videos.new user
end

Instance Method Details

#entriesObject



8
9
10
11
12
13
14
15
16
# File 'lib/doing_stream/streams/vimeo.rb', line 8

def entries
  @entries ||= begin
                 (@likes.entries + @videos.entries).sort_by(&:published).reverse.each do |entry|
                   class << entry; alias_method :type, :name; end
                   entry.define_singleton_method(:name) { "vimeo" }
                   def entry.to_h; super.tap { |h| h['data']['type'] = type }; end
                 end
               end
end