Sha256: 19fd1ebec3cf1527cf80cb401459870c965da468a8f6f7b9c12181fa309d5f9c
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
class Entry attr_reader :number attr_reader :link attr_reader :voting attr_reader :user def initialize(number, link, voting, user, comments, time) @number = number @link = link @voting = voting @user = user @time = time @comments_info = comments end def comments unless @comments @comments = CommentService.new.get_comments(@comments_info.page) end return @comments end def self.all(pages = 1) return EntryService.new.get_entries(pages) end def self.newest(pages = 1) return EntryService.new.get_new_entries(pages) end def self.questions(pages = 1) return EntryService.new.get_questions(pages) end def self.jobs(pages = 1) return EntryService.new.get_jobs(pages) end def time return @time.time end def write_comment(text) return CommentService.new.write_comment(@comments_info.page, text) end def self.submit(*args) return EntryService.new.submit(*args) end def upvote return VotingService.new.vote(@voting.upvote) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-hackernews-1.0.1 | lib/ruby-hackernews/domain/entry/entry.rb |
ruby-hackernews-1.0.0 | lib/HNAPI/domain/entry/entry.rb |