class Pexels::Client::Response

Attributes

request[R]
response[R]

Public Class Methods

new(request, response) click to toggle source
# File lib/pexels/client/response.rb, line 8
def initialize(request, response)
  @request = request
  @response = response
end

Public Instance Methods

body() click to toggle source
# File lib/pexels/client/response.rb, line 13
def body
  JSON.parse(response.body)

rescue JSON::JSONError => exception
  raise Pexels::APIError.new(exception)
end
headers() click to toggle source
# File lib/pexels/client/response.rb, line 20
def headers
  response.headers
end
ratelimit_remaining() click to toggle source
# File lib/pexels/client/response.rb, line 24
def ratelimit_remaining
  headers['x-ratelimit-remaining']&.first&.to_i
end