Merge pull request #217 from sudiptachatterjee/master

Updating success logic
This commit is contained in:
Steve Bazyl 2015-04-16 16:38:26 -07:00
commit 82f69445ad
1 changed files with 7 additions and 3 deletions

View File

@ -79,13 +79,13 @@ module Google
end end
## ##
# Check if request failed # Check if request failed - which is anything other than 200/201 OK
# #
# @!attribute [r] error? # @!attribute [r] error?
# @return [TrueClass, FalseClass] # @return [TrueClass, FalseClass]
# true if result of operation is an error # true if result of operation is an error
def error? def error?
return self.response.status >= 400 return !self.success?
end end
## ##
@ -95,7 +95,11 @@ module Google
# @return [TrueClass, FalseClass] # @return [TrueClass, FalseClass]
# true if result of operation was successful # true if result of operation was successful
def success? def success?
return !self.error? if self.response.status == 200 || self.response.status == 201
return true
else
return false
end
end end
## ##