Skip to content
This repository
Browse code

Hacks for Ruby 1.8 compatibility

  • Loading branch information...
commit 88c5a0513d1b58a1d4ae1a1e3deeb012c9d19547 1 parent 22af0c1
Erik Michaels-Ober authored
24  lib/twitter/api/account.rb
@@ -7,17 +7,19 @@ module API
7 7
     module Account
8 8
 
9 9
       def self.included(klass)
10  
-        klass.class_variable_get(:@@rate_limited).merge!(
11  
-          :rate_limit_status => false,
12  
-          :verify_credentials => true,
13  
-          :current_user => true,
14  
-          :end_session => false,
15  
-          :update_delivery_device => false,
16  
-          :update_profile => false,
17  
-          :update_profile_background_image => false,
18  
-          :update_profile_colors => false,
19  
-          :update_profile_image => false,
20  
-          :settings => true,
  10
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  11
+          {
  12
+            :rate_limit_status => false,
  13
+            :verify_credentials => true,
  14
+            :current_user => true,
  15
+            :end_session => false,
  16
+            :update_delivery_device => false,
  17
+            :update_profile => false,
  18
+            :update_profile_background_image => false,
  19
+            :update_profile_colors => false,
  20
+            :update_profile_image => false,
  21
+            :settings => true,
  22
+          }
21 23
         )
22 24
       end
23 25
 
8  lib/twitter/api/activity.rb
@@ -7,9 +7,11 @@ module Activity
7 7
       include Twitter::API::Utils
8 8
 
9 9
       def self.included(klass)
10  
-        klass.class_variable_get(:@@rate_limited).merge!(
11  
-          :activity_about_me => true,
12  
-          :activity_by_friends => true,
  10
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  11
+          {
  12
+            :activity_about_me => true,
  13
+            :activity_by_friends => true,
  14
+          }
13 15
         )
14 16
       end
15 17
 
14  lib/twitter/api/blocks.rb
@@ -7,12 +7,14 @@ module Blocks
7 7
       include Twitter::API::Utils
8 8
 
9 9
       def self.included(klass)
10  
-        klass.class_variable_get(:@@rate_limited).merge!(
11  
-          :blocking => true,
12  
-          :blocked_ids => true,
13  
-          :block? => true,
14  
-          :block => true,
15  
-          :unblock => false,
  10
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  11
+          {
  12
+            :blocking => true,
  13
+            :blocked_ids => true,
  14
+            :block? => true,
  15
+            :block => true,
  16
+            :unblock => false,
  17
+          }
16 18
         )
17 19
       end
18 20
 
20  lib/twitter/api/direct_messages.rb
@@ -10,15 +10,17 @@ module DirectMessages
10 10
       include Twitter::API::Utils
11 11
 
12 12
       def self.included(klass)
13  
-        klass.class_variable_get(:@@rate_limited).merge!(
14  
-          :direct_messages_received => true,
15  
-          :direct_messages_sent => true,
16  
-          :direct_message_destroy => false,
17  
-          :direct_message_create => false,
18  
-          :d => false,
19  
-          :m => false,
20  
-          :direct_message => true,
21  
-          :direct_messages => true,
  13
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  14
+          {
  15
+            :direct_messages_received => true,
  16
+            :direct_messages_sent => true,
  17
+            :direct_message_destroy => false,
  18
+            :direct_message_create => false,
  19
+            :d => false,
  20
+            :m => false,
  21
+            :direct_message => true,
  22
+            :direct_messages => true,
  23
+          }
22 24
         )
23 25
       end
24 26
 
42  lib/twitter/api/friendships.rb
@@ -12,26 +12,28 @@ module Friendships
12 12
       include Twitter::API::Utils
13 13
 
14 14
       def self.included(klass)
15  
-        klass.class_variable_get(:@@rate_limited).merge!(
16  
-          :follower_ids => true,
17  
-          :friend_ids => true,
18  
-          :friendship? => true,
19  
-          :friendships_incoming => true,
20  
-          :friendships_outgoing => true,
21  
-          :friendship => true,
22  
-          :friendship_show => true,
23  
-          :relationship => true,
24  
-          :follow => false,
25  
-          :friendship_create => false,
26  
-          :follow! => false,
27  
-          :friendship_create! => false,
28  
-          :unfollow => false,
29  
-          :friendship_destroy => false,
30  
-          :friendships => true,
31  
-          :friendship_update => true,
32  
-          :no_retweet_ids => true,
33  
-          :accept => false,
34  
-          :deny => false,
  15
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  16
+          {
  17
+            :follower_ids => true,
  18
+            :friend_ids => true,
  19
+            :friendship? => true,
  20
+            :friendships_incoming => true,
  21
+            :friendships_outgoing => true,
  22
+            :friendship => true,
  23
+            :friendship_show => true,
  24
+            :relationship => true,
  25
+            :follow => false,
  26
+            :friendship_create => false,
  27
+            :follow! => false,
  28
+            :friendship_create! => false,
  29
+            :unfollow => false,
  30
+            :friendship_destroy => false,
  31
+            :friendships => true,
  32
+            :friendship_update => true,
  33
+            :no_retweet_ids => true,
  34
+            :accept => false,
  35
+            :deny => false,
  36
+          }
35 37
         )
