diff --git a/Gemfile.lock b/Gemfile.lock index e4523d102..cd638f1c1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -55,21 +55,21 @@ GEM api-pagination (4.8.1) arel (9.0.0) aws-eventstream (1.0.1) - aws-partitions (1.102.0) - aws-sdk-core (3.26.0) + aws-partitions (1.103.0) + aws-sdk-core (3.27.0) aws-eventstream (~> 1.0) aws-partitions (~> 1.0) aws-sigv4 (~> 1.0) jmespath (~> 1.0) - aws-sdk-kms (1.8.0) - aws-sdk-core (~> 3) + aws-sdk-kms (1.9.0) + aws-sdk-core (~> 3, >= 3.26.0) aws-sigv4 (~> 1.0) - aws-sdk-s3 (1.18.0) - aws-sdk-core (~> 3, >= 3.21.2) + aws-sdk-s3 (1.19.0) + aws-sdk-core (~> 3, >= 3.26.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.0) - aws-sdk-sqs (1.5.0) - aws-sdk-core (~> 3) + aws-sdk-sqs (1.6.0) + aws-sdk-core (~> 3, >= 3.26.0) aws-sigv4 (~> 1.0) aws-sigv4 (1.0.3) base32-url (0.5) @@ -93,7 +93,7 @@ GEM latex-decode (~> 0.0) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) - bolognese (0.13.6) + bolognese (0.14.1) activesupport (>= 4.2.5, < 6) benchmark_methods (~> 0.7) bibtex-ruby (~> 4.1) @@ -132,7 +132,7 @@ GEM simplecov (<= 0.13) coderay (1.1.2) colorize (0.8.1) - commonmarker (0.17.11) + commonmarker (0.17.12) ruby-enum (~> 0.5) concurrent-ruby (1.0.5) countries (2.1.4) @@ -181,10 +181,10 @@ GEM erubi (1.7.1) excon (0.62.0) facets (3.1.0) - factory_bot (4.11.0) + factory_bot (4.11.1) activesupport (>= 3.0.0) - factory_bot_rails (4.11.0) - factory_bot (~> 4.11.0) + factory_bot_rails (4.11.1) + factory_bot (~> 4.11.1) railties (>= 3.0.0) faker (1.9.1) i18n (>= 0.7) diff --git a/spec/fixtures/files/schema_4.0.xml b/spec/fixtures/files/schema_4.0.xml new file mode 100644 index 000000000..22c567409 --- /dev/null +++ b/spec/fixtures/files/schema_4.0.xml @@ -0,0 +1,140 @@ + + + 10.6071/Z7WC73 + + + Bales, Roger + UC Merced + + + Meadows, Matt + UC Merced + + + Stacy, Erin + 0000-0002-8862-1404 + UC Merced + + + Conklin, Martha + 0000-0002-9627-2427 + UC Merced + + + Meng, Xiande + UC Merced + + + Southern Sierra Critical Zone Observatory, SSCZO + NSF + + + + + Southern Sierra Critical Zone Observatory (SSCZO), Providence Creek + meteorological data, soil moisture and temperature, snow depth and air + temperature + + + UC Merced + 2013 + + Earth sciences + soil moisture + soil temperature + snow depth + air temperature + water balance + Nevada, Sierra (mountain range) + + + + + National Science Foundation, Division of Earth Sciences, Critical Zone + Observatories + + 1331939, 0725097 + + + + + Bales, Roger + University of California, Merced + + + Meadows, Matt + University of California, Merced + + + Meng, Xiande + University of California, Merced + + + Southern Sierra Critical Zone Observatory + + + + 2014-10-17 + 2016-03-14T17:02:02Z + + en + dataset + + 1799269709 bytes + + 2 + + Creative Commons Attribution 4.0 International (CC BY 4.0) + + + + Snow depth, soil moisture and soil temperature are measured at lower + Providence South facing (LowMetS) and North facing (LowMetN), Upper + Providence South facing (UpMetS), North facing (UpMetN) and Flat aspect + (UpMetF), and Subcatchment basin P301 (P301) with a wireless sensor + network, using a Campbell Scientific logger to control peripheral devices. + Snow depth is measured in the open, at the drip edge and under canopies. + Soil moisture and temperature are measured at 10, 30, 60 and 90 cm depths + coincident with the snow depth nodes. 10 watt solar panels provides power + for monitoring at 10 minute intervals. Raw data have been processed to + level 1 (QA/QC) and level 2 (gap-filled, derived) data. Time period: water + year 2008 through water year 2012 (version 1), 2013 to 2016 (version 2). + + + Soil volumetric water content (VWC) and soil temperature measured using + Decagon Devices ECHO-TM at depths of 10, 30, 60, an 90 cm below the + mineral soil surface. Sensor now equivalent to 5TM + (http://www.decagon.com/soil-moisture-sensors/). Distance to snow/soil + surface and air temperature measured with Judd Communications ultrasonic + depth sensor, using analog control ( http://www.juddcom.com/ ). Data + control and storage on Campbell Scientific CR1000 datalogger, using + AM16/32B multiplexer ( http://www.campbellsci.com ). Program for data + acquisition are located on UC Merced-SNRI digital library ( + https://eng.ucmerced.edu/snsjho/files/MHWG/Field/Southern...) + + + Lower and upper Providence Creek, Subcatchment basin P301.acde: white fir + drip edge; acuc: white fir under canopy; cdde: incense-cedar drip edge; + cduc: incense-cedar under canopy; open: open canopy; plde: sugar pine drip + edge; pluc: sugar pine under canopy; ppde: Ponderosa pine drip; edge ppde: + Ponderosa pine drip edge; ppuc: Ponderosa pine under canopy; ppuc: + Ponderosa pine under canopy; qkde: black oak drip edge; qkuc: black oak + under canopy + + + + + + 37.047756 + -119.221094 + + + -119.211 + -119.182 + 37.046 + 37.075 + + Providence Creek (Lower, Upper and P301) + + + \ No newline at end of file diff --git a/spec/requests/dois_spec.rb b/spec/requests/dois_spec.rb index 7fd44bbe7..af6e9b1ea 100644 --- a/spec/requests/dois_spec.rb +++ b/spec/requests/dois_spec.rb @@ -738,6 +738,47 @@ end end + context 'when the request uses schema 4.0' do + let(:xml) { Base64.strict_encode64(file_fixture('schema_4.0.xml').read) } + let(:valid_attributes) do + { + "data" => { + "type" => "dois", + "attributes" => { + "doi" => "10.14454/10703", + "url" => "http://www.bl.uk/pdf/patspec.pdf", + "xml" => xml, + "event" => "register" + }, + "relationships"=> { + "client"=> { + "data"=> { + "type"=> "clients", + "id"=> client.symbol.downcase + } + } + } + } + } + end + + before { post '/dois', params: valid_attributes.to_json, headers: headers } + + it 'creates a Doi' do + expect(json.dig('data', 'attributes', 'doi')).to eq("10.14454/10703") + expect(json.dig('data', 'attributes', 'title')).to eq("Southern Sierra Critical Zone Observatory (SSCZO), Providence Creek\n meteorological data, soil moisture and temperature, snow depth and air\n temperature") + expect(json.dig('data', 'attributes', 'schema-version')).to eq("http://datacite.org/schema/kernel-4") + end + + it 'returns status code 201' do + expect(response).to have_http_status(201) + end + + it 'sets state to registered' do + expect(json.dig('data', 'attributes', 'state')).to eq("registered") + end + end + context 'when the request uses namespaced xml and the title changes' do let(:title) { "Referee report. For: RESEARCH-3482 [version 5; referees: 1 approved, 1 approved with reservations]" } let(:xml) { Base64.strict_encode64(file_fixture('ns0.xml').read) }