Method: Ayadn::Stream#posts

Defined in:
lib/ayadn/stream.rb

#posts(username, options) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/ayadn/stream.rb', line 86

def posts username, options
  @check.no_username(username)
  username = @workers.add_arobase(username)
  @view.downloading(options)
  stream = @api.get_posts(username, options)
  stream_object = StreamObject.new(stream)
  @check.no_user(stream_object, username)
  Databases.save_max_id(stream_object) unless stream_object.meta.marker.nil?
  @check.no_data(stream_object, 'mentions')
  unless options[:raw] || Settings.global.force
    # this is just to show a message rather than an empty screen
    if Settings.options.blacklist.active
      if Databases.is_in_blacklist?('mention', username)
        @status.no_force("#{username.downcase}")
        exit
      end
    end
  end
  if stream_object.posts[0].user.you_muted || stream_object.posts[0].user.you_blocked
    unless options[:raw] || Settings.global.force
      @status.no_force("#{username.downcase}")
      exit
    end
  end
  @view.render(stream_object, options)
  Scroll.new(@api, @view).posts(username, options) if options[:scroll]
  puts "\n" if Settings.options.timeline.compact && options[:raw].nil?
end