Class: Kippt::CollectionResource::SaveResponse
- Inherits:
-
Object
- Object
- Kippt::CollectionResource::SaveResponse
- Defined in:
- lib/kippt/collection_resource.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(response) ⇒ SaveResponse
constructor
A new instance of SaveResponse.
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ SaveResponse
Returns a new instance of SaveResponse.
10 11 12 |
# File 'lib/kippt/collection_resource.rb', line 10 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
8 9 10 |
# File 'lib/kippt/collection_resource.rb', line 8 def response @response end |
Instance Method Details
#[](key) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kippt/collection_resource.rb', line 14 def [](key) return @save_response[key] if @save_response @save_response = {success: response.success?, resource: response.body} if response.body["message"] @save_response[:error_message] = response.body["message"] end @save_response[key] end |
#success? ⇒ Boolean
25 26 27 |
# File 'lib/kippt/collection_resource.rb', line 25 def success? self[:success] end |