Skip to content

Commit f55471a

Browse files
committed
Update all endpoints to Twitter API v1.1
1 parent fc3a006 commit f55471a

22 files changed

+651
-651
lines changed

lib/twitter/api.rb

Lines changed: 219 additions & 219 deletions
Large diffs are not rendered by default.

spec/twitter/api/account_spec.rb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
describe "#rate_limit_status" do
1010
before do
11-
stub_get("/1/account/rate_limit_status.json").
11+
stub_get("/1.1/account/rate_limit_status.json").
1212
to_return(:body => fixture("rate_limit_status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1313
end
1414
it "requests the correct resource" do
1515
@client.rate_limit_status
16-
a_get("/1/account/rate_limit_status.json").
16+
a_get("/1.1/account/rate_limit_status.json").
1717
should have_been_made
1818
end
1919
it "returns the remaining number of API requests available to the requesting user before the API limit is reached" do
@@ -25,12 +25,12 @@
2525

2626
describe "#verify_credentials" do
2727
before do
28-
stub_get("/1/account/verify_credentials.json").
28+
stub_get("/1.1/account/verify_credentials.json").
2929
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3030
end
3131
it "requests the correct resource" do
3232
@client.verify_credentials
33-
a_get("/1/account/verify_credentials.json").
33+
a_get("/1.1/account/verify_credentials.json").
3434
should have_been_made
3535
end
3636
it "returns the requesting user" do
@@ -42,12 +42,12 @@
4242

4343
describe "#end_session" do
4444
before do
45-
stub_post("/1/account/end_session.json").
45+
stub_post("/1.1/account/end_session.json").
4646
to_return(:body => fixture("end_session.json"), :headers => {:content_type => "application/json; charset=utf-8"})
4747
end
4848
it "requests the correct resource" do
4949
@client.end_session
50-
a_post("/1/account/end_session.json").
50+
a_post("/1.1/account/end_session.json").
5151
should have_been_made
5252
end
5353
it "returns a null cookie" do
@@ -58,13 +58,13 @@
5858

5959
describe "#update_delivery_device" do
6060
before do
61-
stub_post("/1/account/update_delivery_device.json").
61+
stub_post("/1.1/account/update_delivery_device.json").
6262
with(:body => {:device => "sms"}).
6363
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
6464
end
6565
it "requests the correct resource" do
6666
@client.update_delivery_device("sms")
67-
a_post("/1/account/update_delivery_device.json").
67+
a_post("/1.1/account/update_delivery_device.json").
6868
with(:body => {:device => "sms"}).
6969
should have_been_made
7070
end
@@ -77,13 +77,13 @@
7777

7878
describe "#update_profile" do
7979
before do
80-
stub_post("/1/account/update_profile.json").
80+
stub_post("/1.1/account/update_profile.json").
8181
with(:body => {:url => "http://github.com/sferik/"}).
8282
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
8383
end
8484
it "requests the correct resource" do
8585
@client.update_profile(:url => "http://github.com/sferik/")
86-
a_post("/1/account/update_profile.json").
86+
a_post("/1.1/account/update_profile.json").
8787
with(:body => {:url => "http://github.com/sferik/"}).
8888
should have_been_made
8989
end
@@ -96,12 +96,12 @@
9696

9797
describe "#update_profile_background_image" do
9898
before do
99-
stub_post("/1/account/update_profile_background_image.json").
99+
stub_post("/1.1/account/update_profile_background_image.json").
100100
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
101101
end
102102
it "requests the correct resource" do
103103
@client.update_profile_background_image(fixture("we_concept_bg2.png"))
104-
a_post("/1/account/update_profile_background_image.json").
104+
a_post("/1.1/account/update_profile_background_image.json").
105105
should have_been_made
106106
end
107107
it "returns a user" do
@@ -113,13 +113,13 @@
113113

114114
describe "#update_profile_colors" do
115115
before do
116-
stub_post("/1/account/update_profile_colors.json").
116+
stub_post("/1.1/account/update_profile_colors.json").
117117
with(:body => {:profile_background_color => "000000"}).
118118
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
119119
end
120120
it "requests the correct resource" do
121121
@client.update_profile_colors(:profile_background_color => "000000")
122-
a_post("/1/account/update_profile_colors.json").
122+
a_post("/1.1/account/update_profile_colors.json").
123123
with(:body => {:profile_background_color => "000000"}).
124124
should have_been_made
125125
end
@@ -132,12 +132,12 @@
132132

133133
describe "#update_profile_image" do
134134
before do
135-
stub_post("/1/account/update_profile_image.json").
135+
stub_post("/1.1/account/update_profile_image.json").
136136
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
137137
end
138138
it "requests the correct resource" do
139139
@client.update_profile_image(fixture("me.jpeg"))
140-
a_post("/1/account/update_profile_image.json").
140+
a_post("/1.1/account/update_profile_image.json").
141141
should have_been_made
142142
end
143143
it "returns a user" do
@@ -149,15 +149,15 @@
149149

150150
describe "#settings" do
151151
before do
152-
stub_get("/1/account/settings.json").
152+
stub_get("/1.1/account/settings.json").
153153
to_return(:body => fixture("settings.json"), :headers => {:content_type => "application/json; charset=utf-8"})
154-
stub_post("/1/account/settings.json").
154+
stub_post("/1.1/account/settings.json").
155155
with(:body => {:trend_location_woeid => "23424803"}).
156156
to_return(:body => fixture("settings.json"), :headers => {:content_type => "application/json; charset=utf-8"})
157157
end
158158
it "requests the correct resource on GET" do
159159
@client.settings
160-
a_get("/1/account/settings.json").
160+
a_get("/1.1/account/settings.json").
161161
should have_been_made
162162
end
163163
it "returns settings" do
@@ -167,7 +167,7 @@
167167
end
168168
it "requests the correct resource on POST" do
169169
@client.settings(:trend_location_woeid => "23424803")
170-
a_post("/1/account/settings.json").
170+
a_post("/1.1/account/settings.json").
171171
with(:body => {:trend_location_woeid => "23424803"}).
172172
should have_been_made
173173
end

spec/twitter/api/blocks_spec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
describe "#blocking" do
1010
before do
11-
stub_get("/1/blocks/blocking.json").
11+
stub_get("/1.1/blocks/blocking.json").
1212
to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1313
end
1414
it "requests the correct resource" do
1515
@client.blocking
16-
a_get("/1/blocks/blocking.json").
16+
a_get("/1.1/blocks/blocking.json").
1717
should have_been_made
1818
end
1919
it "returns an array of user objects that the authenticating user is blocking" do
@@ -26,12 +26,12 @@
2626

2727
describe "#blocked_ids" do
2828
before do
29-
stub_get("/1/blocks/blocking/ids.json").
29+
stub_get("/1.1/blocks/blocking/ids.json").
3030
to_return(:body => fixture("ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3131
end
3232
it "requests the correct resource" do
3333
@client.blocked_ids
34-
a_get("/1/blocks/blocking/ids.json").
34+
a_get("/1.1/blocks/blocking/ids.json").
3535
should have_been_made
3636
end
3737
it "returns an array of numeric user IDs the authenticating user is blocking" do
@@ -43,16 +43,16 @@
4343

4444
describe "#block?" do
4545
before do
46-
stub_get("/1/blocks/exists.json").
46+
stub_get("/1.1/blocks/exists.json").
4747
with(:query => {:screen_name => "sferik"}).
4848
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
49-
stub_get("/1/blocks/exists.json").
49+
stub_get("/1.1/blocks/exists.json").
5050
with(:query => {:screen_name => "pengwynn"}).
5151
to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
5252
end
5353
it "requests the correct resource" do
5454
@client.block?("sferik")
55-
a_get("/1/blocks/exists.json").
55+
a_get("/1.1/blocks/exists.json").
5656
with(:query => {:screen_name => "sferik"}).
5757
should have_been_made
5858
end
@@ -68,13 +68,13 @@
6868

6969
describe "#block" do
7070
before do
71-
stub_post("/1/blocks/create.json").
71+
stub_post("/1.1/blocks/create.json").
7272
with(:body => {:screen_name => "sferik"}).
7373
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
7474
end
7575
it "requests the correct resource" do
7676
@client.block("sferik")
77-
a_post("/1/blocks/create.json").
77+
a_post("/1.1/blocks/create.json").
7878
should have_been_made
7979
end
8080
it "returns an array of blocked users" do
@@ -87,13 +87,13 @@
8787

8888
describe "#unblock" do
8989
before do
90-
stub_delete("/1/blocks/destroy.json").
90+
stub_delete("/1.1/blocks/destroy.json").
9191
with(:query => {:screen_name => "sferik"}).
9292
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
9393
end
9494
it "requests the correct resource" do
9595
@client.unblock("sferik")
96-
a_delete("/1/blocks/destroy.json").
96+
a_delete("/1.1/blocks/destroy.json").
9797
with(:query => {:screen_name => "sferik"}).
9898
should have_been_made
9999
end

spec/twitter/api/direct_messages_spec.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
describe "#direct_messages_received" do
1010
before do
11-
stub_get("/1/direct_messages.json").
11+
stub_get("/1.1/direct_messages.json").
1212
to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1313
end
1414
it "requests the correct resource" do
1515
@client.direct_messages_received
16-
a_get("/1/direct_messages.json").
16+
a_get("/1.1/direct_messages.json").
1717
should have_been_made
1818
end
1919
it "returns the 20 most recent direct messages sent to the authenticating user" do
@@ -26,12 +26,12 @@
2626

2727
describe "#direct_messages_sent" do
2828
before do
29-
stub_get("/1/direct_messages/sent.json").
29+
stub_get("/1.1/direct_messages/sent.json").
3030
to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3131
end
3232
it "requests the correct resource" do
3333
@client.direct_messages_sent
34-
a_get("/1/direct_messages/sent.json").
34+
a_get("/1.1/direct_messages/sent.json").
3535
should have_been_made
3636
end
3737
it "returns the 20 most recent direct messages sent by the authenticating user" do
@@ -44,12 +44,12 @@
4444

4545
describe "#direct_message_destroy" do
4646
before do
47-
stub_delete("/1/direct_messages/destroy/1825785544.json").
47+
stub_delete("/1.1/direct_messages/destroy/1825785544.json").
4848
to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
4949
end
5050
it "requests the correct resource" do
5151
@client.direct_message_destroy(1825785544)
52-
a_delete("/1/direct_messages/destroy/1825785544.json").
52+
a_delete("/1.1/direct_messages/destroy/1825785544.json").
5353
should have_been_made
5454
end
5555
it "returns an array of deleted messages" do
@@ -62,13 +62,13 @@
6262

6363
describe "#direct_message_create" do
6464
before do
65-
stub_post("/1/direct_messages/new.json").
65+
stub_post("/1.1/direct_messages/new.json").
6666
with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"}).
6767
to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
6868
end
6969
it "requests the correct resource" do
7070
@client.direct_message_create("pengwynn", "Creating a fixture for the Twitter gem")
71-
a_post("/1/direct_messages/new.json").
71+
a_post("/1.1/direct_messages/new.json").
7272
with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"}).
7373
should have_been_made
7474
end
@@ -81,12 +81,12 @@
8181

8282
describe "#direct_message" do
8383
before do
84-
stub_get("/1/direct_messages/show/1825786345.json").
84+
stub_get("/1.1/direct_messages/show/1825786345.json").
8585
to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
8686
end
8787
it "requests the correct resource" do
8888
@client.direct_message(1825786345)
89-
a_get("/1/direct_messages/show/1825786345.json").
89+
a_get("/1.1/direct_messages/show/1825786345.json").
9090
should have_been_made
9191
end
9292
it "returns the specified direct message" do
@@ -99,12 +99,12 @@
9999
describe "#direct_messages" do
100100
context "with ids passed" do
101101
before do
102-
stub_get("/1/direct_messages/show/1825786345.json").
102+
stub_get("/1.1/direct_messages/show/1825786345.json").
103103
to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
104104
end
105105
it "requests the correct resource" do
106106
@client.direct_messages(1825786345)
107-
a_get("/1/direct_messages/show/1825786345.json").
107+
a_get("/1.1/direct_messages/show/1825786345.json").
108108
should have_been_made
109109
end
110110
it "returns an array of direct messages" do
@@ -116,12 +116,12 @@
116116
end
117117
context "without ids passed" do
118118
before do
119-
stub_get("/1/direct_messages.json").
119+
stub_get("/1.1/direct_messages.json").
120120
to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
121121
end
122122
it "requests the correct resource" do
123123
@client.direct_messages
124-
a_get("/1/direct_messages.json").
124+
a_get("/1.1/direct_messages.json").
125125
should have_been_made
126126
end
127127
it "returns the 20 most recent direct messages sent to the authenticating user" do

0 commit comments

Comments
 (0)