class CloudPayments::Client::Response

Attributes

headers[R]
origin_body[R]
status[R]

Public Class Methods

new(status, body, headers = {}) click to toggle source
# File lib/cloud_payments/client/response.rb, line 7
def initialize(status, body, headers = {})
  @status, @origin_body, @headers = status, body, headers
  @origin_body = body.dup.force_encoding('UTF-8') if body.respond_to?(:force_encoding)
end

Public Instance Methods

body() click to toggle source
# File lib/cloud_payments/client/response.rb, line 12
def body
  @body ||= headers && headers['content-type'] =~ /json/ ? serializer.load(origin_body) : origin_body
end

Private Instance Methods

serializer() click to toggle source
# File lib/cloud_payments/client/response.rb, line 18
def serializer
  CloudPayments.config.serializer
end