bolognese 0.9.13 → 0.9.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bolognese/metadata.rb +4 -1
- data/lib/bolognese/utils.rb +31 -11
- data/lib/bolognese/version.rb +1 -1
- data/spec/fixtures/crosscite.json +39 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/crosscite.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_string/crosscite.yml +97 -0
- data/spec/metadata_spec.rb +15 -0
- data/spec/readers/crosscite_reader_spec.rb +39 -0
- metadata +5 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f212a65dde0f61b06563dba2fea86f553d31b2af
         | 
| 4 | 
            +
              data.tar.gz: 360a495bd4dcab4250199e9e55f71e52d6cfa29a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7fc398df17eb6b6ca4255eeaf386beb5d62141dbabc5b4c7b78ce9337be4dbb140af3ec693059cc7b3eaf5c36757399829bccf16f586a967773a5e9ce9013568
         | 
| 7 | 
            +
              data.tar.gz: 3839163d457f89cafe74e4fcb6570ee8c71a7045d9bc1fa92a144f570554548ed99016605ede37971d151e14a35d7766abfcffd4c608d6c93b45a89ef22efda7
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/lib/bolognese/metadata.rb
    CHANGED
    
    | @@ -80,7 +80,7 @@ module Bolognese | |
| 80 80 |  | 
| 81 81 | 
             
                    # generate name for method to call dynamically
         | 
| 82 82 | 
             
                    string = send("get_" + @from, id: id)
         | 
| 83 | 
            -
                   | 
| 83 | 
            +
                  elsif File.exist?(input)
         | 
| 84 84 | 
             
                    ext = File.extname(input)
         | 
| 85 85 | 
             
                    if %w(.bib .ris .xml .json).include?(ext)
         | 
| 86 86 | 
             
                      string = IO.read(input)
         | 
| @@ -89,6 +89,9 @@ module Bolognese | |
| 89 89 | 
             
                      $stderr.puts "File type #{ext} not supported"
         | 
| 90 90 | 
             
                      exit 1
         | 
| 91 91 | 
             
                    end
         | 
| 92 | 
            +
                  else
         | 
| 93 | 
            +
                    string = input
         | 
| 94 | 
            +
                    @from = from || find_from_format(string: string)
         | 
| 92 95 | 
             
                  end
         | 
| 93 96 |  | 
| 94 97 | 
             
                  # generate name for method to call dynamically
         | 
    
        data/lib/bolognese/utils.rb
    CHANGED
    
    | @@ -198,11 +198,13 @@ module Bolognese | |
| 198 198 | 
             
                  "WebSite" => "misc"
         | 
| 199 199 | 
             
                }
         | 
