Class: Ayadn::Check
Instance Method Summary collapse
- #already_reposted(resp) ⇒ Object
- #already_starred(resp) ⇒ Object
- #auto_save_followers(list) ⇒ Object
- #auto_save_followings(list) ⇒ Object
- #auto_save_muted(list) ⇒ Object
- #bad_post_id(post_id) ⇒ Object
- #bad_post_ids(post_ids) ⇒ Object
- #has_been_blocked(username, resp) ⇒ Object
- #has_been_deleted(post_id, resp) ⇒ Object
- #has_been_followed(username, resp) ⇒ Object
- #has_been_muted(username, resp) ⇒ Object
- #has_been_reposted(post_id, resp) ⇒ Object
- #has_been_starred(post_id, resp) ⇒ Object
- #has_been_unblocked(username, resp) ⇒ Object
- #has_been_unfollowed(username, resp) ⇒ Object
- #has_been_unmuted(username, resp) ⇒ Object
- #has_been_unreposted(post_id, resp) ⇒ Object
- #has_been_unstarred(post_id, resp) ⇒ Object
-
#initialize(status = Status.new) ⇒ Check
constructor
A new instance of Check.
- #message_has_been_deleted(message_id, resp) ⇒ Object
- #no_data(stream, target) ⇒ Object
- #no_details(stream, post_id) ⇒ Object
- #no_new_posts(stream, options, title) ⇒ Object
- #no_post(stream, post_id) ⇒ Object
- #no_user(stream, username) ⇒ Object
- #no_username(username) ⇒ Object
- #same_username(user_object) ⇒ Object
Constructor Details
Instance Method Details
#already_reposted(resp) ⇒ Object
113 114 115 116 117 118 |
# 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) ⇒ Object
106 107 108 109 110 111 |
# 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) ⇒ Object
18 19 20 |
# File 'lib/ayadn/check.rb', line 18 def auto_save_followers(list) FileOps.save_followers_list(list) if Settings..backup.lists end |
#auto_save_followings(list) ⇒ Object
22 23 24 |
# File 'lib/ayadn/check.rb', line 22 def auto_save_followings(list) FileOps.save_followings_list(list) if Settings..backup.lists end |
#auto_save_muted(list) ⇒ Object
14 15 16 |
# File 'lib/ayadn/check.rb', line 14 def auto_save_muted(list) FileOps.save_muted_list(list) if Settings..backup.lists end |
#bad_post_id(post_id) ⇒ Object
66 67 68 69 70 71 |
# 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) ⇒ Object
73 74 75 76 77 78 79 80 |
# 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) ⇒ Object
136 137 138 139 140 141 142 |
# 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) ⇒ Object
160 161 162 163 164 165 166 |
# 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) ⇒ Object
152 153 154 155 156 157 158 |
# 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) ⇒ Object
144 145 146 147 148 149 150 |
# 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) ⇒ Object
128 129 130 131 132 133 134 |
# 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) ⇒ Object
120 121 122 123 124 125 126 |
# 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) ⇒ Object
176 177 178 179 180 181 182 |
# 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) ⇒ Object
90 91 92 93 94 95 96 |
# 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) ⇒ Object
98 99 100 101 102 103 104 |
# 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) ⇒ Object
192 193 194 195 196 197 198 |
# 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) ⇒ Object
184 185 186 187 188 189 190 |
# 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) ⇒ Object
168 169 170 171 172 173 174 |
# File 'lib/ayadn/check.rb', line 168 def (, resp) if resp['meta']['code'] == 200 @status.deleted_m() else @status.not_deleted_m() end end |
#no_data(stream, target) ⇒ Object
33 34 35 36 37 38 39 |
# 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) ⇒ Object
58 59 60 61 62 63 64 |
# 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) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/ayadn/check.rb', line 41 def no_new_posts stream, , title if [:new] unless Databases.has_new?(stream, title) @status.no_new_posts exit end end end |
#no_post(stream, post_id) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/ayadn/check.rb', line 50 def no_post stream, post_id if stream..code == 404 @status.post_404(post_id) Errors.info("Impossible to find #{post_id}") exit end end |
#no_user(stream, username) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/ayadn/check.rb', line 82 def no_user stream, username if stream..code == 404 @status.user_404(username) Errors.info("User #{username} doesn't exist") exit end end |
#no_username(username) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/ayadn/check.rb', line 26 def no_username username if username.empty? @status.error_missing_username exit end end |