Skip to content

Commit

Permalink
Fix payload validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
beauby committed Jan 5, 2016
1 parent 5be64a0 commit a069b45
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ def payload_valid?(payload)
return false unless payload.is_a?(Hash)
primary_data = payload['data']
return false unless primary_data.is_a?(Hash)
attributes = primary_data['attributes']
return false unless attributes.nil? || attributes.is_a?(Hash)
relationships = primary_data['relationships']
return false unless relationships.nil? || relationships.is_a?(Hash)
attributes = primary_data['attributes'] || {}
return false unless attributes.is_a?(Hash)
relationships = primary_data['relationships'] || {}
return false unless relationships.is_a?(Hash)
relationships.each do |(_, value)|
return false unless value.is_a?(Hash) && value.key?('data')
end
Expand Down

0 comments on commit a069b45

Please sign in to comment.