Skip to content
This repository
Browse code

Remove Twitter::API#rate_limited?

  • Loading branch information...
commit b2ec0107bc1a2a73bd6b004348f1e6413822845c 1 parent e179ab6
Erik Michaels-Ober authored
2  README.md
Source Rendered
@@ -273,7 +273,7 @@ Here are some fun facts about the 3.0 release:
273 273
274 274 * The entire library is implemented in just 2,000 lines of code
275 275 * With over 5,000 lines of specs, the spec-to-code ratio is over 2.5:1
276   -* The spec suite contains 652 examples and runs in under 2 seconds on a MacBook
  276 +* The spec suite contains 649 examples and runs in under 2 seconds on a MacBook
277 277 * This project has 100% C0 code coverage (the tests execute every line of
278 278 source code at least once)
279 279 * At the time of release, this library is comprehensive: you can request all
144 lib/twitter/api.rb
@@ -28,150 +28,6 @@ module API
28 28 DEFAULT_TWEETS_PER_REQUEST = 20
29 29 MAX_USERS_PER_REQUEST = 100
30 30 MAX_TWEETS_PER_REQUEST = 200
31   - METHOD_RATE_LIMITED = {
32   - :accept => false,
33   - :activity_about_me => true,
34   - :activity_by_friends => true,
35   - :block => true,
36   - :block? => true,
37   - :blocked_ids => true,
38   - :blocking => true,
39   - :configuration => true,
40   - :contributees => true,
41   - :contributors => true,
42   - :current_user => true,
43   - :d => false,
44   - :deny => false,
45   - :direct_message => true,
46   - :direct_message_create => false,
47   - :direct_message_destroy => false,
48   - :direct_messages => true,
49   - :direct_messages_received => true,
50   - :direct_messages_sent => true,
51   - :fav => false,
52   - :fave => false,
53   - :favorite => false,
54   - :favorite_create => false,
55   - :favorite_destroy => false,
56   - :favorites => true,
57   - :follow => false,
58   - :follow! => false,
59   - :follower_ids => true,
60   - :following_followers_of => true,
61   - :friend_ids => true,
62   - :friendship => true,
63   - :friendship? => true,
64   - :friendship_create => false,
65   - :friendship_create! => false,
66   - :friendship_destroy => false,
67   - :friendship_show => true,
68   - :friendship_update => false,
69   - :friendships => true,
70   - :friendships_incoming => true,
71   - :friendships_outgoing => true,
72   - :geo_search => true,
73   - :home_timeline => true,
74   - :initialize => false,
75   - :languages => true,
76   - :list => true,
77   - :list_add_member => false,
78   - :list_add_members => false,
79   - :list_create => false,
80   - :list_destroy => false,
81   - :list_member? => true,
82   - :list_members => true,
83   - :list_remove_member => false,
84   - :list_remove_members => false,
85   - :list_subscribe => false,
86   - :list_subscriber? => true,
87   - :list_subscribers => true,
88   - :list_timeline => true,
89   - :list_unsubscribe => false,
90   - :list_update => false,
91   - :lists => true,
92   - :lists_subscribed_to => true,
93   - :local_trends => true,
94   - :m => false,
95   - :media_timeline => true,
96   - :memberships => true,
97   - :mentions => true,
98   - :mentions_timeline => true,
99   - :network_timeline => true,
100   - :oembed => true,
101   - :oembeds => true,
102   - :phoenix_search => true,
103   - :place => true,
104   - :place_create => true,
105   - :places_nearby => true,
106   - :places_similar => true,
107   - :privacy => true,
108   - :rate_limit_status => false,
109   - :rate_limited? => false,
110   - :related_results => true,
111   - :related_statuses => true,
112   - :related_tweets => true,
113   - :recommendations => true,
114   - :relationship => true,
115   - :report_spam => true,
116   - :retweet => true,
117   - :retweeted_by => true,
118   - :retweeted_by_me => true,
119   - :retweeted_by_user => true,
120   - :retweeted_to_me => true,
121   - :retweeters_of => true,
122   - :retweets => true,
123   - :retweets_of_me => true,
124   - :reverse_geocode => true,
125   - :saved_search => true,
126   - :saved_search_create => false,
127   - :saved_search_destroy => false,
128   - :saved_searches => true,
129   - :search => true,
130   - :settings => true,
131   - :status => true,
132   - :status_activity => true,
133   - :status_destroy => false,
134   - :statuses => true,
135   - :statuses_activity => true,
136   - :subscriptions => true,
137   - :suggest_users => true,
138   - :suggestions => true,
139   - :tos => true,
140   - :trend_locations => true,
141   - :trends => true,
142   - :trends_available => true,
143   - :trends_closest => true,
144   - :trends_place => true,
145   - :tweet_activity => true,
146   - :tweet_destroy => false,
147   - :unblock => false,
148   - :unfavorite => false,
149   - :unfollow => false,
150   - :update => false,
151   - :update_delivery_device => false,
152   - :update_profile => false,
153   - :update_profile_background_image => false,
154   - :update_profile_colors => false,
155   - :update_profile_image => false,
156   - :update_with_media => false,
157   - :user => true,
158   - :user? => true,
159   - :user_search => true,
160   - :user_timeline => true,
161   - :users => true,
162   - :verify_credentials => true,
163   - }
164   -
165   - # Check whether a method is rate limited
166   - #
167   - # @raise [ArgumentError] Error raised when supplied argument is not a key in the METHOD_RATE_LIMITED hash.
168   - # @return [Boolean]
169   - # @param method_name [Symbol]
170   - def rate_limited?(method_name)
171   - method_rate_limited = METHOD_RATE_LIMITED[method_name.to_sym]
172   - raise ArgumentError.new("no method `#{method_name}' for #{self.class}") if method_rate_limited.nil?
173   - method_rate_limited
174   - end
175 31
176 32 # Returns the remaining number of API requests available to the requesting user
177 33 #
14 spec/twitter/client_spec.rb
@@ -90,20 +90,6 @@
90 90 end
91 91 end
92 92
93   - describe "#rate_limited?" do
94   - it "returns true for rate limited methods" do
95   - subject.rate_limited?(:user).should be_true
96   - end
97   - it "returns false for rate limited methods" do
98   - subject.rate_limited?(:rate_limit_status).should be_false
99   - end
100   - it "raises an ArgumentError for non-existant methods" do
101   - lambda do
102   - subject.rate_limited?(:foo)
103   - end.should raise_error(ArgumentError, "no method `foo' for Twitter::Client")
104   - end
105   - end
106   -
107 93 describe "#delete" do
108 94 before do
109 95 stub_delete("/custom/delete").

0 comments on commit b2ec010

Please sign in to comment.
Something went wrong with that request. Please try again.