Skip to content

Commit

Permalink
temporarily disable breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 4, 2020
1 parent 384e24f commit 449e61e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
3 changes: 2 additions & 1 deletion app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,8 @@ def set_include
if params[:include].present?
@include = params[:include].split(",").map { |i| i.downcase.underscore.to_sym }

@include = @include & [:client, :media, :references, :citations, :parts, :part_of, :versions, :version_of]
# @include = @include & [:client, :media, :references, :citations, :parts, :part_of, :versions, :version_of]
@include = @include & [:client, :media]
else
@include = []
end
Expand Down
19 changes: 10 additions & 9 deletions app/serializers/doi_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ class DoiSerializer
set_id :uid
# don't cache dois, as works are cached using the doi model

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, :view_count, :views_over_time, :download_count, :downloads_over_time, :reference_count, :citation_count, :citations_over_time, :part_count, :part_of_count, :version_count, :version_of_count, :created, :registered, :published, :updated
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, :view_count, :views_over_time, :download_count, :downloads_over_time, :reference_count, :citation_count, :citations_over_time, :created, :registered, :published, :updated
attributes :prefix, :suffix, :views_over_time, :downloads_over_time, :citations_over_time, if: Proc.new { |object, params| params && params[:detail] }

# :part_count, :part_of_count, :version_count, :version_of_count,

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]}
has_many :references, record_type: :dois, serializer: DoiSerializer, object_method_name: :indexed_references, if: Proc.new { |object, params| params && params[:detail] }
has_many :citations, record_type: :dois, serializer: DoiSerializer, object_method_name: :indexed_citations, if: Proc.new { |object, params| params && params[:detail] }
has_many :parts, record_type: :dois, serializer: DoiSerializer, object_method_name: :indexed_parts, if: Proc.new { |object, params| params && params[:detail] }
has_many :part_of, record_type: :dois, serializer: DoiSerializer, object_method_name: :indexed_part_of, if: Proc.new { |object, params| params && params[:detail] }
has_many :versions, record_type: :dois, serializer: DoiSerializer, object_method_name: :indexed_versions, if: Proc.new { |object, params| params && params[:detail] }
has_many :version_of, record_type: :dois, serializer: DoiSerializer, object_method_name: :indexed_version_of, if: Proc.new { |object, params| params && params[:detail] }
# has_many :media, record_type: :media, id_method_name: :uid, if: Proc.new { |object, params| params && params[:detail] && !params[:is_collection]}
# has_many :references, record_type: :dois, serializer: DoiSerializer, object_method_name: :indexed_references, if: Proc.new { |object, params| params && params[:detail] }
# has_many :citations, record_type: :dois, serializer: DoiSerializer, object_method_name: :indexed_citations, if: Proc.new { |object, params| params && params[:detail] }
# has_many :parts, record_type: :dois, serializer: DoiSerializer, object_method_name: :indexed_parts, if: Proc.new { |object, params| params && params[:detail] }
# has_many :part_of, record_type: :dois, serializer: DoiSerializer, object_method_name: :indexed_part_of, if: Proc.new { |object, params| params && params[:detail] }
# has_many :versions, record_type: :dois, serializer: DoiSerializer, object_method_name: :indexed_versions, if: Proc.new { |object, params| params && params[:detail] }
# has_many :version_of, record_type: :dois, serializer: DoiSerializer, object_method_name: :indexed_version_of, if: Proc.new { |object, params| params && params[:detail] }

attribute :xml, if: Proc.new { |object, params| params && params[:detail] } do |object|
begin
Expand Down
30 changes: 15 additions & 15 deletions spec/requests/dois_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@

expect(result.dig('attributes', 'doi')).to eq(doi.doi.downcase)
expect(result.dig('attributes', 'titles')).to eq(doi.titles)
expect(result.dig('relationships','citations', 'data')).to be_empty
# expect(result.dig('relationships','citations', 'data')).to be_empty
end
end

