rubytter 0.3.5 → 0.4.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.
data/Rakefile ADDED
@@ -0,0 +1,43 @@
1
+ $:.unshift File.dirname(__FILE__) + '/lib/'
2
+ require 'rubytter'
3
+ require 'spec/rake/spectask'
4
+
5
+ desc 'run all specs'
6
+ Spec::Rake::SpecTask.new do |t|
7
+ t.spec_files = FileList['spec/**/*_spec.rb']
8
+ t.spec_opts = ['-c']
9
+ end
10
+
11
+ desc 'Generate gemspec'
12
+ task :gemspec do |t|
13
+ open('rubytter.gemspec', "wb" ) do |file|
14
+ file << <<-EOS
15
+ Gem::Specification.new do |s|
16
+ s.name = 'rubytter'
17
+ s.version = '#{Rubytter::VERSION}'
18
+ s.summary = "Simple twitter client."
19
+ s.description = "Rubytter is a simple twitter client."
20
+ s.files = %w( #{Dir['lib/**/*.rb'].join(' ')}
21
+ #{Dir['spec/**/*.rb'].join(' ')}
22
+ #{Dir['examples/**/*.rb'].join(' ')}
23
+ README.rdoc
24
+ History.txt
25
+ Rakefile )
26
+ s.add_dependency("json_pure", ">= 1.1.3")
27
+ s.author = 'jugyo'
28
+ s.email = 'jugyo.org@gmail.com'
29
+ s.homepage = 'http://github.com/jugyo/rubytter'
30
+ s.rubyforge_project = 'rubytter'
31
+ s.has_rdoc = true
32
+ s.rdoc_options = ["--main", "README.rdoc", "--exclude", "spec"]
33
+ s.extra_rdoc_files = ["README.rdoc", "History.txt"]
34
+ end
35
+ EOS
36
+ end
37
+ puts "Generate gemspec"
38
+ end
39
+
40
+ desc 'Generate gem'
41
+ task :gem => :gemspec do |t|
42
+ system 'gem', 'build', 'rubytter.gemspec'
43
+ end
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rubytter'
5
+
6
+ if ARGV.size < 3
7
+ puts "Usage: ruby #{File.basename(__FILE__)} user_id password id message"
8
+ exit
9
+ end
10
+
11
+ client = Rubytter.new(ARGV[0], ARGV[1])
12
+ p client.direct_message(ARGV[2], ARGV[3])
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rubytter'
5
+
6
+ if ARGV.size < 3
7
+ puts "Usage: ruby #{File.basename(__FILE__)} user_id password id"
8
+ exit
9
+ end
10
+
11
+ client = Rubytter.new(ARGV[0], ARGV[1])
12
+ p client.favorite(ARGV[2])
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rubytter'
5
+
6
+ if ARGV.size < 3
7
+ puts "Usage: ruby #{File.basename(__FILE__)} user_id password id"
8
+ exit
9
+ end
10
+
11
+ client = Rubytter.new(ARGV[0], ARGV[1])
12
+ p client.follow(ARGV[2])
data/examples/limit.rb ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rubytter'
5
+ require 'time'
6
+
7
+ if ARGV.size < 2
8
+ puts "Usage: ruby #{File.basename(__FILE__)} user_id password"
9
+ exit
10
+ end
11
+
12
+ client = Rubytter.new(ARGV[0], ARGV[1])
13
+ limit_status = client.limit_status
14
+ puts <<EOS
15
+ reset_time_in_seconds: #{limit_status.reset_time_in_seconds}
16
+ remaining_hits: #{limit_status.remaining_hits}
17
+ hourly_limit: #{limit_status.hourly_limit}
18
+ reset_time: #{Time.parse(limit_status.reset_time).strftime('%Y/%m/%d %X')}
19
+ EOS
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rubytter'
5
+
6
+ if ARGV.size < 2
7
+ puts "Usage: ruby #{File.basename(__FILE__)} user_id password"
8
+ exit
9
+ end
10
+
11
+ client = Rubytter.new(ARGV[0], ARGV[1])
12
+ client.replies.each do |status|
13
+ puts "#{status.user.screen_name}: #{status.text}"
14
+ end
@@ -9,4 +9,4 @@ if ARGV.size < 3
9
9
  end
10
10
 
11
11
  client = Rubytter.new(ARGV[0], ARGV[1])
12
- client.update(ARGV[2])
12
+ p client.update(ARGV[2])
data/examples/user.rb ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rubytter'
5
+ require 'time'
6
+
7
+ if ARGV.size < 3
8
+ puts "Usage: ruby #{File.basename(__FILE__)} user_id password id"
9
+ exit
10
+ end
11
+
12
+ client = Rubytter.new(ARGV[0], ARGV[1])
13
+ user = client.user(ARGV[2])
14
+
15
+ puts <<EOS
16
+ id: #{user.id}
17
+ name: #{user.name}
18
+ screen_name: #{user.screen_name}
19
+ url: #{user.url}
20
+ description: #{user.description}
21
+ followers: #{user.followers_count}
22
+ followings: #{user.friends_count}
23
+ time_zone: #{user.time_zone}
24
+ location: #{user.location}
25
+ created_at: #{Time.parse(user.created_at).strftime('%Y/%m/%d %X')}
26
+ EOS
data/lib/rubytter.rb CHANGED
@@ -7,6 +7,7 @@ require 'rubytter/connection'
7
7
 
