rubytter 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -58,18 +58,18 @@ Rubytter is a simple twitter library.
58
58
  - /saved_searches/show/%s
59
59
  - /saved_searches/create
60
60
  - /saved_searches/destroy/%s
61
- - /:user/lists (create)
62
- - /:user/lists/%s (update)
63
- - /:user/lists/%s (delete)
64
- - /:user/lists
65
- - /:user/lists/memberships
66
- - /:user/lists/%s/statuses
67
- - /:user/lists/%s
61
+ - /%s/lists (create)
62
+ - /%s/lists/%s (update)
63
+ - /%s/lists/%s (delete)
64
+ - /%s/lists/%s
65
+ - /%s/lists
66
+ - /%s/lists/memberships
67
+ - /%s/lists/%s/statuses
68
+ - /%s/%s/members (create)
69
+ - /%s/%s/members (delete)
68
70
  - /%s/%s/members
69
- - /:user/%s/members
70
- - /:user/%s/members
71
- - /%s/%s/subscribers
72
- - /%s/%s/subscribers
71
+ - /%s/%s/subscribers (create)
72
+ - /%s/%s/subscribers (delete)
73
73
  - /%s/%s/subscribers
74
74
  - (search.twitter.com)/search
75
75
  - (api.twitter.com)/1/users/search
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.1
1
+ 1.4.2
data/examples/lists.rb CHANGED
@@ -11,7 +11,7 @@ end
11
11
  client = Rubytter.new(ARGV[0], ARGV[1])
12
12
 
13
13
  puts 'create list...'
14
- list = client.create_list('test')
14
+ list = client.create_list(ARGV[0], 'test')
15
15
  puts " => : #{list.full_name}"
16
16
 
17
17
  puts 'get lists..'
@@ -19,17 +19,17 @@ puts ' =>' + client.lists(ARGV[0]).lists.map{|i| i.slug}.inspect
19
19
 
20
20
  puts 'add member to list...'
21
21
  add_user = client.user('termtter')
22
- client.add_member_to_list(list.slug, add_user.id)
22
+ client.add_member_to_list(ARGV[0], list.slug, add_user.id)
23
23
  members = client.list_members(ARGV[0], list.slug)
24
24
  puts ' =>' + members.users.map{|i| i.screen_name}.inspect
25
25
 
26
26
  puts 'remove member from list...'
27
- client.remove_member_from_list(list.slug, add_user.id)
27
+ client.remove_member_from_list(ARGV[0], list.slug, add_user.id)
28
28
  members = client.list_members(ARGV[0], list.slug)
29
29
  puts ' =>' + members.users.map{|i| i.screen_name}.inspect
30
30
 
31
31
  puts 'delete list...'
32
- client.delete_list(list.slug)
32
+ client.delete_list(ARGV[0], list.slug)
33
33
 
34
34
  puts 'get lists..'
35
35
  puts ' =>' + client.lists(ARGV[0]).lists.map{|i| i.slug}.inspect
data/lib/rubytter.rb CHANGED
@@ -90,16 +90,16 @@ class Rubytter
90
90
  saved_search /saved_searches/show/%s get
91
91
  create_saved_search /saved_searches/create post
92
92
  remove_saved_search /saved_searches/destroy/%s delete
93
- create_list /:user/lists post
94
- update_list /:user/lists/%s put
95
- delete_list /:user/lists/%s delete
93
+ create_list /%s/lists post
94
+ update_list /%s/lists/%s put
95
+ delete_list /%s/lists/%s delete
96
+ list /%s/lists/%s
96
97
  lists /%s/lists
97
98
  lists_followers /%s/lists/memberships
98
99
  list_statuses /%s/lists/%s/statuses
99
- list /%s/lists/%s
100
100
  list_members /%s/%s/members
101
- add_member_to_list /:user/%s/members post
102
- remove_member_from_list /:user/%s/members delete
101
+ add_member_to_list /%s/%s/members post
102
+ remove_member_from_list /%s/%s/members delete
103
103
  list_following /%s/%s/subscribers
104
104
  follow_list /%s/%s/subscribers post
105
105
  remove_list /%s/%s/subscribers delete
@@ -112,9 +112,8 @@ class Rubytter
112
112
  if /%s/ =~ path
113
113
  eval <<-EOS
114
114
  def #{method}(*args)
115
- path = login ? '#{path}'.gsub(':user', login) :'#{path}'
116
115
  params = args.last.kind_of?(Hash) ? args.pop : {}