36 38
       end
37 39
 
16  lib/twitter/api/geo.rb
@@ -7,13 +7,15 @@ module Geo
7 7
       include Twitter::API::Utils
8 8
 
9 9
       def self.included(klass)
10  
-        klass.class_variable_get(:@@rate_limited).merge!(
11  
-          :places_nearby => true,
12  
-          :geo_search => true,
13  
-          :places_similar => true,
14  
-          :reverse_geocode => true,
15  
-          :place => true,
16  
-          :place_create => true,
  10
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  11
+          {
  12
+            :places_nearby => true,
  13
+            :geo_search => true,
  14
+            :places_similar => true,
  15
+            :reverse_geocode => true,
  16
+            :place => true,
  17
+            :place_create => true,
  18
+          }
17 19
         )
18 20
       end
19 21
 
8  lib/twitter/api/help.rb
@@ -8,9 +8,11 @@ module Help
8 8
       include Twitter::API::Utils
9 9
 
10 10
       def self.included(klass)
11  
-        klass.class_variable_get(:@@rate_limited).merge!(
12  
-          :configuration => true,
13  
-          :languages => true,
  11
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  12
+          {
  13
+            :configuration => true,
  14
+            :languages => true,
  15
+          }
14 16
         )
15 17
       end
16 18
 
8  lib/twitter/api/legal.rb
@@ -3,9 +3,11 @@ module API
42  lib/twitter/api/lists.rb
@@ -12,26 +12,28 @@ module Lists
12 12
       MAX_USERS_PER_REQUEST = 100
13 13
 
14 14
       def self.included(klass)
15  
-        klass.class_variable_get(:@@rate_limited).merge!(
16  
-          :lists_subscribed_to => true,
17  
-          :list_timeline => true,
18  
-          :list_remove_member => false,
19  
-          :memberships => true,
20  
-          :list_subscribers => true,
21  
-          :subscriptions => true,
22  
-          :list_subscribe => false,
23  
-          :list_subscriber? => true,
24  
-          :list_unsubscribe => false,
25  
-          :list_add_members => false,
26  
-          :list_remove_members => false,
27  
-          :list_member? => true,
28  
-          :list_members => true,
29  
-          :list_add_member => false,
30  
-          :list_destroy => false,
31  
-          :list_update => false,
32  
-          :list_create => false,
33  
-          :lists => true,
34  
-          :list => true,
  15
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  16
+          {
  17
+            :lists_subscribed_to => true,
  18
+            :list_timeline => true,
  19
+            :list_remove_member => false,
  20
+            :memberships => true,
  21
+            :list_subscribers => true,
  22
+            :subscriptions => true,
  23
+            :list_subscribe => false,
  24
+            :list_subscriber? => true,
  25
+            :list_unsubscribe => false,
  26
+            :list_add_members => false,
  27
+            :list_remove_members => false,
  28
+            :list_member? => true,
  29
+            :list_members => true,
  30
+            :list_add_member => false,
  31
+            :list_destroy => false,
  32
+            :list_update => false,
  33
+            :list_create => false,
  34
+            :lists => true,
  35
+            :list => true,
  36
+          }
35 37
         )
36 38
       end
37 39
 
8  lib/twitter/api/notifications.rb
@@ -6,9 +6,11 @@ module Notifications
6 6
       include Twitter::API::Utils
7 7
 
8 8
       def self.included(klass)
9  
-        klass.class_variable_get(:@@rate_limited).merge!(
10  
-          :enable_notifications => false,
11  
-          :disable_notifications => false,
  9
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  10
+          {
  11
+            :enable_notifications => false,
  12
+            :disable_notifications => false,
  13
+          }
12 14
         )
13 15
       end
14 16
 
6  lib/twitter/api/report_spam.rb
@@ -6,8 +6,10 @@ module ReportSpam
6 6
       include Twitter::API::Utils
7 7
 
8 8
       def self.included(klass)
9  
-        klass.class_variable_get(:@@rate_limited).merge!(
10  
-          :report_spam => true,
  9
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  10
+          {
  11
+            :report_spam => true,
  12
+          }
11 13
         )
12 14
       end
13 15
 
