class Payrix::Http::Response
Attributes
status[R]
Public Class Methods
new(response = {}, status = '', cls)
click to toggle source
# File lib/payrix/http/response.rb, line 6 def initialize(response = {}, status = '', cls) @response = response @status = status @cls = cls end
Public Instance Methods
details()
click to toggle source
# File lib/payrix/http/response.rb, line 26 def details (@response['response'] && @response['response']['details']) || {} end
errors()
click to toggle source
# File lib/payrix/http/response.rb, line 18 def errors @response['errors'] || (@response['response'] && @response['response']['errors']) || [] end
has_errors?()
click to toggle source
# File lib/payrix/http/response.rb, line 22 def has_errors? !errors.empty? end
has_more?()
click to toggle source
# File lib/payrix/http/response.rb, line 34 def has_more? page = @response['response'] && @response['response']['details'] && @response['response']['details']['page'] !page.nil? && !page['current'].nil? && !page['last'].nil? && page['current'] < page['last'] end
response()
click to toggle source
Return the response as an array
# File lib/payrix/http/response.rb, line 13 def response data = (@response['response'] && @response['response']['data']) || [] data.map { |v| @cls.new(v) } end
totals()
click to toggle source
# File lib/payrix/http/response.rb, line 30 def totals (@response['response'] && @response['response']['details'] && @response['response']['details']['totals']) || {} end