| 200 200 |  | 
| 201 | 
            -
                def find_from_format(id: nil, string: nil, ext: nil | 
| 201 | 
            +
                def find_from_format(id: nil, string: nil, ext: nil)
         | 
| 202 202 | 
             
                  if id.present?
         | 
| 203 203 | 
             
                    find_from_format_by_id(id)
         | 
| 204 | 
            +
                  elsif ext.present?
         | 
| 205 | 
            +
                    find_from_format_by_ext(string, ext: ext)
         | 
| 204 206 | 
             
                  elsif string.present?
         | 
| 205 | 
            -
                    find_from_format_by_string(string | 
| 207 | 
            +
                    find_from_format_by_string(string)
         | 
| 206 208 | 
             
                  end
         | 
| 207 209 | 
             
                end
         | 
| 208 210 |  | 
| @@ -221,26 +223,44 @@ module Bolognese | |
| 221 223 | 
             
                  end
         | 
| 222 224 | 
             
                end
         | 
| 223 225 |  | 
| 224 | 
            -
                def  | 
| 226 | 
            +
                def find_from_format_by_ext(string, options={})
         | 
| 225 227 | 
             
                  if options[:ext] == ".bib"
         | 
| 226 228 | 
             
                    "bibtex"
         | 
| 227 229 | 
             
                  elsif options[:ext] == ".ris"
         | 
| 228 230 | 
             
                    "ris"
         | 
| 229 | 
            -
                  elsif options[:ext] == ".xml" && Maremma.from_xml(string).dig("doi_records", "doi_record", "crossref")
         | 
| 231 | 
            +
                  elsif options[:ext] == ".xml" && Maremma.from_xml(string).to_h.dig("doi_records", "doi_record", "crossref")
         | 
| 230 232 | 
             
                    "crossref"
         | 
| 231 | 
            -
                  elsif options[:ext] == ".xml" && Maremma.from_xml(string).dig("resource", "xmlns").start_with?("http://datacite.org/schema/kernel")
         | 
| 233 | 
            +
                  elsif options[:ext] == ".xml" && Maremma.from_xml(string).to_h.dig("resource", "xmlns").to_s.start_with?("http://datacite.org/schema/kernel")
         | 
| 232 234 | 
             
                    "datacite"
         | 
| 233 | 
            -
                  elsif options[:ext] == ".json" && Maremma.from_json(string).dig(" | 
| 235 | 
            +
                  elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("ris_type")
         | 
| 236 | 
            +
                    "crosscite"
         | 
| 237 | 
            +
                  elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("schemaVersion").to_s.start_with?("http://datacite.org/schema/kernel")
         | 
| 234 238 | 
             
                    "datacite_json"
         | 
| 235 | 
            -
                  elsif options[:ext] == ".json" && Maremma.from_json(string).dig("issued", "date-parts").present?
         | 
| 239 | 
            +
                  elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("issued", "date-parts").present?
         | 
| 236 240 | 
             
                    "citeproc"
         | 
| 237 | 
            -
                  elsif options[:ext] == ".json" && Maremma.from_json(string).dig("@context").to_s.start_with?("http://schema.org")
         | 
| 241 | 
            +
                  elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("@context").to_s.start_with?("http://schema.org")
         | 
| 238 242 | 
             
                    "schema_org"
         | 
| 239 | 
            -
                  elsif options[:ext] == ".json" && Maremma.from_json(string).dig("@context") == ("https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld")
         | 
| 243 | 
            +
                  elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("@context") == ("https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld")
         | 
| 244 | 
            +
                    "codemeta"
         | 
| 245 | 
            +
                  end
         | 
| 246 | 
            +
                end
         | 
| 247 | 
            +
             | 
| 248 | 
            +
                def find_from_format_by_string(string)
         | 
| 249 | 
            +
                  if Maremma.from_xml(string).to_h.dig("doi_records", "doi_record", "crossref").present?
         | 
| 250 | 
            +
                    "crossref"
         | 
| 251 | 
            +
                  elsif Maremma.from_xml(string).to_h.dig("resource", "xmlns").to_s.start_with?("http://datacite.org/schema/kernel")
         | 
| 252 | 
            +
                    "datacite"
         | 
| 253 | 
            +
                  elsif Maremma.from_json(string).to_h.dig("ris_type").present?
         | 
| 254 | 
            +
                    "crosscite"
         | 
| 255 | 
            +
                  elsif Maremma.from_json(string).to_h.dig("schemaVersion").to_s.start_with?("http://datacite.org/schema/kernel")
         | 
| 256 | 
            +
                    "datacite_json"
         | 
| 257 | 
            +
                  elsif Maremma.from_json(string).to_h.dig("issued", "date-parts").present?
         | 
| 258 | 
            +
                    "citeproc"
         | 
| 259 | 
            +
                  elsif Maremma.from_json(string).to_h.dig("@context").to_s.start_with?("http://schema.org")
         | 
| 260 | 
            +
                    "schema_org"
         | 
| 261 | 
            +
                  elsif Maremma.from_json(string).to_h.dig("@context") == ("https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld")
         | 
| 240 262 | 
             
                    "codemeta"
         | 
| 241 263 | 
             
                  end
         | 
| 242 | 
            -
                rescue
         | 
| 243 | 
            -
                  nil
         | 
| 244 264 | 
             
                end
         | 
| 245 265 |  | 
| 246 266 | 
             
                def orcid_from_url(url)
         | 
    
        data/lib/bolognese/version.rb
    CHANGED
    
    
| @@ -0,0 +1,39 @@ | |
| 1 | 
            +
            {
         | 
| 2 | 
            +
                "id": "https://doi.org/10.5281/zenodo.48440",
         | 
| 3 | 
            +
                "doi": "10.5281/zenodo.48440",
         | 
| 4 | 
            +
                "type": "SoftwareSourceCode",
         | 
| 5 | 
            +
                "additional_type": "Software",
         | 
| 6 | 
            +
                "citeproc_type": "other",
         | 
| 7 | 
            +
                "bibtex_type": "misc",
         | 
| 8 | 
            +
                "ris_type": "COMP",
         | 
| 9 | 
            +
                "resource_type_general": "Software",
         | 
| 10 | 
            +
                "resource_type": "Software",
         | 
| 11 | 
            +
                "author": {
         | 
| 12 | 
            +
                    "type": "Person",
         | 
| 13 | 
            +
                    "name": "Kristian Garza",
         | 
| 14 | 
            +
                    "givenName": "Kristian",
         | 
| 15 | 
            +
                    "familyName": "Garza"
         | 
| 16 | 
            +
                },
         | 
| 17 | 
            +
                "title": "Analysis Tools for Crossover Experiment of UI using Choice Architecture",
         | 
| 18 | 
            +
                "publisher": "Zenodo",
         | 
| 19 | 
            +
                "keywords": "choice architecture, crossover experiment, hci",
         | 
| 20 | 
            +
                "date_published": "2016-03-27",
         | 
| 21 | 
            +
                "alternate_name": {
         | 
| 22 | 
            +
                    "type": "URL",
         | 
| 23 | 
            +
                    "name": "http://zenodo.org/record/48440"
         | 
| 24 | 
            +
                },
         | 
| 25 | 
            +
                "license": [{
         | 
| 26 | 
            +
                        "name": "Open Access"
         | 
| 27 | 
            +
                    },
         | 
| 28 | 
            +
                    {
         | 
| 29 | 
            +
                        "id": "https://creativecommons.org/licenses/by-nc-sa/4.0",
         | 
| 30 | 
            +
                        "name": "Creative Commons Attribution-NonCommercial-ShareAlike"
         | 
| 31 | 
            +
                    }
         | 
| 32 | 
            +
                ],
         | 
| 33 | 
            +
                "description": {
         | 
| 34 | 
            +
                    "type": "Abstract",
         | 
| 35 | 
            +
                    "text": "This tools are used to analyse the data produced by the Crosssover Experiment I designed to test Choice Architecture techniques as UI interventions in a SEEk4Science data catalogue. It contains:\n\n- Data structures for the experimental data.<br>\n- Visualisation functions<br>\n- Analysis functions\n\n## Installation\n\n- R<br>\n- python<br>\n- ipython 4\n\nClone and use.\n\n## Usage\n\n<br>\n```python<br>\nsource('parallel_plot.r')<br>\nwith(z, parallelset(trt,response, freq=count, alpha=0.2))<br>\n```\n\n<br>\n## Contributing\n\n1. Fork it!<br>\n2. Create your feature branch: `git checkout -b my-new-feature`<br>\n3. Commit your changes: `git commit -am 'Add some feature'`<br>\n4. Push to the branch: `git push origin my-new-feature`<br>\n5. Submit a pull request :D\n\n<br>\n## License\n\nThis work supports my PhD Thesis at University of Manchester."
         | 
| 36 | 
            +
                },
         | 
| 37 | 
            +
                "schema_version": "http://datacite.org/schema/kernel-3",
         | 
| 38 | 
            +
                "provider": "DataCite"
         | 
| 39 | 
            +
            }
         | 
| @@ -0,0 +1,99 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            http_interactions:
         | 
| 3 | 
            +
            - request:
         | 
| 4 | 
            +
                method: get
         | 
| 5 | 
            +
                uri: https://api.datacite.org/prefixes/10.5438
         | 
| 6 | 
            +
                body:
         | 
| 7 | 
            +
                  encoding: US-ASCII
         | 
| 8 | 
            +
                  string: ''
         | 
| 9 | 
            +
                headers:
         | 
| 10 | 
            +
                  User-Agent:
         | 
| 11 | 
            +
                  - Maremma - https://github.com/datacite/maremma
         | 
| 12 | 
            +
                  Accept:
         | 
| 13 | 
            +
                  - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
         | 
| 14 | 
            +
              response:
         | 
| 15 | 
            +
                status:
         | 
| 16 | 
            +
                  code: 200
         | 
| 17 | 
            +
                  message: ''
         | 
| 18 | 
            +
                headers:
         | 
| 19 | 
            +
                  Access-Control-Allow-Headers:
         | 
| 20 | 
            +
                  - Content-Type,Accept,Accept-Encoding,Origin,User-Agent,Cache-Control,Keep-Alive
         | 
| 21 | 
            +
                  Access-Control-Allow-Methods:
         | 
| 22 | 
            +
                  - GET, POST, OPTIONS
         | 
| 23 | 
            +
                  Access-Control-Allow-Origin:
         | 
| 24 | 
            +
                  - "*"
         | 
| 25 | 
            +
                  Access-Control-Max-Age:
         | 
| 26 | 
            +
                  - '1728000'
         | 
| 27 | 
            +
                  Cache-Control:
         | 
| 28 | 
            +
                  - max-age=0, private, must-revalidate
         | 
| 29 | 
            +
                  Content-Type:
         | 
| 30 | 
            +
                  - application/vnd.api+json; charset=utf-8
         | 
| 31 | 
            +
                  Date:
         | 
| 32 | 
            +
                  - Sun, 07 May 2017 10:43:07 GMT
         | 
| 33 | 
            +
                  Etag:
         | 
| 34 | 
            +
                  - W/"b9f2d79281c542db437c42a5bac25ac8"
         | 
| 35 | 
            +
                  Server:
         | 
| 36 | 
            +
                  - openresty/1.11.2.2
         | 
| 37 | 
            +
                  Status:
         | 
| 38 | 
            +
                  - 200 OK
         | 
| 39 | 
            +
                  Vary:
         | 
| 40 | 
            +
                  - Accept-Encoding
         | 
| 41 | 
            +
                  X-Content-Type-Options:
         | 
| 42 | 
            +
                  - nosniff
         | 
| 43 | 
            +
                  X-Frame-Options:
         | 
| 44 | 
            +
                  - SAMEORIGIN
         | 
| 45 | 
            +
                  X-Powered-By:
         | 
| 46 | 
            +
                  - Phusion Passenger 5.1.2
         | 
| 47 | 
            +
                  X-Request-Id:
         | 
| 48 | 
            +
                  - 84cab319-b0ab-48b4-a39a-94dcedabbc4b
         | 
| 49 | 
            +
                  X-Runtime:
         | 
| 50 | 
            +
                  - '0.580824'
         | 
| 51 | 
            +
                  X-Xss-Protection:
         | 
| 52 | 
            +
                  - 1; mode=block
         | 
| 53 | 
            +
                  Content-Length:
         | 
| 54 | 
            +
                  - '124'
         | 
| 55 | 
            +
                  Connection:
         | 
| 56 | 
            +
                  - keep-alive
         | 
| 57 | 
            +
                body:
         | 
| 58 | 
            +
                  encoding: UTF-8
         | 
| 59 | 
            +
                  string: '{"data":{"id":"10.5438","type":"prefixes","attributes":{"registration-agency":"DataCite","updated":"2016-09-21T20:27:15Z"}}}'
         | 
| 60 | 
            +
                http_version: 
         | 
| 61 | 
            +
              recorded_at: Sun, 07 May 2017 10:43:07 GMT
         | 
| 62 | 
            +
            - request:
         | 
| 63 | 
            +
                method: get
         | 
| 64 | 
            +
                uri: https://search.datacite.org/api?fl=doi,xml,media,minted,updated&q=doi:10.5438/4k3m-nyvg&wt=json
         | 
| 65 | 
            +
                body:
         | 
| 66 | 
            +
                  encoding: US-ASCII
         | 
| 67 | 
            +
                  string: ''
         | 
| 68 | 
            +
                headers:
         | 
| 69 | 
            +
                  User-Agent:
         | 
| 70 | 
            +
                  - Maremma - https://github.com/datacite/maremma
         | 
| 71 | 
            +
                  Accept:
         | 
| 72 | 
            +
                  - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
         | 
| 73 | 
            +
              response:
         | 
| 74 | 
            +
                status:
         | 
| 75 | 
            +
                  code: 200
         | 
| 76 | 
            +
                  message: ''
         | 
| 77 | 
            +
                headers:
         | 
| 78 | 
            +
                  Access-Control-Allow-Methods:
         | 
| 79 | 
            +
                  - GET, POST, OPTIONS
         | 
| 80 | 
            +
                  Access-Control-Allow-Origin:
         | 
| 81 | 
            +
                  - "*"
         | 
| 82 | 
            +
                  Content-Type:
         | 
| 83 | 
            +
                  - application/json;charset=UTF-8
         | 
| 84 | 
            +
                  Date:
         | 
| 85 | 
            +
                  - Sun, 07 May 2017 10:43:07 GMT
         | 
| 86 | 
            +
                  Server:
         | 
| 87 | 
            +
                  - openresty/1.11.2.2
         | 
| 88 | 
            +
                  Content-Length:
         | 
| 89 | 
            +
                  - '3025'
         | 
| 90 | 
            +
                  Connection:
         | 
| 91 | 
            +
                  - keep-alive
         | 
| 92 | 
            +
                body:
         | 
| 93 | 
            +
                  encoding: UTF-8
         | 
| 94 | 
            +
                  string: '{"responseHeader":{"status":0,"QTime":0},"response":{"numFound":1,"start":0,"docs":[{"xml":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHJlc291cmNlIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZ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hY3QiPkVhdGluZyB5b3VyIG93biBkb2cgZm9vZCBpcyBhIHNsYW5nIHRlcm0gdG8gZGVzY3JpYmUgdGhhdCBhbiBvcmdhbml6YXRpb24gc2hvdWxkIGl0c2VsZiB1c2UgdGhlIHByb2R1Y3RzIGFuZCBzZXJ2aWNlcyBpdCBwcm92aWRlcy4gRm9yIERhdGFDaXRlIHRoaXMgbWVhbnMgdGhhdCB3ZSBzaG91bGQgdXNlIERPSXMgd2l0aCBhcHByb3ByaWF0ZSBtZXRhZGF0YSBhbmQgc3RyYXRlZ2llcyBmb3IgbG9uZy10ZXJtIHByZXNlcnZhdGlvbiBmb3IuLi48L2Rlc2NyaXB0aW9uPgogIDwvZGVzY3JpcHRpb25zPgo8L3Jlc291cmNlPgo=","minted":"2016-12-19T20:49:21Z","updated":"2017-01-09T13:53:12Z","doi":"10.5438/4K3M-NYVG","media":["application/xml:https://blog.datacite.org/eating-your-own-dog-food/eating-your-own-dog-food.xml"]}]}}
         | 
| 95 | 
            +
             | 
| 96 | 
            +
            '
         | 
| 97 | 
            +
                http_version: 
         | 
| 98 | 
            +
              recorded_at: Sun, 07 May 2017 10:43:07 GMT
         | 
| 99 | 
            +
            recorded_with: VCR 3.0.3
         | 
    
        data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_string/crosscite.yml
    ADDED
    
    | @@ -0,0 +1,97 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            http_interactions:
         | 
| 3 | 
            +
            - request:
         | 
| 4 | 
            +
                method: get
         | 
| 5 | 
            +
                uri: https://api.datacite.org/prefixes/10.5438
         | 
| 6 | 
            +
                body:
         | 
| 7 | 
            +
                  encoding: US-ASCII
         | 
| 8 | 
            +
                  string: ''
         | 
| 9 | 
            +
                headers:
         | 
| 10 | 
            +
                  User-Agent:
         | 
| 11 | 
            +
                  - Maremma - https://github.com/datacite/maremma
         | 
| 12 | 
            +
                  Accept:
         | 
| 13 | 
            +
                  - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
         | 
| 14 | 
            +
              response:
         | 
| 15 | 
            +
                status:
         | 
| 16 | 
            +
                  code: 200
         | 
| 17 | 
            +
                  message: ''
         | 
| 18 | 
            +
                headers:
         | 
| 19 | 
            +
                  Access-Control-Allow-Headers:
         | 
| 20 | 
            +
                  - Content-Type,Accept,Accept-Encoding,Origin,User-Agent,Cache-Control,Keep-Alive
         | 
| 21 | 
            +
                  Access-Control-Allow-Methods:
         | 
| 22 | 
            +
                  - GET, POST, OPTIONS
         | 
| 23 | 
            +
                  Access-Control-Allow-Origin:
         | 
| 24 | 
            +
                  - "*"
         | 
| 25 | 
            +
                  Access-Control-Max-Age:
         | 
| 26 | 
            +
                  - '1728000'
         | 
| 27 | 
            +
                  Cache-Control:
         | 
| 28 | 
            +
                  - max-age=0, private, must-revalidate
         | 
| 29 | 
            +
                  Content-Type:
         | 
| 30 | 
            +
                  - application/vnd.api+json; charset=utf-8
         | 
| 31 | 
            +
                  Date:
         | 
| 32 | 
            +
                  - Sun, 07 May 2017 12:54:14 GMT
         | 
| 33 | 
            +
                  Etag:
         | 
| 34 | 
            +
                  - W/"b9f2d79281c542db437c42a5bac25ac8"
         | 
| 35 | 
            +
                  Server:
         | 
| 36 | 
            +
                  - openresty/1.11.2.2
         | 
| 37 | 
            +
                  Status:
         | 
| 38 | 
            +
                  - 200 OK
         | 
| 39 | 
            +
                  Vary:
         | 
| 40 | 
            +
                  - Accept-Encoding
         | 
| 41 | 
            +
                  X-Content-Type-Options:
         | 
| 42 | 
            +
                  - nosniff
         | 
| 43 | 
            +
                  X-Frame-Options:
         | 
| 44 | 
            +
                  - SAMEORIGIN
         | 
| 45 | 
            +
                  X-Powered-By:
         | 
| 46 | 
            +
                  - Phusion Passenger 5.1.2
         | 
| 47 | 
            +
                  X-Request-Id:
         | 
| 48 | 
            +
                  - 0972f784-74e3-403c-b928-2354f2930fcd
         | 
| 49 | 
            +
                  X-Runtime:
         | 
| 50 | 
            +
                  - '0.776127'
         | 
| 51 | 
            +
                  X-Xss-Protection:
         | 
| 52 | 
            +
                  - 1; mode=block
         | 
| 53 | 
            +
                  Connection:
         | 
| 54 | 
            +
                  - keep-alive
         | 
| 55 | 
            +
                body:
         | 
| 56 | 
            +
                  encoding: UTF-8
         | 
| 57 | 
            +
                  string: '{"data":{"id":"10.5438","type":"prefixes","attributes":{"registration-agency":"DataCite","updated":"2016-09-21T20:27:15Z"}}}'
         | 
| 58 | 
            +
                http_version: 
         | 
| 59 | 
            +
              recorded_at: Sun, 07 May 2017 12:54:14 GMT
         | 
| 60 | 
            +
            - request:
         | 
| 61 | 
            +
                method: get
         | 
| 62 | 
            +
                uri: https://search.datacite.org/api?fl=doi,xml,media,minted,updated&q=doi:10.5438/4k3m-nyvg&wt=json
         | 
| 63 | 
            +
                body:
         | 
| 64 | 
            +
                  encoding: US-ASCII
         | 
| 65 | 
            +
                  string: ''
         | 
| 66 | 
            +
                headers:
         | 
| 67 | 
            +
                  User-Agent:
         | 
| 68 | 
            +
                  - Maremma - https://github.com/datacite/maremma
         | 
| 69 | 
            +
                  Accept:
         | 
| 70 | 
            +
                  - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
         | 
| 71 | 
            +
              response:
         | 
| 72 | 
            +
                status:
         | 
| 73 | 
            +
                  code: 200
         | 
| 74 | 
            +
                  message: ''
         | 
| 75 | 
            +
                headers:
         | 
| 76 | 
            +
                  Access-Control-Allow-Methods:
         | 
| 77 | 
            +
                  - GET, POST, OPTIONS
         | 
| 78 | 
            +
                  Access-Control-Allow-Origin:
         | 
| 79 | 
            +
                  - "*"
         | 
| 80 | 
            +
                  Content-Type:
         | 
| 81 | 
            +
                  - application/json;charset=UTF-8
         | 
| 82 | 
            +
                  Date:
         | 
| 83 | 
            +
                  - Sun, 07 May 2017 12:54:14 GMT
         | 
| 84 | 
            +
                  Server:
         | 
| 85 | 
            +
                  - openresty/1.11.2.2
         | 
| 86 | 
            +
                  Content-Length:
         | 
| 87 | 
            +
                  - '3025'
         | 
| 88 | 
            +
                  Connection:
         | 
| 89 | 
            +
                  - keep-alive
         | 
| 90 | 
            +
                body:
         | 
| 91 | 
            +
                  encoding: UTF-8
         | 
| 92 | 
            +
                  string: '{"responseHeader":{"status":0,"QTime":0},"response":{"numFound":1,"start":0,"docs":[{"xml":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHJlc291cmNlIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtNCIgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtNCBodHRwOi8vc2NoZW1hLmRhdGFjaXRlLm9yZy9tZXRhL2tlcm5lbC00L21ldGFkYXRhLnhzZCI+CiAgPGlkZW50aWZpZXIgaWRlbnRpZmllclR5cGU9IkRPSSI+MTAuNTQzOC80SzNNLU5ZVkc8L2lkZW50aWZpZXI+CiAgPGNyZWF0b3JzPgogICAgPGNyZWF0b3I+CiAgICAgIDxjcmVhdG9yTmFtZT5GZW5uZXIsIE1hcnRpbjwvY3JlYXRvck5hbWU+CiAgICAgIDxnaXZlbk5hbWU+TWFydGluPC9naXZlbk5hbWU+CiAgICAgIDxmYW1pbHlOYW1lPkZlbm5lcjwvZmFtaWx5TmFtZT4KICAgICAgPG5hbWVJZGVudGlmaWVyIHNjaGVtZVVSST0iaHR0cDovL29yY2lkLm9yZy8iIG5hbWVJZGVudGlmaWVyU2NoZW1lPSJPUkNJRCI+MDAwMC0wMDAzLTE0MTktMjQwNTwvbmFtZUlkZW50aWZpZXI+CiAgICA8L2NyZWF0b3I+CiAgPC9jcmVhdG9ycz4KICA8dGl0bGVzPgogICAgPHRpdGxlPkVhdGluZyB5b3VyIG93biBEb2cgRm9v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WxhdGlvblR5cGU9IlJlZmVyZW5jZXMiPjEwLjU0MzgvNTVFNS1UNUMwPC9yZWxhdGVkSWRlbnRpZmllcj4KICAgIDxyZWxhdGVkSWRlbnRpZmllciByZWxhdGVkSWRlbnRpZmllclR5cGU9IkRPSSIgcmVsYXRpb25UeXBlPSJJc1BhcnRPZiI+MTAuNTQzOC8wMDAwLTAwU1M8L3JlbGF0ZWRJZGVudGlmaWVyPgogIDwvcmVsYXRlZElkZW50aWZpZXJzPgogIDx2ZXJzaW9uPjEuMDwvdmVyc2lvbj4KICA8ZGVzY3JpcHRpb25zPgogICAgPGRlc2NyaXB0aW9uIGRlc2NyaXB0aW9uVHlwZT0iQWJzdHJhY3QiPkVhdGluZyB5b3VyIG93biBkb2cgZm9vZCBpcyBhIHNsYW5nIHRlcm0gdG8gZGVzY3JpYmUgdGhhdCBhbiBvcmdhbml6YXRpb24gc2hvdWxkIGl0c2VsZiB1c2UgdGhlIHByb2R1Y3RzIGFuZCBzZXJ2aWNlcyBpdCBwcm92aWRlcy4gRm9yIERhdGFDaXRlIHRoaXMgbWVhbnMgdGhhdCB3ZSBzaG91bGQgdXNlIERPSXMgd2l0aCBhcHByb3ByaWF0ZSBtZXRhZGF0YSBhbmQgc3RyYXRlZ2llcyBmb3IgbG9uZy10ZXJtIHByZXNlcnZhdGlvbiBmb3IuLi48L2Rlc2NyaXB0aW9uPgogIDwvZGVzY3JpcHRpb25zPgo8L3Jlc291cmNlPgo=","minted":"2016-12-19T20:49:21Z","updated":"2017-01-09T13:53:12Z","doi":"10.5438/4K3M-NYVG","media":["application/xml:https://blog.datacite.org/eating-your-own-dog-food/eating-your-own-dog-food.xml"]}]}}
         | 
| 93 | 
            +
             | 
| 94 | 
            +
            '
         | 
| 95 | 
            +
                http_version: 
         | 
| 96 | 
            +
              recorded_at: Sun, 07 May 2017 12:54:14 GMT
         | 
| 97 | 
            +
            recorded_with: VCR 3.0.3
         | 
    
        data/spec/metadata_spec.rb
    CHANGED
    
    | @@ -91,6 +91,13 @@ describe Bolognese::Metadata, vcr: true do | |
| 91 91 | 
             
                  expect(subject.find_from_format(string: string, ext: ext)).to eq("citeproc")
         | 
| 92 92 | 
             
                end
         | 
| 93 93 |  | 
| 94 | 
            +
                it "crosscite" do
         | 
| 95 | 
            +
                  file = fixture_path + "crosscite.json"
         | 
| 96 | 
            +
                  string = IO.read(file)
         | 
| 97 | 
            +
                  ext = File.extname(file)
         | 
| 98 | 
            +
                  expect(subject.find_from_format(string: string, ext: ext)).to eq("crosscite")
         | 
| 99 | 
            +
                end
         | 
| 100 | 
            +
             | 
| 94 101 | 
             
                it "codemeta" do
         | 
| 95 102 | 
             
                  file = fixture_path + "codemeta.json"
         | 
| 96 103 | 
             
                  string = IO.read(file)
         | 
| @@ -99,6 +106,14 @@ describe Bolognese::Metadata, vcr: true do | |
| 99 106 | 
             
                end
         | 
| 100 107 | 
             
              end
         | 
| 101 108 |  | 
| 109 | 
            +
              context "find from format from string" do
         | 
| 110 | 
            +
                it "crosscite" do
         | 
| 111 | 
            +
                  file = fixture_path + "crosscite.json"
         | 
| 112 | 
            +
                  string = IO.read(file)
         | 
| 113 | 
            +
                  expect(subject.find_from_format(string: string)).to eq("crosscite")
         | 
| 114 | 
            +
                end
         | 
| 115 | 
            +
              end
         | 
| 116 | 
            +
             | 
| 102 117 | 
             
              context "jsonlint" do
         | 
| 103 118 | 
             
                it "valid" do
         | 
| 104 119 | 
             
                  json = IO.read(fixture_path + "datacite_software.json")
         | 
| @@ -0,0 +1,39 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Bolognese::Metadata, vcr: true do
         | 
| 4 | 
            +
              let(:input) { fixture_path + "crosscite.json" }
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              subject { Bolognese::Metadata.new(input: input) }
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              context "get crosscite raw" do
         | 
| 9 | 
            +
                it "SoftwareSourceCode" do
         | 
| 10 | 
            +
                  expect(subject.raw).to eq(IO.read(input))
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              context "get crosscite metadata" do
         | 
| 15 | 
            +
                it "SoftwareSourceCode" do
         | 
| 16 | 
            +
                  expect(subject.valid?).to be true
         | 
| 17 | 
            +
                  expect(subject.id).to eq("https://doi.org/10.5281/zenodo.48440")
         | 
| 18 | 
            +
                  expect(subject.type).to eq("SoftwareSourceCode")
         | 
| 19 | 
            +
                  expect(subject.resource_type_general).to eq("Software")
         | 
| 20 | 
            +
                  expect(subject.author).to eq("type"=>"Person", "familyName" => "Garza", "givenName" => "Kristian", "name" => "Kristian Garza")
         | 
| 21 | 
            +
                  expect(subject.title).to eq("Analysis Tools for Crossover Experiment of UI using Choice Architecture")
         | 
| 22 | 
            +
                  expect(subject.description["text"]).to start_with("This tools are used to analyse the data produced by the Crosssover Experiment")
         | 
| 23 | 
            +
                  expect(subject.date_published).to eq("2016-03-27")
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                it "SoftwareSourceCode as string" do
         | 
| 27 | 
            +
                  input = IO.read(fixture_path + "crosscite.json")
         | 
| 28 | 
            +
                  subject = Bolognese::Metadata.new(input: input)
         | 
| 29 | 
            +
                  expect(subject.valid?).to be true
         | 
| 30 | 
            +
                  expect(subject.id).to eq("https://doi.org/10.5281/zenodo.48440")
         | 
| 31 | 
            +
                  expect(subject.type).to eq("SoftwareSourceCode")
         | 
| 32 | 
            +
                  expect(subject.resource_type_general).to eq("Software")
         | 
| 33 | 
            +
                  expect(subject.author).to eq("type"=>"Person", "familyName" => "Garza", "givenName" => "Kristian", "name" => "Kristian Garza")
         | 
| 34 | 
            +
                  expect(subject.title).to eq("Analysis Tools for Crossover Experiment of UI using Choice Architecture")
         | 
| 35 | 
            +
                  expect(subject.description["text"]).to start_with("This tools are used to analyse the data produced by the Crosssover Experiment")
         | 
| 36 | 
            +
                  expect(subject.date_published).to eq("2016-03-27")
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: bolognese
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.9. | 
| 4 | 
            +
              version: 0.9.14
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Martin Fenner
         | 
| @@ -520,6 +520,7 @@ files: | |
| 520 520 | 
             
            - spec/doi_utils_spec.rb
         | 
| 521 521 | 
             
            - spec/fixtures/citeproc.json
         | 
| 522 522 | 
             
            - spec/fixtures/codemeta.json
         | 
| 523 | 
            +
            - spec/fixtures/crosscite.json
         | 
| 523 524 | 
             
            - spec/fixtures/crossref.bib
         | 
| 524 525 | 
             
            - spec/fixtures/crossref.ris
         | 
| 525 526 | 
             
            - spec/fixtures/crossref.xml
         | 
| @@ -568,11 +569,13 @@ files: | |
| 568 569 | 
             
            - spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/bibtex.yml
         | 
| 569 570 | 
             
            - spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/citeproc.yml
         | 
| 570 571 | 
             
            - spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/codemeta.yml
         | 
| 572 | 
            +
            - spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/crosscite.yml
         | 
| 571 573 | 
             
            - spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/crossref.yml
         | 
| 572 574 | 
             
            - spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/datacite.yml
         | 
| 573 575 | 
             
            - spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/datacite_json.yml
         | 
| 574 576 | 
             
            - spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/ris.yml
         | 
| 575 577 | 
             
            - spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/schema_org.yml
         | 
| 578 | 
            +
            - spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_string/crosscite.yml
         | 
| 576 579 | 
             
            - spec/fixtures/vcr_cassettes/Bolognese_Metadata/from_schema_org/with_id.yml
         | 
| 577 580 | 
             
            - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_codemeta_metadata/maremma.yml
         | 
| 578 581 | 
             
            - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_codemeta_metadata/no_codemeta_json.yml
         | 
| @@ -732,6 +735,7 @@ files: | |
| 732 735 | 
             
            - spec/readers/bibtex_reader_spec.rb
         | 
| 733 736 | 
             
            - spec/readers/citeproc_reader_spec.rb
         | 
| 734 737 | 
             
            - spec/readers/codemeta_reader_spec.rb
         | 
| 738 | 
            +
            - spec/readers/crosscite_reader_spec.rb
         | 
| 735 739 | 
             
            - spec/readers/crossref_reader_spec.rb
         | 
| 736 740 | 
             
            - spec/readers/datacite_json_reader_spec.rb
         | 
| 737 741 | 
             
            - spec/readers/datacite_reader_spec.rb
         |