12  lib/twitter/api/saved_searches.rb
@@ -9,11 +9,13 @@ module SavedSearches
9 9
       include Twitter::API::Utils
10 10
 
11 11
       def self.included(klass)
12  
-        klass.class_variable_get(:@@rate_limited).merge!(
13  
-          :saved_searches => true,
14  
-          :saved_search => true,
15  
-          :saved_search_create => false,
16  
-          :saved_search_destroy => false,
  12
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  13
+          {
  14
+            :saved_searches => true,
  15
+            :saved_search => true,
  16
+            :saved_search_create => false,
  17
+            :saved_search_destroy => false,
  18
+          }
17 19
         )
18 20
       end
19 21
 
8  lib/twitter/api/search.rb
@@ -7,9 +7,11 @@ module Search
7 7
       include Twitter::API::Utils
8 8
 
9 9
       def self.included(klass)
10  
-        klass.class_variable_get(:@@rate_limited).merge!(
11  
-          :search => true,
12  
-          :phoenix_search => true,
  10
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  11
+          {
  12
+            :search => true,
  13
+            :phoenix_search => true,
  14
+          }
13 15
         )
14 16
       end
15 17
 
58  lib/twitter/api/statuses.rb
@@ -10,34 +10,36 @@ module Statuses
10 10
       include Twitter::API::Utils
11 11
 
12 12
       def self.included(klass)
13  
-        klass.class_variable_get(:@@rate_limited).merge!(
14  
-          :favorites => true,
15  
-          :favorite => false,
16  
-          :fav => false,
17  
-          :fave => false,
18  
-          :favorite_create => false,
19  
-          :unfavorite => false,
20  
-          :favorite_destroy => false,
21  
-          :home_timeline => true,
22  
-          :mentions => true,
23  
-          :retweeted_by => true,
24  
-          :retweeted_to => true,
25  
-          :retweets_of_me => true,
26  
-          :user_timeline => true,
27  
-          :media_timeline => true,
28  
-          :network_timeline => true,
29  
-          :retweeters_of => true,
30  
-          :retweets => true,
31  
-          :status => true,
32  
-          :statuses => true,
33  
-          :status_activity => true,
34  
-          :statuses_activity => true,
35  
-          :oembed => true,
36  
-          :oembeds => true,
37  
-          :status_destroy => false,
38  
-          :retweet => true,
39  
-          :update => false,
40  
-          :update_with_media => false,
  13
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  14
+          {
  15
+            :favorites => true,
  16
+            :favorite => false,
  17
+            :fav => false,
  18
+            :fave => false,
  19
+            :favorite_create => false,
  20
+            :unfavorite => false,
  21
+            :favorite_destroy => false,
  22
+            :home_timeline => true,
  23
+            :mentions => true,
  24
+            :retweeted_by => true,
  25
+            :retweeted_to => true,
  26
+            :retweets_of_me => true,
  27
+            :user_timeline => true,
  28
+            :media_timeline => true,
  29
+            :network_timeline => true,
  30
+            :retweeters_of => true,
  31
+            :retweets => true,
  32
+            :status => true,
  33
+            :statuses => true,
  34
+            :status_activity => true,
  35
+            :statuses_activity => true,
  36
+            :oembed => true,
  37
+            :oembeds => true,
  38
+            :status_destroy => false,
  39
+            :retweet => true,
  40
+            :update => false,
  41
+            :update_with_media => false,
  42
+          }
41 43
         )
42 44
       end
43 45
 
14  lib/twitter/api/trends.rb
@@ -8,12 +8,14 @@ module Trends
24  lib/twitter/api/users.rb
@@ -13,17 +13,19 @@ module Users
13 13
       MAX_USERS_PER_REQUEST = 100
14 14
 
15 15
       def self.included(klass)
16  
-        klass.class_variable_get(:@@rate_limited).merge!(
17  
-          :suggestions => true,
18  
-          :suggest_users => true,
19  
-          :users => true,
20  
-          :user_search => true,
21  
-          :user => true,
22  
-          :user? => true,
23  
-          :contributees => true,
24  
-          :contributors => true,
25  
-          :recommendations => true,
26  
-          :following_followers_of => true,
  16
+        klass.send(:class_variable_get, :@@rate_limited).merge!(
  17
+          {
  18
+            :suggestions => true,
  19
+            :suggest_users => true,
  20
+            :users => true,
  21
+            :user_search => true,
  22
+            :user => true,
  23
+            :user? => true,
  24
+            :contributees => true,
  25
+            :contributors => true,
  26
+            :recommendations => true,
  27
+            :following_followers_of => true,
  28
+          }
27 29
         )
28 30
       end
29 31
 

0 notes on commit 88c5a05

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