lib/survey_gizmo/resource.rb in survey-gizmo-ruby-0.7.0 vs lib/survey_gizmo/resource.rb in survey-gizmo-ruby-0.7.1
- old
+ new
@@ -135,21 +135,21 @@
# true if Resource instance is saved
def save
if new?
_create
else
- handle_response SurveyGizmo.post(handle_route(:update), :query => self.attributes_without_blanks), do
+ handle_response SurveyGizmo.post(handle_route(:update), :query => self.attributes_without_blanks) do
_response.ok? ? saved! : false
end
end
end
# fetch resource from SurveyGizmo and reload the attributes
# @return [self, false]
# Returns the object, if saved. Otherwise returns false.
def reload
- handle_response SurveyGizmo.get(handle_route(:get)), do
+ handle_response SurveyGizmo.get(handle_route(:get)) do
if _response.ok?
self.attributes = _response.data
clean!
else
false
@@ -159,11 +159,11 @@
# Deleted the Resource from Survey Gizmo
# @return [Boolean]
def destroy
return false if new? || destroyed?
- handle_response SurveyGizmo.delete(handle_route(:delete)), do
+ handle_response SurveyGizmo.delete(handle_route(:delete)) do
_response.ok? ? destroyed! : false
end
end
# The state of the current Resource
@@ -262,10 +262,10 @@
instance_eval(&block)
end
def _create(attributes = {})
http = SurveyGizmo.put(handle_route(:create), :query => self.attributes_without_blanks)
- handle_response http, do
+ handle_response http do
if _response.ok?
self.attributes = _response.data
saved!
else
false
\ No newline at end of file