class GoCardlessPro::Response

A class to wrap an API response

Public Class Methods

new(response) click to toggle source

Initialize a response instance @param response an API response

# File lib/gocardless_pro/response.rb, line 11
def initialize(response)
  @response = response
end

Public Instance Methods

body() click to toggle source

Return the body of parsed JSON body of the API response

# File lib/gocardless_pro/response.rb, line 16
def body
  JSON.parse(@response.body) unless @response.body.empty?
end
limit() click to toggle source

Returns the limit parameter from the response

# File lib/gocardless_pro/response.rb, line 26
def limit
  meta.fetch('limit', nil)
end
meta() click to toggle source

Returns the meta hash of the response

# File lib/gocardless_pro/response.rb, line 21
def meta
  json_body.fetch('meta', {})
end