diff --git a/app/serializers/work_serializer.rb b/app/serializers/work_serializer.rb index 2c582a4b6..848991681 100644 --- a/app/serializers/work_serializer.rb +++ b/app/serializers/work_serializer.rb @@ -5,7 +5,7 @@ class WorkSerializer set_id :identifier cache_options enabled: true, cache_length: 24.hours - attributes :doi, :identifier, :url, :author, :title, :container_title, :description, :resource_type_subtype, :data_center_id, :member_id, :resource_type_id, :version, :license, :schema_version, :results, :related_identifiers, :citation_count, :view_count, :download_count, :published, :registered, :checked, :updated, :media, :xml + attributes :doi, :identifier, :url, :author, :title, :container_title, :description, :resource_type_subtype, :data_center_id, :member_id, :resource_type_id, :version, :license, :schema_version, :results, :related_identifiers, :citation_count, :view_count, :views_over_time, :download_count, :downloads_over_time, :published, :registered, :checked, :updated, :media, :xml belongs_to :client, key: "data-center", record_type: "data-centers", serializer: :DataCenter belongs_to :provider, key: :member, record_type: :members, serializer: :Member diff --git a/spec/requests/works_spec.rb b/spec/requests/works_spec.rb index fd9ed2391..7134c2c29 100644 --- a/spec/requests/works_spec.rb +++ b/spec/requests/works_spec.rb @@ -49,7 +49,9 @@ expect(json.dig('data', 'attributes', 'title')).to eq("Data from: A new malaria agent in African hominids.") expect(json.dig('data', 'attributes', 'citation-count')).to eq(1) expect(json.dig('data', 'attributes', 'view-count')).to eq(0) + expect(json.dig('data', 'attributes', 'views-over-time')).to eq([]) expect(json.dig('data', 'attributes', 'download-count')).to eq(0) + expect(json.dig('data', 'attributes', 'downloads-over-time')).to eq([]) end it "has citations list" do @@ -63,7 +65,9 @@ expect(work.dig('attributes', 'title')).to eq("Data from: A new malaria agent in African hominids.") expect(work.dig('attributes', 'citation-count')).to eq(1) expect(work.dig('attributes', 'view-count')).to eq(0) + expect(work.dig('attributes', 'views-over-time')).to eq([]) expect(work.dig('attributes', 'download-count')).to eq(0) + expect(work.dig('attributes', 'downloads-over-time')).to eq([]) end end