Skip to content

Commit

Permalink
Merge branch 'master' of github.com:datacite/lupo
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhallett committed Oct 28, 2019
2 parents 634dc9e + c763621 commit 50a6ff3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ def set_doi
def set_include
if params[:include].present?
@include = params[:include].split(",").map { |i| i.downcase.underscore.to_sym }
@include = @include & [:repository, :media]
@include = @include & [:client, :media]
else
@include = [:repository, :media]
@include = [:client, :media]
end
end

Expand Down
10 changes: 9 additions & 1 deletion app/serializers/client_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class ClientSerializer
set_type :clients
set_id :uid

attributes :name, :symbol, :year, :contact_email, :alternate_name, :description, :language, :client_type, :domains, :issn, :url, :salesforce_id, :created, :updated
attributes :name, :symbol, :year, :contact_email, :alternate_name, :description, :language, :client_type, :domains, :re3data, :opendoar, :issn, :url, :salesforce_id, :created, :updated

belongs_to :provider, record_type: :providers
belongs_to :consortium, record_type: :providers, serializer: ProviderSerializer, if: Proc.new { |client| client.consortium_id }
Expand All @@ -21,4 +21,12 @@ class ClientSerializer
attribute :salesforce_id, if: Proc.new { |object, params| params[:current_ability] && params[:current_ability].can?(:read_salesforce_id, object) == true } do |object|
object.salesforce_id
end

attribute :re3data do |object|
"https://doi.org/#{object.re3data_id}" if object.re3data_id.present?
end

attribute :opendoar do |object|
"https://v2.sherpa.ac.uk/id/repository/#{object.opendoar_id}" if object.opendoar_id.present?
end
end
2 changes: 1 addition & 1 deletion app/serializers/doi_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class DoiSerializer
attributes :doi, :prefix, :suffix, :identifiers, :creators, :titles, :publisher, :container, :publication_year, :subjects, :contributors, :dates, :language, :types, :related_identifiers, :sizes, :formats, :version, :rights_list, :descriptions, :geo_locations, :funding_references, :xml, :url, :content_url, :metadata_version, :schema_version, :source, :is_active, :state, :reason, :landing_page, :created, :registered, :published, :updated
attributes :prefix, :suffix, if: Proc.new { |object, params| params && params[:detail] }

belongs_to :repository, record_type: :repositories
belongs_to :client, record_type: :clients
has_many :media, record_type: :media, id_method_name: :uid, if: Proc.new { |object, params| params && params[:detail] && !params[:is_collection]}

attribute :xml, if: Proc.new { |object, params| params && params[:detail] } do |object|
Expand Down

0 comments on commit 50a6ff3

Please sign in to comment.