class Stripe::StripeResponse

StripeResponse encapsulates some vitals of a response that came back from the Stripe API.

Constants

Headers

Headers provides an access wrapper to an API response's header data. It mainly exists so that we don't need to expose the entire `Net::HTTPResponse` object while still getting some of its benefits like case-insensitive access to header names and flattening of header values.

Attributes

data[RW]

The data contained by the HTTP body of the response deserialized from JSON.

http_body[RW]

The raw HTTP body of the response.

Public Class Methods

from_net_http(http_resp) click to toggle source

Initializes a StripeResponse object from a Net::HTTP::HTTPResponse object.

# File lib/stripe/stripe_response.rb, line 81
def self.from_net_http(http_resp)
  resp = StripeResponse.new
  resp.data = JSON.parse(http_resp.body, symbolize_names: true)
  resp.http_body = http_resp.body
  StripeResponseBase.populate_for_net_http(resp, http_resp)
  resp
end