Class: Decommas::Response::Api

Inherits:
Base
  • Object
show all
Defined in:
lib/decommas/response/api.rb

Constant Summary

Constants inherited from Base

Base::PAGINATION_LIMIT

Instance Method Summary collapse

Methods inherited from Base

#attempt

Constructor Details

#initialize(response) ⇒ Api

Returns a new instance of Api.



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/decommas/response/api.rb', line 4

def initialize(response)
  # Workaround for 429 response that returns text/html content-type for some reason
  response_data = if response.parsed_response.kind_of?(String)
    JSON.parse(response.parsed_response)
  else
    response.parsed_response
  end
  @code = response.code

  @data = response_data["result"]
  @message = response_data["message"]
end