Class: Stripe::StripeResponse
- Inherits:
-
Object
- Object
- Stripe::StripeResponse
- Includes:
- StripeResponseBase
- Defined in:
- lib/stripe/stripe_response.rb
Overview
StripeResponse encapsulates some vitals of a response that came back from the Stripe API.
Constant Summary collapse
- Headers =
We have to alias StripeResponseHeaders to StripeResponse::Headers, as this class used to be embedded within StripeResponse and we want to be backwards compatible.
StripeResponseHeaders
Instance Attribute Summary collapse
-
#data ⇒ Object
The data contained by the HTTP body of the response deserialized from JSON.
-
#http_body ⇒ Object
The raw HTTP body of the response.
Attributes included from StripeResponseBase
#http_headers, #http_status, #request_id
Class Method Summary collapse
-
.from_net_http(http_resp) ⇒ Object
Initializes a StripeResponse object from a Net::HTTP::HTTPResponse object.
Methods included from StripeResponseBase
Instance Attribute Details
#data ⇒ Object
The data contained by the HTTP body of the response deserialized from JSON.
72 73 74 |
# File 'lib/stripe/stripe_response.rb', line 72 def data @data end |
#http_body ⇒ Object
The raw HTTP body of the response.
75 76 77 |
# File 'lib/stripe/stripe_response.rb', line 75 def http_body @http_body end |
Class Method Details
.from_net_http(http_resp) ⇒ Object
Initializes a StripeResponse object from a Net::HTTP::HTTPResponse object.
79 80 81 82 83 84 85 |
# File 'lib/stripe/stripe_response.rb', line 79 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 |