Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove simple links from data when parsed

  • Loading branch information...
commit 413052e1346efefcb132fb17b60d4b19d1adfdb1 1 parent 38e69a7
@pengwynn pengwynn authored
Showing with 4 additions and 1 deletion.
  1. +1 −1  lib/sawyer/link_parsers/simple.rb
  2. +3 −0  test/resource_test.rb
View
2  lib/sawyer/link_parsers/simple.rb
@@ -17,7 +17,7 @@ def parse(data)
inline_links = data.keys.select {|k| k.to_s[LINK_REGEX] }
inline_links.each do |key|
rel_name = key.to_s == 'url' ? 'self' : key.to_s.gsub(LINK_REGEX, '')
- links[rel_name.to_sym] = data[key]
+ links[rel_name.to_sym] = data.delete(key)
end
return data, links
View
3  test/resource_test.rb
@@ -131,9 +131,12 @@ def test_simple_rel_parsing
assert_equal '/', res.rels[:self].href
assert_kind_of Resource, res.user
+ assert !res.fields.include?(:url)
assert_equal 1, res.user.id
assert_equal '/users/1', res.user.rels[:self].href
+ assert !res.user.fields.include?(:url)
assert_equal '/users/1/followers', res.user.rels[:followers].href
+ assert !res.user.fields.include?(:followers_url)
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.