8
8
  class Rubytter
9
9
  APP_NAME = 'Rubytter'
10
+ VERSION = '0.4.0'
10
11
  HOMEPAGE = 'http://github.com/jugyo/rubytter'
11
12
 
12
13
  def initialize(login, password, options = {})
@@ -19,8 +20,8 @@ class Rubytter
19
20
  def self.api_settings
20
21
  # method name path for API http method
21
22
  "
22
- status_update /statuses/update post
23
- destroy /statuses/destroy/%s delete
23
+ update_status /statuses/update post
24
+ remove_status /statuses/destroy/%s delete
24
25
  public_timeline /statuses/public_timeline
25
26
  friends_timeline /statuses/friends_timeline
26
27
  replies /statuses/replies
@@ -32,20 +33,20 @@ class Rubytter
32
33
  direct_messages /direct_messages
33
34
  sent_direct_messages /direct_messages/sent
34
35
  send_direct_message /direct_messages/new post
35
- destroy_direct_message /direct_messages/destroy/%s delete
36
- create_friendship /friendships/create/%s post
37
- destroy_friendship /friendships/destroy/%s delete
36
+ remove_direct_message /direct_messages/destroy/%s delete
37
+ follow /friendships/create/%s post
38
+ leave /friendships/destroy/%s delete
38
39
  friendship_exists /friendships/exists
39
40
  followers_ids /followers/ids/%s
40
41
  friends_ids /friends/ids/%s
41
42
  favorites /favorites
42
43
  favorite /favorites/create/%s post
43
- unfavorite /favorites/destroy/%s delete
44
+ remove_favorite /favorites/destroy/%s delete
44
45
  verify_credentials /account/verify_credentials get
45
46
  end_session /account/end_session post
46
47
  update_delivery_device /account/update_delivery_device post
47
48
  update_profile_colors /account/update_profile_colors post
48
- rate_limit_status /account/rate_limit_status
49
+ limit_status /account/rate_limit_status
49
50
  update_profile /account/update_profile post
50
51
  enable_notification /notifications/follow/%s post
51
52
  disable_notification /notifications/leave/%s post
@@ -73,7 +74,7 @@ class Rubytter
73
74
  end
74
75
 
75
76
  def update(status, params = {})
76
- status_update(params.merge({:status => status}))
77
+ update_status(params.merge({:status => status}))
77
78
  end
78
79
 
79
80
  def direct_message(user, text, params = {})
@@ -33,7 +33,7 @@ class Rubytter
33
33
  @rubytter.user(1)
34
34
 
35
35
  @rubytter.should_receive(:delete).with('/statuses/destroy/1', {})
36
- @rubytter.destroy(1)
36
+ @rubytter.remove_status(1)
37
37
  end
38
38
 
39
39
  # direct_messages
@@ -55,7 +55,7 @@ class Rubytter
55
55
 
56
56
  it 'should respond to destroy_direct_message' do
57
57
  @rubytter.should_receive(:delete).with('/direct_messages/destroy/1', {})
58
- @rubytter.destroy_direct_message(1)
58
+ @rubytter.remove_direct_message(1)
59
59
  end
60
60
 
61
61
  it 'should respond to direct_message' do
@@ -70,21 +70,21 @@ class Rubytter
70
70
  @rubytter.update('test')
71
71
  end
72
72
 
73
- it 'should respond to status_update' do
73
+ it 'should respond to update_status' do
74
74
  @rubytter.should_receive(:post).with('/statuses/update', {:status => 'test'})
75
- @rubytter.status_update(:status => 'test')
75
+ @rubytter.update_status(:status => 'test')
76
76
  end
77
77
 
78
78
  # friendship
79
79
 
80
80
  it 'should respond to create_friendship' do
81
81
  @rubytter.should_receive(:post).with('/friendships/create/test', {})
82
- @rubytter.create_friendship('test')
82
+ @rubytter.follow('test')
83
83
  end
84
84
 
85
85
  it 'should respond to destroy_friendship' do
86
86
  @rubytter.should_receive(:delete).with('/friendships/destroy/test', {})
87
- @rubytter.destroy_friendship('test')
87
+ @rubytter.remove_follow('test')
88
88
  end
89
89
 
90
90
  it 'should respond to friendship_exists' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubytter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jugyo
@@ -32,14 +32,21 @@ extra_rdoc_files:
32
32
  - README.rdoc
33
33
  - History.txt
34
34
  files:
35
- - lib/rubytter.rb
36
35
  - lib/rubytter/connection.rb
37
- - examples/friends_timeline.rb
38
- - examples/update_status.rb
36
+ - lib/rubytter.rb
39
37
  - spec/rubytter_spec.rb
40
38
  - spec/spec_helper.rb
39
+ - examples/direct_message.rb
40
+ - examples/favorite.rb
41
+ - examples/follow.rb
42
+ - examples/friends_timeline.rb
43
+ - examples/limit.rb
44
+ - examples/replies.rb
45
+ - examples/update_status.rb
46
+ - examples/user.rb
41
47
  - README.rdoc
42
48
  - History.txt
49
+ - Rakefile
43
50
  has_rdoc: true
44
51
  homepage: http://github.com/jugyo/rubytter
45
52
  post_install_message: