Class: Imperium::KVDELETEResponse
- Defined in:
- lib/imperium/kv_delete_response.rb
Overview
Note:
This class doesn’t really make sense to be instantiated outside of Imperium::KV#delete
KVDELETEResponse is a wrapper for the raw HTTP::Message response from the API
Instance Attribute Summary collapse
-
#options ⇒ Hash<Symbol, Object>
coerced from an array to hash.
Instance Method Summary collapse
-
#initialize(message, options: {}) ⇒ KVDELETEResponse
constructor
A new instance of KVDELETEResponse.
- #success? ⇒ Boolean
Methods inherited from Response
#coerced_body, #each, #index, #known_leader?, #last_contact, #not_found?, #translate_addresses?
Constructor Details
#initialize(message, options: {}) ⇒ KVDELETEResponse
Returns a new instance of KVDELETEResponse.
15 16 17 18 |
# File 'lib/imperium/kv_delete_response.rb', line 15 def initialize(, options: {}) super @options = end |
Instance Attribute Details
#options ⇒ Hash<Symbol, Object>
coerced from an array to hash.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/imperium/kv_delete_response.rb', line 12 class KVDELETEResponse < Response attr_accessor :options def initialize(, options: {}) super @options = end if RUBY_VERSION < "2.4" def success? return @success if defined? @success @success = (body.chomp == "true") end else def success? return @success if defined? @success @success = JSON.parse(body) rescue JSON::ParserError body.empty? ? @success = false : raise end end end |
Instance Method Details
#success? ⇒ Boolean
21 22 23 24 |
# File 'lib/imperium/kv_delete_response.rb', line 21 def success? return @success if defined? @success @success = (body.chomp == "true") end |