geoloqi 0.9.38 → 0.9.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/geoloqi/session.rb +7 -6
- data/lib/geoloqi/version.rb +1 -1
- data/spec/geoloqi/session_spec.rb +4 -0
- metadata +3 -3
data/lib/geoloqi/session.rb
CHANGED
@@ -36,7 +36,7 @@ module Geoloqi
|
|
36
36
|
# geoloqi_session = Geoloqi::Session.new :config => {:client_id => 'CLIENT ID', :client_secret => 'CLIENT SECRET'}
|
37
37
|
def initialize(opts={})
|
38
38
|
opts[:config] = Geoloqi::Config.new opts[:config] if opts[:config].is_a? Hash
|
39
|
-
@config = opts[:config] || (Geoloqi.config || Geoloqi::Config.new)
|
39
|
+
@config = opts[:config] || (Geoloqi.config || Geoloqi::Config.new).dup
|
40
40
|
self.auth = opts[:auth] || {}
|
41
41
|
self.auth[:access_token] = opts[:access_token] if opts[:access_token]
|
42
42
|
|
@@ -55,9 +55,9 @@ module Geoloqi
|
|
55
55
|
def access_token
|
56
56
|
@auth[:access_token]
|
57
57
|
end
|
58
|
-
|
59
|
-
#
|
60
|
-
# This token is used in the same manner as the user access token, it simply allows the
|
58
|
+
|
59
|
+
# Retrieve the application access token for this session.
|
60
|
+
# This token is used in the same manner as the user access token, it simply allows the application to make
|
61
61
|
# requests on behalf of itself instead of a user within the app.
|
62
62
|
# It is strongly recommended that you keep this token private, and don't share it with
|
63
63
|
# clients.
|
@@ -127,7 +127,7 @@ module Geoloqi
|
|
127
127
|
end
|
128
128
|
|
129
129
|
# Makes a request to the Geoloqi API server.
|
130
|
-
#
|
130
|
+
#
|
131
131
|
# @return [Hash,Hashie::Mash]
|
132
132
|
# @example
|
133
133
|
# # Create a new layer
|
@@ -213,6 +213,7 @@ module Geoloqi
|
|
213
213
|
# @return [Hash] - The auth hash used to persist the session object.
|
214
214
|
# @see #renew_access_token!
|
215
215
|
# @see #get_auth
|
216
|
+
# @see #application_access_token
|
216
217
|
def establish(opts={})
|
217
218
|
require 'client_id and client_secret are required to get access token' unless @config.client_id? && @config.client_secret?
|
218
219
|
auth = post 'oauth/token', {:client_id => @config.client_id,
|
@@ -225,7 +226,7 @@ module Geoloqi
|
|
225
226
|
self.auth
|
226
227
|
end
|
227
228
|
|
228
|
-
# Renew the access token provided from Geoloqi using the stored refresh token. This method is automatically called by the session object
|
229
|
+
# Renew the access token provided from Geoloqi using the stored refresh token. This method is automatically called by the session object
|
229
230
|
# when it detects an expiration, so you shouldn't need to explicitly call it.
|
230
231
|
#
|
231
232
|
# @return [Hash] The auth hash used to persist the session object.
|
data/lib/geoloqi/version.rb
CHANGED
@@ -6,6 +6,10 @@ describe Geoloqi::Session do
|
|
6
6
|
@session = Geoloqi::Session.new
|
7
7
|
end
|
8
8
|
|
9
|
+
it 'should have unique copy of config object' do
|
10
|
+
@session.config.__id__.wont_equal Geoloqi.config.__id__
|
11
|
+
end
|
12
|
+
|
9
13
|
it 'should not find access token' do
|
10
14
|
@session.access_token?.must_equal false
|
11
15
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
8
|
+
- 39
|
9
|
+
version: 0.9.39
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kyle Drake
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-12 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|