Class: Poke::API::Response

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/poke-api/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

formatter=, log_level=, #logger

Constructor Details

#initialize(response, request) ⇒ Response

Returns a new instance of Response.



7
8
9
10
# File 'lib/poke-api/response.rb', line 7

def initialize(response, request)
  @response = response
  @request  = request
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



5
6
7
# File 'lib/poke-api/response.rb', line 5

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



5
6
7
# File 'lib/poke-api/response.rb', line 5

def response
  @response
end

Instance Method Details

#decode(client) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/poke-api/response.rb', line 12

def decode(client)
  logger.info '[+] Decoding Main RPC responses'
  logger.debug "[+] RPC response \r\n#{@response.inspect}"

  @response = POGOProtos::Networking::Envelopes::ResponseEnvelope.decode(@response)
  logger.debug "[+] Decoded RPC response \r\n#{@response.inspect}"

  store_ticket(client)
  store_endpoint(client)

  decode_response
end