Module: Geoloqi
- Defined in:
- lib/geoloqi.rb,
lib/geoloqi/batch.rb,
lib/geoloqi/error.rb,
lib/geoloqi/config.rb,
lib/geoloqi/session.rb,
lib/geoloqi/version.rb,
lib/geoloqi/response.rb
Defined Under Namespace
Classes: ApiError, ArgumentError, Batch, Config, Error, Response, Session
Constant Summary collapse
- SSL_CERT_FILE =
Location of the Bundle of CA Root Certificates.
File.join(File.dirname(__FILE__), 'geoloqi', 'data', 'ca-certificates.crt')
- @@config =
Location of the global Config object
Config.new
Class Method Summary collapse
-
.api_url ⇒ String
API URL for the Geoloqi Platform.
-
.api_version ⇒ Fixnum
Which API version to use.
-
.authorize_url(client_id = nil, redirect_uri = @@config.redirect_uri, opts = {}) ⇒ String
Returns the OAuth2 authorize url.
-
.config(opts = nil) ⇒ Geoloqi::Config
Global config object accessor, which is used for Geoloqi.get/post.
-
.get(access_token, path, args = {}, headers = {}) ⇒ Hash
Makes a one-time GET request to the Geoloqi API.
-
.oauth_url ⇒ String
OAuth2 authorize URL for the Geoloqi Platform.
-
.post(access_token, path, args = {}, headers = {}) ⇒ Hash
Makes a one-time POST request to the Geoloqi API.
-
.run(meth, access_token, path, args = {}, headers = {}) ⇒ Hash
Makes a one-time request to the Geoloqi API.
-
.version ⇒ String
Returns the current version of the Geoloqi ruby gem.
Class Method Details
.api_url ⇒ String
API URL for the Geoloqi Platform.
32 33 34 |
# File 'lib/geoloqi.rb', line 32 def api_url 'https://api.geoloqi.com' end |
.api_version ⇒ Fixnum
Which API version to use.
25 26 27 |
# File 'lib/geoloqi.rb', line 25 def api_version 1 end |
.authorize_url(client_id = nil, redirect_uri = @@config.redirect_uri, opts = {}) ⇒ String
Returns the OAuth2 authorize url.
92 93 94 95 96 97 |
# File 'lib/geoloqi.rb', line 92 def (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}" url += "&#{Rack::Utils.build_query opts}" unless opts.empty? url end |
.config(opts = nil) ⇒ Geoloqi::Config
Global config object accessor, which is used for Geoloqi.get/post. Geoloqi::Session inherits this config by default.
49 50 51 52 |
# File 'lib/geoloqi.rb', line 49 def config(opts=nil) return @@config if opts.nil? @@config = Config.new opts end |
.get(access_token, path, args = {}, headers = {}) ⇒ Hash
Makes a one-time GET request to the Geoloqi API. You can retreive your access token from the Geoloqi Developers Site.
63 64 65 |
# File 'lib/geoloqi.rb', line 63 def get(access_token, path, args={}, headers={}) run :get, access_token, path, args, headers end |
.oauth_url ⇒ String
OAuth2 authorize URL for the Geoloqi Platform.
39 40 41 |
# File 'lib/geoloqi.rb', line 39 def oauth_url 'https://geoloqi.com/oauth/authorize' end |
.post(access_token, path, args = {}, headers = {}) ⇒ Hash
Makes a one-time POST request to the Geoloqi API. You can retreive your access token from the Geoloqi Developers Site.
73 74 75 |
# File 'lib/geoloqi.rb', line 73 def post(access_token, path, args={}, headers={}) run :post, access_token, path, args, headers end |
.run(meth, access_token, path, args = {}, headers = {}) ⇒ Hash
Makes a one-time request to the Geoloqi API. You can retreive your access token from the Geoloqi Developers Site.
83 84 85 |
# File 'lib/geoloqi.rb', line 83 def run(meth, access_token, path, args={}, headers={}) Session.new(:access_token => access_token).run meth, path, args, headers end |
.version ⇒ String
Returns the current version of the Geoloqi ruby gem.
5 6 7 |
# File 'lib/geoloqi/version.rb', line 5 def self.version '0.9.44' end |