poke-go-api 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/poke-api/client.rb +23 -11
- data/lib/poke-api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edcbf91a753d6de2dca22476e90170a4b7a5eede
|
4
|
+
data.tar.gz: a37f12e9e92a30701e2854bd8f9c895264611278
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6140ba8ffa02732f18497a42d5e09d7c4355f67a6a02700d6814cbf88a673a15bd267c96b2a783b7256e12884f2b77f7801a0d5b2bc8f835f5d5878a247f3afe
|
7
|
+
data.tar.gz: 9363b5ccf97b224f322f723e70d7f948ae229c44cb45abda08a63e89ffb70954db88de657ebf6948bdfe49dd3ac08d359640defdda79500fe56ba310ffa568d1
|
data/lib/poke-api/client.rb
CHANGED
@@ -15,7 +15,7 @@ module Poke
|
|
15
15
|
|
16
16
|
def login(username, password, provider)
|
17
17
|
provider = provider.upcase
|
18
|
-
raise Errors::InvalidProvider
|
18
|
+
raise Errors::InvalidProvider, provider unless %w(PTC GOOGLE).include?(provider)
|
19
19
|
logger.info "[+] Logging in user: #{username}"
|
20
20
|
|
21
21
|
begin
|
@@ -30,13 +30,13 @@ module Poke
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def call
|
33
|
-
raise Errors::LoginRequired
|
33
|
+
raise Errors::LoginRequired unless @auth
|
34
34
|
req = RequestBuilder.new(@auth, [@lat, @lng, @alt], @endpoint)
|
35
35
|
|
36
36
|
begin
|
37
37
|
resp = req.request(@reqs)
|
38
38
|
rescue StandardError => ex
|
39
|
-
raise Errors::UnknownProtoFault
|
39
|
+
raise Errors::UnknownProtoFault, ex
|
40
40
|
ensure
|
41
41
|
@reqs = []
|
42
42
|
logger.info '[+] Cleaning up RPC requests'
|
@@ -50,7 +50,14 @@ module Poke
|
|
50
50
|
logger.info "[+] Given location: #{pos.address}"
|
51
51
|
|
52
52
|
logger.info "[+] Lat/Long: #{pos.latitude}, #{pos.longitude}"
|
53
|
-
@lat
|
53
|
+
@lat = pos.latitude
|
54
|
+
@lng = pos.longitude
|
55
|
+
end
|
56
|
+
|
57
|
+
def store_lat_lng(lat, lng)
|
58
|
+
logger.info "[+] Lat/Long: #{lat}, #{lng}"
|
59
|
+
@lat = lat
|
60
|
+
@lng = lng
|
54
61
|
end
|
55
62
|
|
56
63
|
def inspect
|
@@ -67,17 +74,22 @@ module Poke
|
|
67
74
|
check_awarded_badges
|
68
75
|
download_settings(hash: '4a2e9bc330dae60e7b74fc85b98868ab4700802e')
|
69
76
|
|
70
|
-
|
77
|
+
resp = call.response
|
78
|
+
|
79
|
+
if !resp[:api_url] && resp[:api_url].empty?
|
80
|
+
logger.debug '[+] Login failed, please try again'
|
81
|
+
return
|
82
|
+
end
|
83
|
+
|
84
|
+
@endpoint = "https://#{resp[:api_url]}/rpc"
|
71
85
|
logger.debug "[+] Setting endpoint to #{@endpoint}"
|
72
86
|
end
|
73
87
|
|
74
88
|
def method_missing(method, *args)
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
super
|
80
|
-
end
|
89
|
+
POGOProtos::Networking::Requests::RequestType.const_get(method.upcase)
|
90
|
+
@reqs << (args.empty? ? method.to_sym.upcase : { method.to_sym.upcase => args.first })
|
91
|
+
rescue NameError
|
92
|
+
super
|
81
93
|
end
|
82
94
|
end
|
83
95
|
end
|
data/lib/poke-api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poke-go-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nabeel Amjad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|