Permalink
Browse files

Use autoload instead of require. General cleanup. Fix a typo.

  • Loading branch information...
1 parent e29e5e6 commit ad4549b4e27bd229ae6ad24bdc956a485272e894 James Cook committed Jul 27, 2011
View
@@ -0,0 +1,6 @@
+module LinkedIn
+ module Api
+ autoload :QueryMethods, "linked_in/api/query_methods"
+ autoload :UpdateMethods, "linked_in/api/update_methods"
+ end
+end
View
@@ -1,9 +1,3 @@
-require 'linked_in/helpers/request'
-require 'linked_in/helpers/authorization'
-require 'linked_in/api/query_methods'
-require 'linked_in/api/update_methods'
-require 'linked_in/search'
-
require 'cgi'
module LinkedIn
View
@@ -13,8 +13,8 @@ class RateLimitExceededError < LinkedInError; end
class UnauthorizedError < LinkedInError; end
class GeneralError < LinkedInError; end
- class UnavailableError < StandardError; end
- class InformLinkedInError < StandardError; end
- class NotFoundError < StandardError; end
+ class UnavailableError < StandardError; end
+ class InformLinkedInError < StandardError; end
+ class NotFoundError < StandardError; end
-end
+end
View
@@ -0,0 +1,6 @@
+module LinkedIn
+ module Helpers
+ autoload :Authorization, "linked_in/helpers/authorization"
+ autoload :Request, "linked_in/helpers/request"
+ end
+end
@@ -7,8 +7,8 @@ module Authorization
:request_token_path => "/uas/oauth/requestToken",
:access_token_path => "/uas/oauth/accessToken",
:authorize_path => "/uas/oauth/authorize",
- :api_host => 'https://api.linkedin.com',
- :auth_host => 'https://www.linkedin.com'
+ :api_host => "https://api.linkedin.com",
+ :auth_host => "https://www.linkedin.com"
}
def consumer
@@ -64,4 +64,4 @@ def full_oauth_url_for(url_type, host_type)
end
end
-end
+end
View
@@ -18,17 +18,17 @@ def search(options={})
def format_options_for_query(opts)
opts.inject({}) do |list, kv|
key, value = kv.first.to_s.gsub("_","-"), kv.last
- list[key] = sanatize_value(value)
+ list[key] = sanitize_value(value)
list
end
end
- def sanatize_value(value)
+ def sanitize_value(value)
value = value.join("+") if value.is_a?(Array)
value = value.gsub(" ", "+") if value.is_a?(String)
value
end
end
-end
+end
View
@@ -22,9 +22,11 @@ def configure
end
end
+ autoload :Api, "linked_in/api"
+ autoload :Client, "linked_in/client"
+ autoload :Mash, "linked_in/mash"
+ autoload :Errors, "linked_in/errors"
+ autoload :Helpers, "linked_in/helpers"
+ autoload :Search, "linked_in/search"
+ autoload :Version, "linked_in/version"
end
-
-require 'linked_in/mash'
-require 'linked_in/errors'
-require 'linked_in/client'
-require 'linked_in/version'

0 comments on commit ad4549b

Please sign in to comment.