mirror of
https://github.com/nov/fb_graph2
synced 2023-03-27 23:22:15 -04:00
globally handle "true" and '{"success":true}' as same
This commit is contained in:
parent
3ac01c38c9
commit
753bf0d8d5
2 changed files with 6 additions and 3 deletions
|
@ -9,8 +9,7 @@ module FbGraph2
|
|||
end
|
||||
|
||||
def notification!(params = {})
|
||||
notification = self.post params, edge: :notifications
|
||||
notification[:success]
|
||||
self.post params, edge: :notifications
|
||||
end
|
||||
alias_method :notify!, :notification!
|
||||
end
|
||||
|
|
|
@ -112,7 +112,11 @@ module FbGraph2
|
|||
_response_ = _response_.with_indifferent_access if _response_.respond_to? :with_indifferent_access
|
||||
case response.status
|
||||
when 200...300
|
||||
_response_
|
||||
if _response_.respond_to?(:include?) && _response_.include?(:success)
|
||||
_response_[:success]
|
||||
else
|
||||
_response_
|
||||
end
|
||||
else
|
||||
raise Exception.detect(response.status, _response_, response.headers)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue