pry-send_tweet.rb 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +18 -8
- data/lib/pry/send_tweet/commands/read_tweets.rb +6 -5
- data/lib/pry/send_tweet/commands/twitter_action.rb +10 -5
- data/lib/pry/send_tweet/commands/twitter_action/follow_actions.rb +7 -11
- data/lib/pry/send_tweet/commands/twitter_action/profile_actions.rb +24 -6
- data/lib/pry/send_tweet/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60dbebe89f0db1ac7023b9e2e30f9d06413b704a9f06bf46c989afd0d4f6c09f
|
4
|
+
data.tar.gz: 484501f241913b90d987ec10de8710d5d00e1940b19ad095a49c2dd164bcfe3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79c7445acdebf4fe759f7de18d814627bca324bb29ac3f8fa5b3fd6e010a288360fd86759ef24fabc3b43356732e375f0c2b1cf449c2c9746d147e98297db970
|
7
|
+
data.tar.gz: 6c0d1f74bfa20d83a5c82ac32d97f611220737d012f7a2bb86951a71c142a2f48ab12b211d3322c40d95d452d2b76cbef84bbb145f145703b260ea2ade2c5df5
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## master
|
4
|
+
|
5
|
+
* Avoid a negative argument error when following / unfollowing other user(s) by
|
6
|
+
bypassing tty-box for those operations.
|
7
|
+
|
8
|
+
* Improve the title that appears above tweets when using the `read-tweets`
|
9
|
+
command.
|
10
|
+
|
11
|
+
* Add support for `read-tweets -t https://twitter.com/username`.
|
12
|
+
|
13
|
+
* Add `--set-profile-location`, and `--set-profile-link-color=` to the
|
14
|
+
`on-twitter` command.
|
15
|
+
|
3
16
|
## v0.9.0
|
4
17
|
|
5
18
|
* Render `Twitter::Tweet` and `Twitter::User` objects using `TTY::Box` - with the
|
data/README.md
CHANGED
@@ -219,25 +219,35 @@ The `twitter-search` command can be used to search Twitter.
|
|
219
219
|
|
220
220
|
### <a id='profile-actions'>Profile actions</a>
|
221
221
|
|
222
|
-
*
|
222
|
+
* Set the name visible on your profile:
|
223
223
|
|
224
|
-
|
225
|
-
|
224
|
+
[1] pry(main)> on-twitter --set-profile-name=<name>
|
225
|
+
|
226
|
+
* Set the profile bio / description visible on your profile:
|
227
|
+
|
228
|
+
# An editor opens (`_pry_.editor`), write your bio then hit save & close.
|
229
|
+
# Your profiles bio will be updated after closing the editor.
|
226
230
|
[1] pry(main)> on-twitter --set-profile-bio
|
227
231
|
|
228
|
-
*
|
232
|
+
* Set the location visible on your profile:
|
233
|
+
|
234
|
+
# An editor opens (`_pry_.editor`), write your location then hit save &
|
235
|
+
# close. Your profiles location will be updated after closing the editor.
|
236
|
+
[1] pry(main)> on-twitter --set-profile-bio
|
229
237
|
|
230
|
-
|
238
|
+
* Set the color (as a hex value) of links that appear on your profiles timeline:
|
231
239
|
|
232
|
-
|
240
|
+
[1] pry(main)> on-twitter --set-profile-link-color=#CC0000
|
241
|
+
|
242
|
+
* Set the URL visible on your profile:
|
233
243
|
|
234
244
|
[1] pry(main)> on-twitter --set-profile-url=https://github.com/you
|
235
245
|
|
236
|
-
*
|
246
|
+
* Set profile image:
|
237
247
|
|
238
248
|
[1] pry(main)> on-twitter --set-profile-image /path/to/image.jpg
|
239
249
|
|
240
|
-
*
|
250
|
+
* Set the banner image visible on your profile:
|
241
251
|
|
242
252
|
[1] pry(main)> on-twitter --set-profile-banner-image /path/to/image.jpg
|
243
253
|
|
@@ -34,30 +34,31 @@ class Pry::SendTweet::ReadTweets < Pry::SendTweet::BaseCommand
|
|
34
34
|
private
|
35
35
|
|
36
36
|
def show_replies(user:)
|
37
|
+
username = search_str_for_users(user).first
|
37
38
|
render_tweets lambda {
|
38
|
-
username = search_str_for_users(user).first
|
39
39
|
twitter.user_timeline(username, timeline_options).select {|tweet|
|
40
40
|
tweet.reply? &&
|
41
41
|
tweet.in_reply_to_screen_name? &&
|
42
42
|
tweet.in_reply_to_screen_name.downcase != username.downcase
|
43
43
|
}
|
44
44
|
},
|
45
|
-
title:
|
45
|
+
title: "#{'@'+user} replies"
|
46
46
|
end
|
47
47
|
|
48
48
|
def show_likes(user:)
|
49
49
|
if user
|
50
50
|
user = search_str_for_users(user).first
|
51
51
|
render_tweets lambda { twitter.favorites(user, count: opts['count'] || Pry::SendTweet::DEFAULT_READ_SIZE)},
|
52
|
-
title: "
|
52
|
+
title: "#{'@'+user} likes"
|
53
53
|
else
|
54
54
|
render_tweets lambda { twitter.favorites(count: opts['count'] || Pry::SendTweet::DEFAULT_READ_SIZE) },
|
55
|
-
title: "
|
55
|
+
title: "Your likes"
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
def show_tweets_from_timeline(user:)
|
60
60
|
if user
|
61
|
+
user = search_str_for_users(user).first
|
61
62
|
render_tweets lambda { twitter.user_timeline(user, timeline_options) },
|
62
63
|
title: '@'+user
|
63
64
|
else
|
@@ -68,7 +69,7 @@ class Pry::SendTweet::ReadTweets < Pry::SendTweet::BaseCommand
|
|
68
69
|
|
69
70
|
def show_mentions
|
70
71
|
render_tweets lambda { twitter.mentions(timeline_options) },
|
71
|
-
title: "
|
72
|
+
title: "@mentions"
|
72
73
|
end
|
73
74
|
|
74
75
|
def timeline_options
|
@@ -47,11 +47,14 @@ class Pry::SendTweet::TwitterAction < Pry::SendTweet::BaseCommand
|
|
47
47
|
#
|
48
48
|
# Profile management
|
49
49
|
#
|
50
|
-
o.on 'set-profile-name=',
|
51
|
-
o.on 'set-profile-bio',
|
52
|
-
o.on 'set-profile-
|
53
|
-
o.on 'set-profile-
|
54
|
-
o.on 'set-profile-image=', 'Set your profile
|
50
|
+
o.on 'set-profile-name=', 'Set the name visible on your profile'
|
51
|
+
o.on 'set-profile-bio', 'Set the description visible on your profile'
|
52
|
+
o.on 'set-profile-location', 'Set the location visible on your profile'
|
53
|
+
o.on 'set-profile-url=', 'Set the URL visible on your profile'
|
54
|
+
o.on 'set-profile-banner-image=', 'Set the banner image visible on your profile'
|
55
|
+
o.on 'set-profile-image=', 'Set profile photo'
|
56
|
+
o.on 'set-profile-link-color=', 'Set the color (as a hex value) of links that ' \
|
57
|
+
'are visible on your profiles timeline '
|
55
58
|
#
|
56
59
|
# Suggestions
|
57
60
|
#
|
@@ -81,6 +84,8 @@ class Pry::SendTweet::TwitterAction < Pry::SendTweet::BaseCommand
|
|
81
84
|
when opts.present?('set-profile-name') then set_profile_name(opts['set-profile-name'])
|
82
85
|
when opts.present?('set-profile-image') then set_profile_image(opts['set-profile-image'])
|
83
86
|
when opts.present?('set-profile-url') then set_profile_url(opts['set-profile-url'])
|
87
|
+
when opts.present?('set-profile-location') then set_profile_location
|
88
|
+
when opts.present?('set-profile-link-color') then set_profile_link_color(opts['set-profile-link-color'])
|
84
89
|
when opts.present?('set-profile-bio') then set_profile_bio
|
85
90
|
when opts.present?('suggested-topics') then suggested_topics
|
86
91
|
when opts.present?('suggested-users') then suggested_users(opts['suggested-users'])
|
@@ -2,13 +2,11 @@ module Pry::SendTweet::TwitterAction::FollowActions
|
|
2
2
|
def follow_user(users)
|
3
3
|
users = search_str_for_users(*users)
|
4
4
|
follows = twitter.follow(users)
|
5
|
-
if follows.
|
6
|
-
|
5
|
+
if follows.size > 0
|
6
|
+
page_ok "followed #{join_usernames(follows.map(&:screen_name))}."
|
7
7
|
else
|
8
|
-
|
9
|
-
|
10
|
-
}
|
11
|
-
end
|
8
|
+
page_error "are you already following #{join_usernames(users)} ..?"
|
9
|
+
end
|
12
10
|
rescue Twitter::Error => e
|
13
11
|
page_error(e)
|
14
12
|
end
|
@@ -16,12 +14,10 @@ module Pry::SendTweet::TwitterAction::FollowActions
|
|
16
14
|
def unfollow_user(users)
|
17
15
|
users = search_str_for_users(*users)
|
18
16
|
unfollows = twitter.unfollow(users)
|
19
|
-
if unfollows.
|
20
|
-
|
17
|
+
if unfollows.size > 0
|
18
|
+
page_ok "unfollowed #{join_usernames(unfollows.map(&:screen_name))}."
|
21
19
|
else
|
22
|
-
|
23
|
-
render_user(unfollowed)
|
24
|
-
}
|
20
|
+
page_error "did you already unfollow #{join_usernames(users)} ..?"
|
25
21
|
end
|
26
22
|
rescue Twitter::Error => e
|
27
23
|
page_error(e)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Pry::SendTweet::TwitterAction::ProfileActions
|
2
2
|
def set_profile_url(url)
|
3
3
|
if twitter.update_profile url: url
|
4
|
-
|
4
|
+
page_ok "URL updated"
|
5
5
|
else
|
6
6
|
raise Pry::CommandError, "Something went wrong"
|
7
7
|
end
|
@@ -9,7 +9,7 @@ module Pry::SendTweet::TwitterAction::ProfileActions
|
|
9
9
|
|
10
10
|
def set_profile_image(path)
|
11
11
|
twitter.update_profile_image(path)
|
12
|
-
|
12
|
+
page_ok "Profile image updated"
|
13
13
|
rescue Twitter::Error => e
|
14
14
|
page_error(e)
|
15
15
|
end
|
@@ -17,26 +17,44 @@ module Pry::SendTweet::TwitterAction::ProfileActions
|
|
17
17
|
def set_profile_banner_image(path)
|
18
18
|
base64 = Base64.strict_encode64 File.binread(path)
|
19
19
|
twitter.update_profile_banner(base64)
|
20
|
-
|
20
|
+
page_ok "Profile banner updated"
|
21
21
|
rescue Twitter::Error => e
|
22
22
|
page_error(e)
|
23
23
|
end
|
24
24
|
|
25
25
|
def set_profile_name(name)
|
26
26
|
twitter.update_profile name: name
|
27
|
-
|
27
|
+
page_ok "Name updated"
|
28
28
|
rescue Twitter::Error => e
|
29
29
|
page_error(e)
|
30
30
|
end
|
31
31
|
|
32
32
|
def set_profile_bio
|
33
|
-
Tempfile.open('pry-send_tweet-set-bio') do |file|
|
33
|
+
Tempfile.open('pry-send_tweet-set-profile-bio') do |file|
|
34
34
|
Pry::Editor.new(_pry_).invoke_editor(file.path, 0)
|
35
35
|
file.rewind
|
36
36
|
twitter.update_profile description: file.read
|
37
|
-
|
37
|
+
page_ok "Bio updated"
|
38
38
|
end
|
39
39
|
rescue Twitter::Error => e
|
40
40
|
page_error(e)
|
41
41
|
end
|
42
|
+
|
43
|
+
def set_profile_location
|
44
|
+
Tempfile.open('pry-send_tweet-set-profile-location') do |file|
|
45
|
+
Pry::Editor.new(_pry_).invoke_editor(file.path, 0)
|
46
|
+
file.rewind
|
47
|
+
twitter.update_profile location: file.read
|
48
|
+
page_ok "Location updated"
|
49
|
+
end
|
50
|
+
rescue Twitter::Error => e
|
51
|
+
page_error e
|
52
|
+
end
|
53
|
+
|
54
|
+
def set_profile_link_color(color)
|
55
|
+
twitter.update_profile profile_link_color: color
|
56
|
+
page_ok "Profile link color updated"
|
57
|
+
rescue Twitter::Error => e
|
58
|
+
page_error e
|
59
|
+
end
|
42
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-send_tweet.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Gleeson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|