twido 0.0.1.beta → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/twido +6 -0
- data/lib/twido.rb +73 -2
- data/lib/twido/version.rb +1 -1
- metadata +5 -5
data/bin/twido
CHANGED
data/lib/twido.rb
CHANGED
@@ -18,6 +18,7 @@ require "twido/version"
|
|
18
18
|
require "twitter"
|
19
19
|
require "twido/authentication"
|
20
20
|
require "highline/import"
|
21
|
+
require "yaml"
|
21
22
|
|
22
23
|
module Twido
|
23
24
|
# Public: authenticates the user using the authenticate method of the Authentication module
|
@@ -107,7 +108,6 @@ module Twido
|
|
107
108
|
# Have a good and productive day!
|
108
109
|
def self.complete
|
109
110
|
twitter_client = Authentication.authenticate
|
110
|
-
user = twitter_client.user.screen_name
|
111
111
|
tweets = self.build_list
|
112
112
|
self.list
|
113
113
|
complete_index = ask("Enter task ID: ")
|
@@ -136,7 +136,7 @@ module Twido
|
|
136
136
|
twitter_client.update(task)
|
137
137
|
end
|
138
138
|
|
139
|
-
#
|
139
|
+
# Private: Gets a list of tweets with "#todo"
|
140
140
|
# Retruns Array of tweets
|
141
141
|
# Examples
|
142
142
|
# self.build_list
|
@@ -146,4 +146,75 @@ module Twido
|
|
146
146
|
user = twitter_client.user.screen_name
|
147
147
|
twitter_client.search("#todo", count: count, from:user).statuses
|
148
148
|
end
|
149
|
+
|
150
|
+
# Public: Gets list of tweets with the hash tag #"group"_todo
|
151
|
+
# Returns Array of tweets
|
152
|
+
# Examples
|
153
|
+
# self.group
|
154
|
+
# #=> [tweet1, tweet2,...]
|
155
|
+
def self.group(count = 20)
|
156
|
+
twitter_client = Authentication.authenticate
|
157
|
+
group_name = ask("Enter group name: ") + "_todo"
|
158
|
+
tweets = twitter_client.search(group_name, count: count).statuses
|
159
|
+
tweets.each_with_index { |tweet, index| puts "[#{index}] #{tweet.text}" }
|
160
|
+
end
|
161
|
+
|
162
|
+
# Public: removes a task from the specified group's to do list by deleting the tweet and confirming authorship
|
163
|
+
# Returns a string stating if task was completed or not
|
164
|
+
# Examples
|
165
|
+
#
|
166
|
+
# self.group_complete
|
167
|
+
# # => [0] Task #todo
|
168
|
+
# [1] Task2 #todo
|
169
|
+
# Enter task ID:
|
170
|
+
# 1
|
171
|
+
# Are you sure you completed this task?:
|
172
|
+
# y
|
173
|
+
# TASK COMPLETED
|
174
|
+
# self.group_complete
|
175
|
+
# # => [0] Task #todo
|
176
|
+
# [1] Task2 #todo
|
177
|
+
# Enter task ID:
|
178
|
+
# 0
|
179
|
+
# Are you sure you completed this task?:
|
180
|
+
# n
|
181
|
+
# Have a good and productive day!
|
182
|
+
def self.group_complete
|
183
|
+
twitter_client = Authentication.authenticate
|
184
|
+
tweets = self.group
|
185
|
+
complete_index = ask("Enter task ID: ")
|
186
|
+
complete = Integer(complete_index)
|
187
|
+
tweet_id = tweets[complete].id
|
188
|
+
author = twitter_client.status(tweet_id,{"trim_user" => true})
|
189
|
+
user = twitter_client.user
|
190
|
+
confirm = ask("Are you sure you completed this task?: ")
|
191
|
+
case confirm.downcase.to_sym
|
192
|
+
when :no, :n
|
193
|
+
puts "Have a good and productive day!"
|
194
|
+
when :yes, :y
|
195
|
+
confirm = ask("Is this your tweet?: ")
|
196
|
+
case confirm.downcase.to_sym
|
197
|
+
when :yes, :y
|
198
|
+
twitter_client.status_destroy(tweet_id)
|
199
|
+
puts "TASK COMPLETED"
|
200
|
+
when :no, :n
|
201
|
+
twitter_client.update(" Task completed please delete task", {"in_reply_to_status_id" => tweet_id})
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# Public: adds a task to the specified group's todo list by tweeting a tweet that the user defines and automaticly adds the "#group_name_todo" to the end
|
207
|
+
# Returns nil
|
208
|
+
# Examples
|
209
|
+
#
|
210
|
+
# self.group_task
|
211
|
+
# # => What do you have to do?:
|
212
|
+
# task
|
213
|
+
def self.group_task
|
214
|
+
twitter_client = Authentication.authenticate
|
215
|
+
group_name = ask("Enter group name: ") + "_todo"
|
216
|
+
task = ask("What do you have to do?: ") + " #" + group_name
|
217
|
+
twitter_client.update(task)
|
218
|
+
end
|
219
|
+
|
149
220
|
end
|
data/lib/twido/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twido
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Cody Finn
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdoc
|
@@ -162,9 +162,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
163
|
none: false
|
164
164
|
requirements:
|
165
|
-
- - ! '
|
165
|
+
- - ! '>='
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
version:
|
167
|
+
version: '0'
|
168
168
|
requirements: []
|
169
169
|
rubyforge_project:
|
170
170
|
rubygems_version: 1.8.23
|