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.
@@ -1,3 +1,7 @@
1
+ == 0.1.4 2008-07-02
2
+ * Change source post parameter.
3
+ * Added rate_limit_status method.
4
+
1
5
  == 0.1.3 2008-06-28
2
6
  * Change bin/twtr
3
7
  * Added update_location method.
@@ -66,6 +66,10 @@ module Twtr
66
66
  request_status("/account/update_location", options)
67
67
  end
68
68
 
69
+ def rate_limit_status(options = {})
70
+ request_status("/account/rate_limit_status", options)
71
+ end
72
+
69
73
  def test(options={})
70
74
  request_status("/help/test", options)
71
75
  end
@@ -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 => "twtr", :status => val.toutf8})
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 => "twtr", :location => val.toutf8})
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|
@@ -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)
@@ -2,7 +2,7 @@ module Twtr #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -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(:setting, console.parse_subcommand("reset"))
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.3
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-06-28 00:00:00 +09:00
12
+ date: 2008-07-02 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency