Skip to content

Commit

Permalink
Hacks for Ruby 1.8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Jul 21, 2012
1 parent 22af0c1 commit 88c5a05
Show file tree
Hide file tree
Showing 16 changed files with 172 additions and 140 deletions.
24 changes: 13 additions & 11 deletions lib/twitter/api/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ module API
module Account

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:rate_limit_status => false,
:verify_credentials => true,
:current_user => true,
:end_session => false,
:update_delivery_device => false,
:update_profile => false,
:update_profile_background_image => false,
:update_profile_colors => false,
:update_profile_image => false,
:settings => true,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:rate_limit_status => false,
:verify_credentials => true,
:current_user => true,
:end_session => false,
:update_delivery_device => false,
:update_profile => false,
:update_profile_background_image => false,
:update_profile_colors => false,
:update_profile_image => false,
:settings => true,
}
)
end

Expand Down
8 changes: 5 additions & 3 deletions lib/twitter/api/activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ module Activity
include Twitter::API::Utils

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:activity_about_me => true,
:activity_by_friends => true,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:activity_about_me => true,
:activity_by_friends => true,
}
)
end

Expand Down
14 changes: 8 additions & 6 deletions lib/twitter/api/blocks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ module Blocks
include Twitter::API::Utils

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:blocking => true,
:blocked_ids => true,
:block? => true,
:block => true,
:unblock => false,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:blocking => true,
:blocked_ids => true,
:block? => true,
:block => true,
:unblock => false,
}
)
end

Expand Down
20 changes: 11 additions & 9 deletions lib/twitter/api/direct_messages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ module DirectMessages
include Twitter::API::Utils

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:direct_messages_received => true,
:direct_messages_sent => true,
:direct_message_destroy => false,
:direct_message_create => false,
:d => false,
:m => false,
:direct_message => true,
:direct_messages => true,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:direct_messages_received => true,
:direct_messages_sent => true,
:direct_message_destroy => false,
:direct_message_create => false,
:d => false,
:m => false,
:direct_message => true,
:direct_messages => true,
}
)
end

Expand Down
42 changes: 22 additions & 20 deletions lib/twitter/api/friendships.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,28 @@ module Friendships
include Twitter::API::Utils

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:follower_ids => true,
:friend_ids => true,
:friendship? => true,
:friendships_incoming => true,
:friendships_outgoing => true,
:friendship => true,
:friendship_show => true,
:relationship => true,
:follow => false,
:friendship_create => false,
:follow! => false,
:friendship_create! => false,
:unfollow => false,
:friendship_destroy => false,
:friendships => true,
:friendship_update => true,
:no_retweet_ids => true,
:accept => false,
:deny => false,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:follower_ids => true,
:friend_ids => true,
:friendship? => true,
:friendships_incoming => true,
:friendships_outgoing => true,
:friendship => true,
:friendship_show => true,
:relationship => true,
:follow => false,
:friendship_create => false,
:follow! => false,
:friendship_create! => false,
:unfollow => false,
:friendship_destroy => false,
:friendships => true,
:friendship_update => true,
:no_retweet_ids => true,
:accept => false,
:deny => false,
}
)
end

Expand Down
16 changes: 9 additions & 7 deletions lib/twitter/api/geo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ module Geo
include Twitter::API::Utils

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:places_nearby => true,
:geo_search => true,
:places_similar => true,
:reverse_geocode => true,
:place => true,
:place_create => true,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:places_nearby => true,
:geo_search => true,
:places_similar => true,
:reverse_geocode => true,
:place => true,
:place_create => true,
}
)
end

Expand Down
8 changes: 5 additions & 3 deletions lib/twitter/api/help.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ module Help
include Twitter::API::Utils

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:configuration => true,
:languages => true,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:configuration => true,
:languages => true,
}
)
end

Expand Down
8 changes: 5 additions & 3 deletions lib/twitter/api/legal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ module API
module Legal

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:privacy => true,
:tos => true,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:privacy => true,
:tos => true,
}
)
end