Expand Down Expand Up @@ -336,9 +336,9 @@
expect(json.dig('data', 'attributes', 'doi')).to eq(doi.doi.downcase)
expect(json.dig('data', 'attributes', 'titles')).to eq(doi.titles)
expect(json.dig('data', 'attributes', 'referenceCount')).to eq(1)
expect(json.dig('data', 'relationships', 'references', 'data')).to eq([{"id"=>target_doi.doi.downcase, "type"=>"dois"}])
expect(json.dig('included').length).to eq(1)
expect(json.dig('included', 0, 'attributes', 'doi')).to eq(target_doi.doi.downcase)
# expect(json.dig('data', 'relationships', 'references', 'data')).to eq([{"id"=>target_doi.doi.downcase, "type"=>"dois"}])
# expect(json.dig('included').length).to eq(1)
# expect(json.dig('included', 0, 'attributes', 'doi')).to eq(target_doi.doi.downcase)
end
end

Expand All @@ -362,9 +362,9 @@
expect(json.dig('data', 'attributes', 'titles')).to eq(doi.titles)
expect(json.dig('data', 'attributes', 'citationCount')).to eq(1)
expect(json.dig('data', 'attributes', 'citationsOverTime')).to eq([{"total"=>1, "year"=>"2020"}])
expect(json.dig('data', 'relationships', 'citations', 'data')).to eq([{"id"=>source_doi.doi.downcase, "type"=>"dois"}])
expect(json.dig('included').length).to eq(1)
expect(json.dig('included', 0, 'attributes', 'doi')).to eq(source_doi.doi.downcase)
# expect(json.dig('data', 'relationships', 'citations', 'data')).to eq([{"id"=>source_doi.doi.downcase, "type"=>"dois"}])
# expect(json.dig('included').length).to eq(1)
# expect(json.dig('included', 0, 'attributes', 'doi')).to eq(source_doi.doi.downcase)
end

it "has citations meta" do
Expand Down Expand Up @@ -393,10 +393,10 @@
expect(json.dig('data', 'attributes', 'url')).to eq(doi.url)
expect(json.dig('data', 'attributes', 'doi')).to eq(doi.doi.downcase)
expect(json.dig('data', 'attributes', 'titles')).to eq(doi.titles)
expect(json.dig('data', 'attributes', 'partCount')).to eq(1)
expect(json.dig('data', 'relationships', 'parts', 'data')).to eq([{"id"=>target_doi.doi.downcase, "type"=>"dois"}])
expect(json.dig('included').length).to eq(1)
expect(json.dig('included', 0, 'attributes', 'doi')).to eq(target_doi.doi.downcase)
# expect(json.dig('data', 'attributes', 'partCount')).to eq(1)
# expect(json.dig('data', 'relationships', 'parts', 'data')).to eq([{"id"=>target_doi.doi.downcase, "type"=>"dois"}])
# expect(json.dig('included').length).to eq(1)
# expect(json.dig('included', 0, 'attributes', 'doi')).to eq(target_doi.doi.downcase)
end
end

Expand All @@ -418,10 +418,10 @@
expect(json.dig('data', 'attributes', 'url')).to eq(doi.url)
expect(json.dig('data', 'attributes', 'doi')).to eq(doi.doi.downcase)
expect(json.dig('data', 'attributes', 'titles')).to eq(doi.titles)
expect(json.dig('data', 'attributes', 'versionCount')).to eq(1)
expect(json.dig('data', 'relationships', 'versions', 'data')).to eq([{"id"=>target_doi.doi.downcase, "type"=>"dois"}])
expect(json.dig('included').length).to eq(1)
expect(json.dig('included', 0, 'attributes', 'doi')).to eq(target_doi.doi.downcase)
# expect(json.dig('data', 'attributes', 'versionCount')).to eq(1)
# expect(json.dig('data', 'relationships', 'versions', 'data')).to eq([{"id"=>target_doi.doi.downcase, "type"=>"dois"}])
# expect(json.dig('included').length).to eq(1)
# expect(json.dig('included', 0, 'attributes', 'doi')).to eq(target_doi.doi.downcase)
end
end

Expand Down

0 comments on commit 449e61e

Please sign in to comment.