twsh 0.4.1 → 0.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2016eeb546e1f9225a187e1b8d62dc24dbdb4a51
4
- data.tar.gz: 292c4cfba3b60bd88620e2485f0a194c38b66c16
3
+ metadata.gz: f1997c7c0bb311a30dede083c6e024a72b3ccf32
4
+ data.tar.gz: 72f9973cd886d24b21a976a8694d6da79c6985f5
5
5
  SHA512:
6
- metadata.gz: 7c9d0408f5427973b71b5a3db51c658322a41eb74abb58c29ae44f35e9d2ce2d51786543fe1802ee09c7272d2bcbfe9f4e158216aa85262779d15418ae58558b
7
- data.tar.gz: b339a713b7cf0c6a422563e58f66511f201cee77dfa4a33e24347d276994c1bb377694310c9f131b445b058165f3b781709f23535bfbb7ba1a6ad69587163313
6
+ metadata.gz: 6a72d808e4d2c254e937fe1493d1cfeaeb774d4c1a4f474e46c3e536f90c67d955711b7f6c4a140e4efb8bc5320fc56cedb37818cfc358170c7118edc1bea9d5
7
+ data.tar.gz: ad20708fad91eaa0cd829e3f2306a5a351ec722e5a7aa59d86bfb70a7dbf212ab49c4486b1fd26a23dfd328914e83a6c4a60875bece4b640bdea51d06799567f
data/README.md CHANGED
@@ -29,8 +29,11 @@ $ update <post text>
29
29
  # Tweet post text.
30
30
 
31
31
  $ ls
32
+ $ ls mention
33
+ $ ls -l
32
34
  # Show your home-timeline (shown 30 charactors tweet text, and only 20 tweets count.)
33
- # Option 'l': detail timeline (timestamp and user id, full tweet text)
35
+ # Option 'mention': mention timeline
36
+ # Option '-l': detail timeline (timestamp and user id, full tweet text)
34
37
 
35
38
  $ tail
36
39
  # Realtime show your home-timeline
@@ -7,26 +7,40 @@ module Myun2
7
7
 
8
8
  def initialize(client, *params)
9
9
  @client = client
10
- format(home_timeline, *params).each do |tweet| puts tweet end
10
+
11
+ if params && params.length > 0
12
+ case
13
+ when params[0] == '-m' || params[0] == 'mention' || params[0] == 'mentions'
14
+ timeline = mentions_timeline
15
+ params.shift
16
+ end
17
+ end
18
+ timeline ||= home_timeline
19
+
20
+ timeline.each do |t|
21
+ puts format(t, *params)
22
+ end
23
+ end
24
+
25
+ def mentions_timeline
26
+ client.mentions
11
27
  end
12
28
 
13
29
  def home_timeline
14
30
  client.home_timeline
15
31
  end
16
32
 
17
- def format(timeline, *params)
18
- timeline.map do |t|
19
- u = t['user']
20
- user_name = u['name']
21
- screen_name = u['screen_name']
22
- text = t['text']
23
-
24
- if params && params.length > 0 && params[0].include?('l')
25
- datetime = t['created_at']
26
- "#{datetime} <#{screen_name}:#{user_name}>: #{text}"
27
- else
28
- "<#{user_name}>: #{text[0..30]}"
29
- end
33
+ def format(tweet, *params)
34
+ u = tweet['user']
35
+ user_name = u['name']
36
+ screen_name = u['screen_name']
37
+ text = tweet['text']
38
+
39
+ if params && params.length > 0 && params[0][0] == '-' && params[0].include?('l')
40
+ datetime = tweet['created_at']
41
+ "#{datetime} <#{screen_name}:#{user_name}>: #{text}"
42
+ else
43
+ "<#{user_name}>: #{text[0..30]}"
30
44
  end
31
45
  end
32
46
  end
@@ -1,5 +1,5 @@
1
1
  module Myun2
2
2
  class TwitterShell
3
- VERSION = "0.4.1"
3
+ VERSION = "0.4.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twsh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - myun2