-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathexample.rb
39 lines (30 loc) · 1.04 KB
/
example.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'poke-api'
require 'pp'
# Refer to README for information for setting up a Proxy if required
# Instantiate the client
client = Poke::API::Client.new
# Store your location, you can also store your lat/lng directly
# using client.store_lat_lng(lat, lng)
# or using client.lat = 10, client.lng = 10, client.alt = 10
client.store_location('New York')
# Use Google auth with '[email protected]', 'password', 'google'
# Optionally set your Google Refresh token using client.refresh_token = 'my-token'
client.login('username', 'password', 'ptc')
# Activate the encryption method to generate a signature
# Where path is the path to your encrypt .so/.dll
client.activate_signature('/path/to/encrypt/file')
# Get cells
cell_ids = Poke::API::Helpers.get_cells(client.lat, client.lng)
# Construct map objects call
client.get_map_objects(
latitude: client.lat,
longitude: client.lng,
since_timestamp_ms: [0] * cell_ids.length,
cell_id: cell_ids
)
# Add more calls
client.get_player
client.get_inventory
# Call and view response
resp = client.call
pp resp