arcgis_vrps 0.0.4.0 → 0.0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arcgis_vrps.rb +3 -6
- data/lib/arcgis_vrps/auth.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e8ee6d21dd34dde5eb5cf3994c5b363b6086ffd
|
4
|
+
data.tar.gz: 466c0874b64d914bfeb65e8923048f45bf8cf424
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4de0973a24fc75e6dc0e01aa3f217a65e22ac64b1480cb4794ebead94d4c1e3934a142892f672796a1f96447ad8b0799479e50fe93997a8e408c5bf3e017ef9c
|
7
|
+
data.tar.gz: 5f0c7fb187f9d9d4427b5aedc2963e41504ed535109ce34a1f7f2658af7d70de3ab057b7721b9ea3c551d89e874e1fb954c6e5c8764f0306acafec7613a70425
|
data/lib/arcgis_vrps.rb
CHANGED
@@ -30,14 +30,11 @@ class Arcgis_Vrps
|
|
30
30
|
|
31
31
|
def initialize(client_id, client_secret)
|
32
32
|
auth = Auth.new(client_id, client_secret)
|
33
|
-
puts
|
34
|
-
puts client_id +" --- " +client_secret
|
35
|
-
puts
|
36
33
|
@token = auth.generateToken
|
37
34
|
|
38
|
-
puts
|
39
|
-
puts "Token generated #{@token}"
|
40
|
-
puts
|
35
|
+
# puts
|
36
|
+
# puts "Token generated #{@token}"
|
37
|
+
# puts
|
41
38
|
|
42
39
|
end
|
43
40
|
|
data/lib/arcgis_vrps/auth.rb
CHANGED
@@ -2,6 +2,7 @@ require 'json'
|
|
2
2
|
require 'net/http'
|
3
3
|
|
4
4
|
class Auth
|
5
|
+
@token = ""
|
5
6
|
def initialize(client_id, client_secret)
|
6
7
|
if client_id.nil? || client_id.empty? || client_secret.nil? || client_secret.empty?
|
7
8
|
raise ArgumentError, "Both Client ID & Client Secret has to be set"
|
@@ -33,7 +34,7 @@ class Auth
|
|
33
34
|
|
34
35
|
res = http.request(req)
|
35
36
|
|
36
|
-
token = JSON.parse(res.body)['access_token']
|
37
|
+
@token = JSON.parse(res.body)['access_token']
|
37
38
|
puts "\n"+res.body
|
38
39
|
return token
|
39
40
|
rescue => e
|
@@ -41,4 +42,8 @@ class Auth
|
|
41
42
|
puts e
|
42
43
|
end
|
43
44
|
end
|
45
|
+
|
46
|
+
def getToken
|
47
|
+
return @token
|
48
|
+
end
|
44
49
|
end
|