Class: BlockstreamSatellite::Response
- Inherits:
-
Object
- Object
- BlockstreamSatellite::Response
- Defined in:
- lib/blockstream_satellite/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#error ⇒ Object
Returns the value of attribute error.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
6 7 8 9 10 11 12 13 |
# File 'lib/blockstream_satellite/response.rb', line 6 def initialize(response) if response.is_a?(Faraday::ClientError) @error = response else @response = response @body = response.body end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/blockstream_satellite/response.rb', line 4 def body @body end |
#error ⇒ Object
Returns the value of attribute error.
4 5 6 |
# File 'lib/blockstream_satellite/response.rb', line 4 def error @error end |
#response ⇒ Object
Returns the value of attribute response.
4 5 6 |
# File 'lib/blockstream_satellite/response.rb', line 4 def response @response end |
Instance Method Details
#[](key) ⇒ Object
19 20 21 |
# File 'lib/blockstream_satellite/response.rb', line 19 def [](key) self.body[key.to_s] end |
#success? ⇒ Boolean
15 16 17 |
# File 'lib/blockstream_satellite/response.rb', line 15 def success? self.error.nil? && !self.response.nil? && self.response.success? end |