lib/ayadn/status.rb in ayadn-0.6.4 vs lib/ayadn/status.rb in ayadn-1.0.0

- old
+ new

@@ -1,166 +1,227 @@ -#!/usr/bin/env ruby # encoding: utf-8 -class AyaDN - class ClientStatus - def canceled - "\nCanceled.\n\n".red - end - def showList(list, name) - if list == "muted" - "Your list of muted users:\n".green - elsif list == "followings" - "List of users ".green + "#{name} ".brown + "is following:\n".green - elsif list == "followers" - "List of ".green + "#{name}".brown + "'s followers:\n".green - end - end - def getInteractions - "\nLoading the ".green + "interactions ".brown + "informations.\n".green - end - def launchAuthorization(os) - if os == "osx" - "\nAyaDN opened a browser to authorize via App.net very easily. Just login with your App.net account, then copy the code it will give you, paste it here then press [ENTER].".pink + " Paste authorization code: \n\n".brown - else - s = "\nPlease open a browser and paste this URL: \n\n".brown - s += "https://account.app.net/oauth/authenticate?client_id=hFsCGArAjgJkYBHTHbZnUvzTmL4vaLHL&response_type=token&redirect_uri=http://aya.io/ayadn/auth.html&scope=basic stream write_post follow public_messages messages&include_marker=1" - s += "\n\nOn this page, login with your App.net account, then copy the code it will give you, paste it here then press [ENTER].".pink + " Paste authorization code: \n\n".brown - end - end - def authorized - "\nThank you for authorizing AyaDN. You won't need to do this anymore.\n\n".green - end - def noNewPosts - "\nNo new posts since your last visit.\n\n".red - end - def errorEmptyList - "\nThe list is empty.\n\n".red - end - def errorSyntax - "\nSyntax error.\n\n".red - end - def errorNotAuthorized - "\nYou haven't authorized AyaDN yet.\n\n".red - end - def errorNobodyReposted - "\nThis post hasn't been reposted by anyone.\n\n".red - end - def errorNobodyStarred - "\nThis post hasn't been starred by anyone.\n\n".red - end - def errorNoID - "\nError -> you must give a post ID to reply to.\n\n".red - end - def emptyPost - "\nError -> there was no text to post.\n\n".red - end - def errorInfos(arg) - "\nError -> ".red + "#{arg}".brown + " isn't a @username or a Post ID\n\n".red - end - def errorUserID(arg) - "\nError -> ".red + "#{arg}".brown + " is not a @username\n\n".red - end - def errorPostID(arg) - "\nError -> ".red + "#{arg}".brown + " is not a Post ID\n\n".red - end - def errorMessageNotSent - "\n\nCanceled. Your message hasn't been sent.\n\n".red - end - def errorMessageTooLong(realLength, to_remove) - "\nError: your message is ".red + "#{realLength} ".brown + "characters long, please remove ".red + "#{to_remove} ".brown + "characters.\n\n".red - end - def errorPostTooLong(realLength, to_remove) - "\nError: your post is ".red + "#{realLength} ".brown + " characters long, please remove ".red + "#{to_remove} ".brown + "characters.\n\n".red - end - def errorPostNotSent - "\n\nCanceled. Your post hasn't been sent.\n\n".red - end - def errorIsRepost(postID) - "\n#{postID} ".brown + " is a repost.\n".red - end - def errorAlreadyDeleted - "\nPost already deleted.\n\n".red - end - def redirectingToOriginal(postID) - "Redirecting to the original post: ".cyan + "#{postID}\n".brown - end - def fetchingList(list) - "\nFetching the \'#{list}\' list. Please wait\n".green - end - def getUnified - "\nLoading the ".green + "unified ".brown + "Stream".green - end - def getExplore(explore) - "\nLoading the ".green + "#{explore}".brown + " Stream".green - end - def getGlobal - "\nLoading the ".green + "global ".brown + "Stream".green - end - def whoReposted(arg) - s = "\nLoading informations on post ".green + "#{arg}".brown + "\n " - s += "\nReposted by: \n".cyan - end - def whoStarred(arg) - s = "\nLoading informations on post ".green + "#{arg}".brown + "\n" - s += "\nStarred by: \n".cyan - end - def infosUser(arg) - "\nLoading informations on ".green + "#{arg}".brown + "\n" - end - def infosPost(arg) - "\nLoading informations on post ".green + "#{arg}".brown + "\n" - end - def postsUser(arg) - "\nLoading posts of ".green + "#{arg}".brown + "\n" - end - def mentionsUser(arg) - "\nLoading posts mentionning ".green + "#{arg}".brown + "\n" - end - def starsUser(arg) - "\nLoading ".green + "#{arg}".reddish + "'s favorite posts\n".green - end - def starsPost(arg) - "\nLoading users who starred post ".green + "#{arg}".reddish + "\n" - end - def getHashtags(arg) - "\nLoading posts containing ".green + "##{arg}".pink + "\n".green - end - def sendPost - "\nSending post\n".green - end - def sendMessage - "\nSending private Message\n".green - end - def postSent - "Successfully posted\n".green - end - def postDeleted - "\nPost successfully deleted\n".green - end - def replyingToPost(postID) - "\nReplying to post ".cyan + "#{postID}\n".brown - end - def deletePost(postID) - "\nDeleting post ".green + "#{postID}".brown + "\n" - end - def getPostReplies(arg) - "\nLoading the conversation around post ".green + "#{arg}".brown + "\n" - end - def writePost - s = "\n#{$tools.ayadn_configuration[:post_max_length]} characters max, validate with [Enter] or cancel with [CTRL+C].\n".green - s += "\nType your text: ".cyan - end - def writeMessage - s = "\n#{$tools.ayadn_configuration[:message_max_length]} characters max, validate with [Enter] or cancel with [CTRL+C].\n".green - s += "\nType your text: ".cyan + "\n\n" - end - def writeReply(arg) - "\nLoading informations of post " + "#{arg}".brown + "\n" - end - def savingFile(name, path, file) - "\nSaving ".green + "#{name} ".brown + "in ".green + "#{path}#{file}".magenta - end - def stopped - "\n\nStopped.\n\n".red - end +module Ayadn + class Status + def self.done + "\nDone.\n".color(:green) end -end \ No newline at end of file + def self.downloaded(name) + "\nFile downloaded in #{Settings.config[:paths][:downloads]}/#{name}\n".color(:green) + end + def self.downloading + "Downloading from ADN...\n".inverse + end + def self.posting + "Posting to ADN...\n".inverse + end + def self.deleting_post(post_id) + "\nDeleting post #{post_id}\n".inverse + end + def self.unfollowing(username) + "\nUnfollowing #{username}\n".inverse + end + def self.following(username) + "\nFollowing #{username}\n".inverse + end + def self.unmuting(username) + "\nUnmuting #{username}\n".inverse + end + def self.muting(username) + "\nMuting #{username}\n".inverse + end + def self.unblocking(username) + "\nUnblocking #{username}\n".inverse + end + def self.blocking(username) + "\nBlocking #{username}\n".inverse + end + def self.unreposting(post_id) + "\nUnreposting #{post_id}\n".inverse + end + def self.reposting(post_id) + "\nReposting #{post_id}\n".inverse + end + def self.unstarring(post_id) + "\nUnstarring #{post_id}\n".inverse + end + def self.starring(post_id) + "\nStarring #{post_id}\n".inverse + end + def self.not_deleted(post_id) + "Could not delete post #{post_id} (post isn't yours, or is already deleted)\n".color(:red) + end + def self.not_starred(post_id) + "Could not star post #{post_id} (post doesn't exist, or is already starred)\n".color(:red) + end + def self.not_unreposted(post_id) + "Could not unrepost post #{post_id} (post isn't yours, isn't a repost, or has been deleted)\n".color(:red) + end + def self.not_reposted(post_id) + "Could not repost post #{post_id} (post has been deleted?)\n".color(:red) + end + def self.not_unstarred(post_id) + "Could not unstar post #{post_id} (post isn't yours, isn't starred, or has been deleted)\n".color(:red) + end + def self.not_unfollowed(post_id) + "Could not unfollow user #{username} (doesn't exist, or wasn't already followed)\n".color(:red) + end + def self.not_followed(post_id) + "Could not follow user #{username} (doesn't exist, or you already follow)\n".color(:red) + end + def self.not_unmuted(post_id) + "Could not unmute user #{username} (doesn't exist, or wasn't already muted)\n".color(:red) + end + def self.not_muted(post_id) + "Could not mute user #{username} (doesn't exist, or is already muted)\n".color(:red) + end + def self.not_unblocked(post_id) + "Could not unblock user #{username} (doesn't exist, or wasn't already blocked)\n".color(:red) + end + def self.not_blocked(post_id) + "Could not block user #{username} (doesn't exist, or is already blocked)\n".color(:red) + end + def self.deleted(post_id) + "\nPost #{post_id} has been deleted.\n".color(:green) + end + def self.starred(post_id) + "\nPost #{post_id} has been starred.\n".color(:green) + end + def self.unreposted(post_id) + "\nPost #{post_id} has been unreposted.\n".color(:green) + end + def self.reposted(post_id) + "\nPost #{post_id} has been reposted.\n".color(:green) + end + def self.unstarred(post_id) + "\nPost #{post_id} has been unstarred.\n".color(:green) + end + def self.unfollowed(username) + "\nUser #{username} has been unfollowed.\n".color(:green) + end + def self.followed(username) + "\nUser #{username} has been followed.\n".color(:green) + end + def self.unmuted(username) + "\nUser #{username} has been unmuted.\n".color(:green) + end + def self.muted(username) + "\nUser #{username} has been muted.\n".color(:green) + end + def self.unblocked(username) + "\nUser #{username} has been unblocked.\n".color(:green) + end + def self.blocked(username) + "\nUser #{username} has been blocked.\n".color(:green) + end + def self.error_missing_username + "\nYou have to specify a username.\n".color(:red) + end + def self.error_missing_post_id + "\nYou have to specify a post id.\n".color(:red) + end + def self.error_missing_channel_id + "\nYou have to specify a channel id.\n".color(:red) + end + def self.error_missing_hashtag + "\nYou have to specify one or more hashtag(s).\n".color(:red) + end + def self.error_missing_parameters + "\nYou have to submit valid items. See 'ayadn -sg' for a list of valid parameters and values.\n".color(:red) + end + def self.empty_list + "\n\nThe list is empty.\n\n".color(:red) + end + def self.not_found + "\n\n404 NOT FOUND - Object does not exist or has been deleted\n\n" + end + def self.stopped + "\n\nStopped.".color(:red) + end + def self.yourpost + "\nYour post:\n\n".color(:cyan) + end + def self.replying_to(post_id) + "\nReplying to post #{post_id}...\n".color(:green) + end + def self.readline + "\nType your text. ".color(:cyan) + "[CTRL+D] ".color(:green) + "to validate, ".color(:cyan) + "[CTRL+C] ".color(:red) + "to cancel.\n\n".color(:cyan) + end + def self.classic + "\nType your text. ".color(:cyan) + "[ENTER] ".color(:green) + "to validate, ".color(:cyan) + "[CTRL+C] ".color(:red) + "to cancel.\n\n".color(:cyan) + end + def self.reply + "\n#{Settings.config[:post_max_length]} ".color(:yellow) + "characters maximum. If the original post has mentions, you text will be inserted after the first one. Markdown links are supported.\n\n" + end + def self.post + "\n#{Settings.config[:post_max_length]} ".color(:yellow) + "characters maximum. Markdown links are supported.\n\n" + end + def self.message + "\n#{Settings.config[:message_max_length]} ".color(:yellow) + "characters maximum. Markdown links are supported.\n\n" + end + # def self.method_missing(meth, args) + # "\nThe command '#{meth} #{args}' doesn't exist.\n".color(:red) + # end + def self.valid_colors(colors_list) + "\nThe valid colors are: #{colors_list}\n".color(:cyan) + end + def self.not_mutable + "\nThis parameter is not modifiable for the time being, sorry.\n".color(:red) + end + def self.must_be_integer + "\nThis paramater must be an integer between 1 and 200.\n".color(:red) + end + def self.no_new_posts + "\nNo new posts since your last visit.\n\n".color(:cyan) + end + def self.type_and_target_missing + "\nYou have to submit a TYPE (mention, hashtag, client name) and a TARGET (a @username, a hashtag, a client name)\n\n".color(:red) + end + def self.wrong_arguments + "\nYou have to submit valid arguments.\n\n".color(:red) + end + def self.no_pin_creds + "\nAyadn couldn't find your Pinboard credentials.\n".color(:red) + end + def self.pin_creds_saved + "\n\nCredentials successfully encoded and saved in database.\n\n".color(:green) + end + def self.saving_pin + "\nSaving post text and links to Pinboard...\n\n".color(:yellow) + end + def self.error_only_osx + "\nThis feature only works with Mac OS X and iTunes, sorry.\n\n".color(:red) + end + def self.empty_fields + "\nCanceled: couldn't get enough information (empty field).\n\n".color(:red) + end + def self.canceled + "\n\nCanceled.\n\n".color(:cyan) + end + def self.not_authorized + "\nYou need to authorize Ayadn before using it.\n\nPlease run 'ayadn authorize' :)\n\n".color(:red) + end + def self.wtf + "\nSomething wrong happened. :(\n\n".color(:red) + end + def self.redirecting + "\nPost is a repost. Redirecting...\n\n".color(:cyan) + end + def self.nobody_reposted + "\nNobody reposted this post.\n\n".color(:red) + end + def self.nobody_starred + "\nNobody starred this post.\n\n".color(:red) + end + def self.not_your_repost + "\nThis post isn't one of your reposts.\n\n".color(:red) + end + def self.not_your_starred + "\nThis isn't one of your starred posts.\n\n".color(:red) + end + def self.auto + view = "\nEntering the auto posting mode.\n\n".color(:cyan) + view << "In this mode, each line you type (each time you hit ENTER!) is automatically posted to ADN.\n\n".color(:cyan) + view << "At any moment, starting now, hit CTRL+C to exit.\n\n".color(:yellow) + view << "\n\t--AUTO POSTING MODE ACTIVATED--\n\n".color(:red) + end + end +end