twtr 0.1.3 → 0.1.4
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.
- data/History.txt +4 -0
- data/lib/twtr/client.rb +4 -0
- data/lib/twtr/console.rb +6 -2
- data/lib/twtr/screen.rb +9 -0
- data/lib/twtr/version.rb +1 -1
- data/test/test_twtr_console.rb +7 -1
- metadata +2 -2
data/History.txt
CHANGED
data/lib/twtr/client.rb
CHANGED
data/lib/twtr/console.rb
CHANGED
@@ -23,6 +23,7 @@ SYNOPSIS
|
|
23
23
|
$ twtr friends # => Show friends.
|
24
24
|
$ twtr friedns -i bob # => Show bob's friends.
|
25
25
|
$ twtr ul -l "Tokyo, Japan" # => Update location.
|
26
|
+
$ twtr rls # => The remaining number of API requests.
|
26
27
|
|
27
28
|
SUBCMMAND
|
28
29
|
setting (reset) # (Re)Set twtr configuration.
|
@@ -33,6 +34,7 @@ SUBCMMAND
|
|
33
34
|
update (up) # Updates your status. -m, --message option required.
|
34
35
|
friends (fds) # Show friends. available -i, --id option.
|
35
36
|
update_location (ul) # Update location. -l, --location option required.
|
37
|
+
rate_limit_status (rls) # The remaining number of API requests.
|
36
38
|
|
37
39
|
_TEXT_
|
38
40
|
|
@@ -62,6 +64,8 @@ _TEXT_
|
|
62
64
|
:fds => :friends,
|
63
65
|
:update_location => :update_location,
|
64
66
|
:ul => :update_location,
|
67
|
+
:rate_limit_status => :rate_limit_status,
|
68
|
+
:rls => :rate_limit_status,
|
65
69
|
}
|
66
70
|
|
67
71
|
def run(args)
|
@@ -137,11 +141,11 @@ _TEXT_
|
|
137
141
|
|
138
142
|
opt.on('-m','--message=message','Post message.') do |val|
|
139
143
|
@display_count ||= COUNT_WITH_UPDATE
|
140
|
-
@params.merge!({:source => "
|
144
|
+
@params.merge!({:source => "twtrconsole", :status => val.toutf8})
|
141
145
|
end
|
142
146
|
|
143
147
|
opt.on('-l','--location=location','Post location.') do |val|
|
144
|
-
@params.merge!({:source => "
|
148
|
+
@params.merge!({:source => "twtrconsole", :location => val.toutf8})
|
145
149
|
end
|
146
150
|
|
147
151
|
opt.on('-p', '--page=number',"Gets the 20 next statuses.") do |val|
|
data/lib/twtr/screen.rb
CHANGED
@@ -31,6 +31,15 @@ module Twtr
|
|
31
31
|
end
|
32
32
|
puts ""
|
33
33
|
end
|
34
|
+
|
35
|
+
def show_rate_limit_status()
|
36
|
+
doc = REXML::Document.new(@source)
|
37
|
+
return if(!doc || !doc.elements['hash'])
|
38
|
+
|
39
|
+
remain = doc.elements['hash/remaining-hits'].text
|
40
|
+
limit = doc.elements['hash/hourly-limit'].text
|
41
|
+
puts "#{remain}/#{limit}"
|
42
|
+
end
|
34
43
|
|
35
44
|
def show_update_location()
|
36
45
|
doc = REXML::Document.new(@source)
|
data/lib/twtr/version.rb
CHANGED
data/test/test_twtr_console.rb
CHANGED
@@ -18,7 +18,13 @@ class TestTwtrConsole < Test::Unit::TestCase
|
|
18
18
|
assert_equal(:update, console.parse_subcommand("update"))
|
19
19
|
assert_equal(:update, console.parse_subcommand("up"))
|
20
20
|
assert_equal(:setting, console.parse_subcommand("setting"))
|
21
|
-
assert_equal(:
|
21
|
+
assert_equal(:friends, console.parse_subcommand("friends"))
|
22
|
+
assert_equal(:friends, console.parse_subcommand("fds"))
|
23
|
+
assert_equal(:update_location, console.parse_subcommand("update_location"))
|
24
|
+
assert_equal(:update_location, console.parse_subcommand("ul"))
|
25
|
+
assert_equal(:rate_limit_status, console.parse_subcommand("rate_limit_status"))
|
26
|
+
assert_equal(:rate_limit_status, console.parse_subcommand("rls"))
|
27
|
+
|
22
28
|
end
|
23
29
|
# -v, --version Show the version number and quit
|
24
30
|
# -h, --help Show this help message and quit.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twtr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Maruko
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-07-02 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|