Expand Down
42 changes: 22 additions & 20 deletions lib/twitter/api/lists.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,28 @@ module Lists
MAX_USERS_PER_REQUEST = 100

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:lists_subscribed_to => true,
:list_timeline => true,
:list_remove_member => false,
:memberships => true,
:list_subscribers => true,
:subscriptions => true,
:list_subscribe => false,
:list_subscriber? => true,
:list_unsubscribe => false,
:list_add_members => false,
:list_remove_members => false,
:list_member? => true,
:list_members => true,
:list_add_member => false,
:list_destroy => false,
:list_update => false,
:list_create => false,
:lists => true,
:list => true,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:lists_subscribed_to => true,
:list_timeline => true,
:list_remove_member => false,
:memberships => true,
:list_subscribers => true,
:subscriptions => true,
:list_subscribe => false,
:list_subscriber? => true,
:list_unsubscribe => false,
:list_add_members => false,
:list_remove_members => false,
:list_member? => true,
:list_members => true,
:list_add_member => false,
:list_destroy => false,
:list_update => false,
:list_create => false,
:lists => true,
:list => true,
}
)
end

Expand Down
8 changes: 5 additions & 3 deletions lib/twitter/api/notifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ module Notifications
include Twitter::API::Utils

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:enable_notifications => false,
:disable_notifications => false,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:enable_notifications => false,
:disable_notifications => false,
}
)
end

Expand Down
6 changes: 4 additions & 2 deletions lib/twitter/api/report_spam.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ module ReportSpam
include Twitter::API::Utils

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:report_spam => true,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:report_spam => true,
}
)
end

Expand Down
12 changes: 7 additions & 5 deletions lib/twitter/api/saved_searches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ module SavedSearches
include Twitter::API::Utils

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:saved_searches => true,
:saved_search => true,
:saved_search_create => false,
:saved_search_destroy => false,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:saved_searches => true,
:saved_search => true,
:saved_search_create => false,
:saved_search_destroy => false,
}
)
end

Expand Down
8 changes: 5 additions & 3 deletions lib/twitter/api/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ module Search
include Twitter::API::Utils

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:search => true,
:phoenix_search => true,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:search => true,
:phoenix_search => true,
}
)
end

Expand Down
58 changes: 30 additions & 28 deletions lib/twitter/api/statuses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,36 @@ module Statuses
include Twitter::API::Utils

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:favorites => true,
:favorite => false,
:fav => false,
:fave => false,
:favorite_create => false,
:unfavorite => false,
:favorite_destroy => false,
:home_timeline => true,
:mentions => true,
:retweeted_by => true,
:retweeted_to => true,
:retweets_of_me => true,
:user_timeline => true,
:media_timeline => true,
:network_timeline => true,
:retweeters_of => true,
:retweets => true,
:status => true,
:statuses => true,
:status_activity => true,
:statuses_activity => true,
:oembed => true,
:oembeds => true,
:status_destroy => false,
:retweet => true,
:update => false,
:update_with_media => false,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:favorites => true,
:favorite => false,
:fav => false,
:fave => false,
:favorite_create => false,
:unfavorite => false,
:favorite_destroy => false,
:home_timeline => true,
:mentions => true,
:retweeted_by => true,
:retweeted_to => true,
:retweets_of_me => true,
:user_timeline => true,
:media_timeline => true,
:network_timeline => true,
:retweeters_of => true,
:retweets => true,
:status => true,
:statuses => true,
:status_activity => true,
:statuses_activity => true,
:oembed => true,
:oembeds => true,
:status_destroy => false,
:retweet => true,
:update => false,
:update_with_media => false,
}
)
end

Expand Down
14 changes: 8 additions & 6 deletions lib/twitter/api/trends.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ module Trends
include Twitter::API::Utils

def self.included(klass)
klass.class_variable_get(:@@rate_limited).merge!(
:local_trends => true,
:trends => true,
:trend_locations => true,
:trends_daily => true,
:trends_weekly => true,
klass.send(:class_variable_get, :@@rate_limited).merge!(
{
:local_trends => true,
:trends => true,
:trend_locations => true,
:trends_daily => true,
:trends_weekly => true,
}
)
end

Expand Down
Loading

0 comments on commit 88c5a05

Please sign in to comment.