Skip to content
Browse files

Composing source documentation

  • Loading branch information...
1 parent b8fbf91 commit 92dc00c627f9bdbd40e064ac849dea299208d2fa @kyledrake kyledrake committed Jan 8, 2012
View
1 .gitignore
@@ -1,2 +1,3 @@
Gemfile.lock
*.gem
+doc
View
1 .travis.yml
@@ -1,3 +1,4 @@
rvm:
- 1.9.2
+ - 1.9.3
- jruby
View
3 .yardopts
@@ -0,0 +1,3 @@
+--markup markdown
+-
+LICENSE.md
View
0 license.txt → LICENSE.md
File renamed without changes.
View
0 README.markdown → README.md
File renamed without changes.
View
1 geoloqi.gemspec
@@ -22,4 +22,5 @@ Gem::Specification.new do |s|
s.add_development_dependency 'minitest', '= 2.2.2'
s.add_development_dependency 'webmock', '= 1.6.4'
s.add_development_dependency 'hashie', '= 1.0.0'
+ s.add_development_dependency 'yard'
end
View
41 lib/geoloqi.rb
@@ -14,35 +14,76 @@ module Geoloqi
@@config = Config.new
class << self
+ # Which API version to use.
+ #
+ # @return [Fixnum]
def api_version
1
end
+ # API URL for the Geoloqi Platform.
+ #
+ # @return [String]
def api_url
'https://api.geoloqi.com'
end
+ # OAuth2 authorize URL for the Geoloqi Platform.
+ #
+ # @return [String]
def oauth_url
'https://geoloqi.com/oauth/authorize'
end
+ # Global config object accessor, which is used for Geoloqi.get/post. Geoloqi::Session inherits this config by default.
+ #
+ # @return [Geoloqi::Config]
+ # @example
+ # # Setup the OAuth2 id/secret and use Hashie::Mash for output.
+ # Geoloqi.config :client_id => 'CLIENT ID', :client_secret => 'CLIENT SECRET', :use_hashie_mash => true
def config(opts=nil)
return @@config if opts.nil?
@@config = Config.new opts
end
+ # Makes a one-time GET request to the Geoloqi API. You can retreive your access token from the Geoloqi Developers Site.
+ #
+ # @return [Hash]
+ # @example
+ # # Get your user profile
+ # Geoloqi.get 'YOUR_ACCESS_TOKEN', 'account/profile'
+ #
+ # # Get the last 5 locations
+ # Geoloqi.get 'YOUR_ACCESS_TOKEN', 'account/profile', :count => 5
def get(access_token, path, args={}, headers={})
run :get, access_token, path, args, headers
end
+ # Makes a one-time POST request to the Geoloqi API. You can retreive your access token from the Geoloqi Developers Site.
+ #
+ # @return [Hash] by default, [Hashie::Mash] if <tt>:use_hashie_mash</tt> is true in the config.
+ # @example
+ # # Create a new layer
+ # Geoloqi.post 'YOUR_ACCESS_TOKEN', 'layer/create', :name => 'Northeast Portland'
def post(access_token, path, args={}, headers={})
run :post, access_token, path, args, headers
end
+ # Makes a one-time request to the Geoloqi API. You can retreive your access token from the Geoloqi Developers Site.
+ #
+ # @return [Hash] by default, [Hashie::Mash] if <tt>:use_hashie_mash</tt> is true in the config.
+ # @example
+ # # Retrieve your profile
+ # Geoloqi.run :get, 'YOUR_ACCESS_TOKEN', 'account/profile'
def run(meth, access_token, path, args={}, headers={})
Session.new(:access_token => access_token).run meth, path, args, headers
end
+ # Returns the OAuth2 authorize url.
+ #
+ # @return [String]
+ # @example
+ # Geoloqi.authorize_url 'YOUR_CLIENT_ID'
def authorize_url(client_id=nil, redirect_uri=@@config.redirect_uri, opts={})
raise "client_id required to authorize url. Pass with Geoloqi.config" unless client_id
url = "#{oauth_url}?response_type=code&client_id=#{Rack::Utils.escape client_id}&redirect_uri=#{Rack::Utils.escape redirect_uri}"
View
3 lib/geoloqi/version.rb
@@ -1,4 +1,7 @@
module Geoloqi
+ # Returns the current version of the Geoloqi ruby gem.
+ #
+ # @return [String]
def self.version
'0.9.35'
end

0 comments on commit 92dc00c

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