Class: Freemium::Response
- Inherits:
-
Object
- Object
- Freemium::Response
- Defined in:
- lib/freemium/response.rb
Overview
used to encapsulate the success/failure/details of a response from some gateway. intended to be independent of the details of communication (e.g. Freemium::Gateways::BrainTree::Post).
Instance Attribute Summary collapse
-
#billing_key ⇒ Object
the related billing key, if appropriate.
-
#message ⇒ Object
may contain a description of the response.
-
#raw_data ⇒ Object
readonly
a gateway-specific hash of raw data related to the request.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(success, raw_data = {}) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(success, raw_data = {}) ⇒ Response
Returns a new instance of Response.
12 13 14 |
# File 'lib/freemium/response.rb', line 12 def initialize(success, raw_data = {}) @success, @raw_data = success, raw_data end |
Instance Attribute Details
#billing_key ⇒ Object
the related billing key, if appropriate
10 11 12 |
# File 'lib/freemium/response.rb', line 10 def billing_key @billing_key end |
#message ⇒ Object
may contain a description of the response. should contain an explanation if the response was not a success.
8 9 10 |
# File 'lib/freemium/response.rb', line 8 def @message end |
#raw_data ⇒ Object (readonly)
a gateway-specific hash of raw data related to the request.
6 7 8 |
# File 'lib/freemium/response.rb', line 6 def raw_data @raw_data end |
Instance Method Details
#[](key) ⇒ Object
20 21 22 |
# File 'lib/freemium/response.rb', line 20 def [](key) raw_data[key] end |
#success? ⇒ Boolean
16 17 18 |
# File 'lib/freemium/response.rb', line 16 def success? @success end |