Skip to content

Commit

Permalink
opt-in to not show contributors, geo_locations, funding_references an…
Browse files Browse the repository at this point in the history
…d subjects in doi serializer
  • Loading branch information
Martin Fenner committed Apr 25, 2020
1 parent fa5d935 commit a30c761
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/serializers/doi_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class DoiSerializer
end.compact
end

attribute :contributors do |object, params|
attribute :contributors, if: Proc.new { |object, params| params && params[:composite].blank? } do |object, params|
# Always return an array of contributors and affiliations
# use new array format only if param present
Array.wrap(object.contributors).map do |c|
Expand All @@ -64,7 +64,7 @@ class DoiSerializer
Array.wrap(object.rights_list)
end

attribute :funding_references do |object|
attribute :funding_references, if: Proc.new { |object, params| params && params[:composite].blank? } do |object|
Array.wrap(object.funding_references)
end

Expand All @@ -76,15 +76,15 @@ class DoiSerializer
Array.wrap(object.related_identifiers)
end

attribute :geo_locations do |object|
attribute :geo_locations, if: Proc.new { |object, params| params && params[:composite].blank? } do |object|
Array.wrap(object.geo_locations)
end

attribute :dates do |object|
Array.wrap(object.dates)
end

attribute :subjects do |object|
attribute :subjects, if: Proc.new { |object, params| params && params[:composite].blank? } do |object|
Array.wrap(object.subjects)
end

Expand Down

0 comments on commit a30c761

Please sign in to comment.