favt 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/favt +8 -4
- data/config.sample.yaml +1 -1
- data/lib/favt.rb +5 -8
- data/lib/favt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc75eff88cb8444c186a82ff5ab646180919d8ae
|
4
|
+
data.tar.gz: 75b8f3979d5160db679a58a8c622be3a087db52f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa07af7af1b49ec870a131e9bc0c6d916e4e34f7d70252d630eb73a017ef028dbf7b24687fa09c2a7f7a57c1b8f91c6a156c19c375c40025dd5f6b77c37e80dc
|
7
|
+
data.tar.gz: e125170d9f9256b63e9a159548f2b86fe8fa7bba7bc8709702b3142933bee23ae5f2c0c12500257adb02afb8da1d4ec2b506760081f4bd56bf8125ae8e5a26ab
|
data/bin/favt
CHANGED
@@ -19,6 +19,10 @@ def option_parse
|
|
19
19
|
options["user"] = user
|
20
20
|
end
|
21
21
|
|
22
|
+
opts.on("-f FILE", "--file FILE", String,
|
23
|
+
"Set any config yaml file (default:config.yaml)") do |file|
|
24
|
+
options["config_file"] = file
|
25
|
+
end
|
22
26
|
end.parse!
|
23
27
|
return options
|
24
28
|
end
|
@@ -43,10 +47,10 @@ Config file examples (config.yaml)
|
|
43
47
|
-----------------------------------
|
44
48
|
|
45
49
|
client:
|
46
|
-
consumer_key: "
|
47
|
-
consumer_secret: "
|
48
|
-
access_token: "
|
49
|
-
access_token_secret: "
|
50
|
+
consumer_key: "Your Consumer Key"
|
51
|
+
consumer_secret: "Your Consumer Secret Key"
|
52
|
+
access_token: "Your Access Token"
|
53
|
+
access_token_secret: "Your Access Token Secret"
|
50
54
|
|
51
55
|
users:
|
52
56
|
- "esehara"
|
data/config.sample.yaml
CHANGED
data/lib/favt.rb
CHANGED
@@ -6,8 +6,7 @@ require "yaml"
|
|
6
6
|
|
7
7
|
module Favt
|
8
8
|
class TwitterClient
|
9
|
-
|
10
|
-
def init_client()
|
9
|
+
def init_client
|
11
10
|
keys = @config["client"]
|
12
11
|
@client = Twitter::REST::Client.new do |config|
|
13
12
|
config.consumer_key = keys["consumer_key"]
|
@@ -26,7 +25,7 @@ module Favt
|
|
26
25
|
self.init_client()
|
27
26
|
end
|
28
27
|
|
29
|
-
def favorites_from_user
|
28
|
+
def favorites_from_user
|
30
29
|
users = self.target_users
|
31
30
|
favorites = users.map do |user|
|
32
31
|
@client.favorites user
|
@@ -41,15 +40,14 @@ module Favt
|
|
41
40
|
return set_fav_posts
|
42
41
|
end
|
43
42
|
|
44
|
-
def target_users
|
43
|
+
def target_users
|
45
44
|
if !@options["user"]
|
46
45
|
return @config["users"]
|
47
46
|
end
|
48
47
|
return [@options["user"]]
|
49
48
|
end
|
50
49
|
|
51
|
-
def favorite_posts
|
52
|
-
|
50
|
+
def favorite_posts
|
53
51
|
show_fav_posts = self.to_set(self.favorites_from_user.sort do
|
54
52
|
|prev_post, next_post| next_post.id <=> prev_post.id
|
55
53
|
end)
|
@@ -70,8 +68,7 @@ module Favt
|
|
70
68
|
return favorites_dict
|
71
69
|
end
|
72
70
|
|
73
|
-
def render
|
74
|
-
|
71
|
+
def render
|
75
72
|
self.favorite_posts.each do |_, favorite|
|
76
73
|
favorite["users"].times do
|
77
74
|
print "■".red
|
data/lib/favt/version.rb
CHANGED