117
- path = path % args
116
+ path = '#{path}' % args
118
117
  path.sub!(/\\/\\z/, '')
119
118
  #{http_method}(path, params)
120
119
  end
@@ -122,26 +121,25 @@ class Rubytter
122
121
  else
123
122
  eval <<-EOS
124
123
  def #{method}(params = {})
125
- path = login ? '#{path}'.gsub(':user', login) :'#{path}'
126
- #{http_method}(path, params)
124
+ #{http_method}('#{path}', params)
127
125
  end
128
126
  EOS
129
127
  end
130
128
  end
131
129
 
132
130
  alias_method :__create_list, :create_list
133
- def create_list(name, params = {})
134
- __create_list(params.merge({:name => name}))
131
+ def create_list(owner, list_slug, params = {})
132
+ __create_list(owner, params.merge({:name => list_slug}))
135
133
  end
136
134
 
137
135
  alias_method :__add_member_to_list, :add_member_to_list
138
- def add_member_to_list(list_slug, user_id, params = {})
139
- __add_member_to_list(list_slug, params.merge({:id => user_id}))
136
+ def add_member_to_list(owner, list_slug, user_id, params = {})
137
+ __add_member_to_list(owner, list_slug, params.merge({:id => user_id}))
140
138
  end
141
139
 
142
140
  alias_method :__remove_member_from_list, :remove_member_from_list
143
- def remove_member_from_list(list_slug, user_id, params = {})
144
- __remove_member_from_list(list_slug, params.merge({:id => user_id}))
141
+ def remove_member_from_list(owner, list_slug, user_id, params = {})
142
+ __remove_member_from_list(owner, list_slug, params.merge({:id => user_id}))
145
143
  end
146
144
 
147
145
  alias_method :__update_status, :update_status
@@ -8,24 +8,24 @@ class OAuthRubytter < Rubytter
8
8
  end
9
9
 
10
10
  def get(path, params = {})
11
- path += '.json'
11
+ path = path_prefix + path + '.json'
12
12
  param_str = to_param_str(params)
13
13
  path = path + '?' + param_str unless param_str.empty?
14
14
  parse_response(@access_token.get(path, @header))
15
15
  end
16
16
 
17
17
  def post(path, params = {})
18
- path += '.json'
18
+ path = path_prefix + path + '.json'
19
19
  parse_response(@access_token.post(path, params.stringify_keys, @header))
20
20
  end
21
21
 
22
22
  def put(path, params = {})
23
- path += '.json'
23
+ path = path_prefix + path + '.json'
24
24
  parse_response(@access_token.put(path, params.stringify_keys, @header))
25
25
  end
26
26
 
27
27
  def delete(path, params = {})
28
- path += '.json'
28
+ path = path_prefix + path + '.json'
29
29
  param_str = to_param_str(params)
30
30
  path = path + '?' + param_str unless param_str.empty?
31
31
  parse_response(@access_token.delete(path, @header))
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
- require File.dirname(__FILE__) + '/../spec_helper'
3
+ require 'spec_helper'
4
4
 
5
5
  class Rubytter::OAuth
6
6
  describe Rubytter::OAuth do
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
- require File.dirname(__FILE__) + '/spec_helper'
3
+ require 'spec_helper'
4
4
 
5
5
  class Rubytter
6
6
  describe Rubytter do
@@ -328,17 +328,17 @@ class Rubytter
328
328
 
329
329
  it 'should POST /:user/list to create list' do
330
330
  @rubytter.should_receive(:post).with("/test/lists", {:name=>"foo"})
331
- @rubytter.create_list('foo')
331
+ @rubytter.create_list('test', 'foo')
332
332
  end
333
333
 
334
334
  it 'should PUT /:user/list to update list' do
335
335
  @rubytter.should_receive(:put).with("/test/lists/foo", {})
336
- @rubytter.update_list('foo')
336
+ @rubytter.update_list('test', 'foo')
337
337
  end
338
338
 
339
339
  it 'should DELETE /:user/list to delete list' do
340
340
  @rubytter.should_receive(:delete).with("/test/lists/foo", {})
341
- @rubytter.delete_list('foo')
341
+ @rubytter.delete_list('test', 'foo')
342
342
  end
343
343
 
344
344
  it 'should GET lists for specified user' do
@@ -348,12 +348,12 @@ class Rubytter
348
348
 
349
349
  it 'should add member to list' do
350
350
  @rubytter.should_receive(:post).with("/test/foo/members", {:id=>"jugyo"})
351
- @rubytter.add_member_to_list('foo', 'jugyo')
351
+ @rubytter.add_member_to_list('test', 'foo', 'jugyo')
352
352
  end
