class Ayadn::Check
Public Class Methods
new(status = Status.new)
click to toggle source
# File lib/ayadn/check.rb, line 6 def initialize status = Status.new @status = status end
Public Instance Methods
already_reposted(resp)
click to toggle source
# File lib/ayadn/check.rb, line 113 def already_reposted(resp) if resp['data']['you_reposted'] @status.already_reposted exit end end
already_starred(resp)
click to toggle source
# File lib/ayadn/check.rb, line 106 def already_starred(resp) if resp['data']['you_starred'] @status.already_starred exit end end
auto_save_followers(list)
click to toggle source
# File lib/ayadn/check.rb, line 18 def auto_save_followers(list) FileOps.save_followers_list(list) if Settings.options.backup.lists end
auto_save_followings(list)
click to toggle source
# File lib/ayadn/check.rb, line 22 def auto_save_followings(list) FileOps.save_followings_list(list) if Settings.options.backup.lists end
auto_save_muted(list)
click to toggle source
# File lib/ayadn/check.rb, line 14 def auto_save_muted(list) FileOps.save_muted_list(list) if Settings.options.backup.lists end
bad_post_id(post_id)
click to toggle source
# File lib/ayadn/check.rb, line 66 def bad_post_id post_id unless post_id.is_integer? @status.error_missing_post_id exit end end
bad_post_ids(post_ids)
click to toggle source
# File lib/ayadn/check.rb, line 73 def bad_post_ids(post_ids) post_ids.each do |id| unless id.is_integer? @status.error_missing_post_id exit end end end
has_been_blocked(username, resp)
click to toggle source
# File lib/ayadn/check.rb, line 136 def has_been_blocked(username, resp) if resp['meta']['code'] == 200 @status.blocked(username) else @status.not_blocked(username) end end
has_been_deleted(post_id, resp)
click to toggle source
# File lib/ayadn/check.rb, line 160 def has_been_deleted(post_id, resp) if resp['meta']['code'] == 200 @status.deleted(post_id) else @status.not_deleted(post_id) end end
has_been_followed(username, resp)
click to toggle source
# File lib/ayadn/check.rb, line 152 def has_been_followed(username, resp) if resp['meta']['code'] == 200 @status.followed(username) else @status.not_followed(username) end end
has_been_muted(username, resp)
click to toggle source
# File lib/ayadn/check.rb, line 144 def has_been_muted(username, resp) if resp['meta']['code'] == 200 @status.muted(username) else @status.not_muted(username) end end
has_been_reposted(post_id, resp)
click to toggle source
# File lib/ayadn/check.rb, line 128 def has_been_reposted(post_id, resp) if resp['meta']['code'] == 200 @status.reposted(post_id) else @status.not_reposted(post_id) end end
has_been_starred(post_id, resp)
click to toggle source
# File lib/ayadn/check.rb, line 120 def has_been_starred(post_id, resp) if resp['meta']['code'] == 200 @status.starred(post_id) else @status.not_starred(post_id) end end
has_been_unblocked(username, resp)
click to toggle source
# File lib/ayadn/check.rb, line 176 def has_been_unblocked(username, resp) if resp['meta']['code'] == 200 @status.unblocked(username) else @status.not_unblocked(username) end end
has_been_unfollowed(username, resp)
click to toggle source
# File lib/ayadn/check.rb, line 90 def has_been_unfollowed(username, resp) if resp['meta']['code'] == 200 @status.unfollowed(username) else @status.not_unfollowed(username) end end
has_been_unmuted(username, resp)
click to toggle source
# File lib/ayadn/check.rb, line 98 def has_been_unmuted(username, resp) if resp['meta']['code'] == 200 @status.unmuted(username) else @status.not_unmuted(username) end end
has_been_unreposted(post_id, resp)
click to toggle source
# File lib/ayadn/check.rb, line 192 def has_been_unreposted(post_id, resp) if resp['meta']['code'] == 200 @status.unreposted(post_id) else @status.not_unreposted(post_id) end end
has_been_unstarred(post_id, resp)
click to toggle source
# File lib/ayadn/check.rb, line 184 def has_been_unstarred(post_id, resp) if resp['meta']['code'] == 200 @status.unstarred(post_id) else @status.not_unstarred(post_id) end end
message_has_been_deleted(message_id, resp)
click to toggle source
# File lib/ayadn/check.rb, line 168 def message_has_been_deleted(message_id, resp) if resp['meta']['code'] == 200 @status.deleted_m(message_id) else @status.not_deleted_m(message_id) end end
no_data(stream, target)
click to toggle source
# File lib/ayadn/check.rb, line 33 def no_data stream, target if stream.posts.empty? Errors.warn "In action/#{target}: no data" @status.empty_list exit end end
no_details(stream, post_id)
click to toggle source
# File lib/ayadn/check.rb, line 58 def no_details stream, post_id if stream["meta"]["code"] == 404 @status.post_404(post_id) Errors.info("Impossible to find #{post_id}") exit end end
no_new_posts(stream, options, title)
click to toggle source
# File lib/ayadn/check.rb, line 41 def no_new_posts stream, options, title if options[:new] unless Databases.has_new?(stream, title) @status.no_new_posts exit end end end
no_post(stream, post_id)
click to toggle source
# File lib/ayadn/check.rb, line 50 def no_post stream, post_id if stream.meta.code == 404 @status.post_404(post_id) Errors.info("Impossible to find #{post_id}") exit end end
no_user(stream, username)
click to toggle source
# File lib/ayadn/check.rb, line 82 def no_user stream, username if stream.meta.code == 404 @status.user_404(username) Errors.info("User #{username} doesn't exist") exit end end
no_username(username)
click to toggle source
# File lib/ayadn/check.rb, line 26 def no_username username if username.empty? @status.error_missing_username exit end end
same_username(user_object)
click to toggle source
# File lib/ayadn/check.rb, line 10 def same_username(user_object) user_object.username == Settings.config.identity.username end