353
353
 
354
354
  it 'should remove member to list' do
355
355
  @rubytter.should_receive(:delete).with("/test/foo/members", {:id=>"jugyo"})
356
- @rubytter.remove_member_from_list('foo', 'jugyo')
356
+ @rubytter.remove_member_from_list('test', 'foo', 'jugyo')
357
357
  end
358
358
 
359
359
  # TODO: You should write more specs for Lists API...
@@ -363,7 +363,7 @@ class Rubytter
363
363
  rubytter = OAuthRubytter.new(access_token)
364
364
  response = simple_mock(:body => '{}', :code => '200')
365
365
  access_token.should_receive(:post).with(
366
- "/statuses/update.json",
366
+ "/1/statuses/update.json",
367
367
  {'status' => 'test'},
368
368
  {"User-Agent"=>"Rubytter/#{Rubytter::VERSION} (http://github.com/jugyo/rubytter)"}
369
369
  ).and_return(response)
@@ -375,7 +375,7 @@ class Rubytter
375
375
  rubytter = OAuthRubytter.new(access_token)
376
376
  response = simple_mock(:body => '{}', :code => '200')
377
377
  access_token.should_receive(:get).with(
378
- '/statuses/friends_timeline.json',
378
+ '/1/statuses/friends_timeline.json',
379
379
  {"User-Agent"=>"Rubytter/#{Rubytter::VERSION} (http://github.com/jugyo/rubytter)"}
380
380
  ).and_return(response)
381
381
  rubytter.friends_timeline
@@ -386,7 +386,7 @@ class Rubytter
386
386
  rubytter = OAuthRubytter.new(access_token)
387
387
  response = simple_mock(:body => '{}', :code => '200')
388
388
  access_token.should_receive(:get).with(
389
- '/statuses/friends_timeline.json?page=2',
389
+ '/1/statuses/friends_timeline.json?page=2',
390
390
  {"User-Agent"=>"Rubytter/#{Rubytter::VERSION} (http://github.com/jugyo/rubytter)"}
391
391
  ).and_return(response)
392
392
  rubytter.friends_timeline(:page => 2)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 4
8
- - 1
9
- version: 1.4.1
8
+ - 2
9
+ version: 1.4.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - jugyo
@@ -14,13 +14,14 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-06 00:00:00 +09:00
17
+ date: 2011-01-19 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: json
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
@@ -35,6 +36,7 @@ dependencies:
35
36
  name: oauth
36
37
  prerelease: false
37
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
38
40
  requirements:
39
41
  - - ">="
40
42
  - !ruby/object:Gem::Version
@@ -49,6 +51,7 @@ dependencies:
49
51
  name: rspec
50
52
  prerelease: false
51
53
  requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
52
55
  requirements:
53
56
  - - ">="
54
57
  - !ruby/object:Gem::Version
@@ -97,11 +100,12 @@ homepage: http://github.com/jugyo/rubytter
97
100
  licenses: []
98
101
 
99
102
  post_install_message:
100
- rdoc_options:
101
- - --charset=UTF-8
103
+ rdoc_options: []
104
+
102
105
  require_paths:
103
106
  - lib
104
107
  required_ruby_version: !ruby/object:Gem::Requirement
108
+ none: false
105
109
  requirements:
106
110
  - - ">="
107
111
  - !ruby/object:Gem::Version
@@ -109,6 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
113
  - 0
110
114
  version: "0"
111
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
+ none: false
112
117
  requirements:
113
118
  - - ">="
114
119
  - !ruby/object:Gem::Version
@@ -118,14 +123,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
123
  requirements: []
119
124
 
120
125
  rubyforge_project: rubytter
121
- rubygems_version: 1.3.6
126
+ rubygems_version: 1.3.7
122
127
  signing_key:
123
128
  specification_version: 3
124
129
  summary: Simple twitter client.
125
130
  test_files:
126
- - spec/rubytter/oauth_spec.rb
127
- - spec/rubytter_spec.rb
128
- - spec/spec_helper.rb
129
131
  - examples/direct_message.rb
130
132
  - examples/favorite.rb
131
133
  - examples/follow.rb
@@ -139,3 +141,6 @@ test_files:
139
141
  - examples/use_oauth.rb
140
142
  - examples/use_xauth.rb
141
143
  - examples/user.rb
144
+ - spec/rubytter/oauth_spec.rb
145
+ - spec/rubytter_spec.rb
146
+ - spec/spec_helper.rb