serrano
Advanced tools
@@ -17,2 +17,4 @@ name: Ruby | ||
| runs-on: ${{ matrix.os }} | ||
| env: | ||
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
| steps: | ||
@@ -27,4 +29,4 @@ - uses: actions/checkout@v2 | ||
| - name: Run tests | ||
| run: bundle exec rake test TESTOPTS="-v" | ||
| - name: Run rubocop | ||
| run: bundle exec rubocop | ||
| run: | | ||
| bundle exec rake install | ||
| bundle exec rake test TESTOPTS="-v" |
+1
-1
@@ -29,3 +29,3 @@ *.gem | ||
| # intended to run in multiple environments; otherwise, check them in: | ||
| #Gemfile.lock | ||
| Gemfile.lock | ||
| .ruby-version | ||
@@ -32,0 +32,0 @@ .ruby-gemset |
+4
-0
@@ -0,1 +1,5 @@ | ||
| ## 1.0.0 (2020-10-19) | ||
| * updated dependency versions | ||
| ## 0.6.2 (2020-05-29) | ||
@@ -2,0 +6,0 @@ |
+1
-1
| # frozen_string_literal: true | ||
| source 'https://rubygems.org' | ||
| source "https://rubygems.org" | ||
| gemspec |
+61
-62
| # frozen_string_literal: true | ||
| require 'erb' | ||
| require 'serrano/version' | ||
| require 'serrano/request' | ||
| require 'serrano/request_cursor' | ||
| require 'serrano/filterhandler' | ||
| require 'serrano/cnrequest' | ||
| require 'serrano/filters' | ||
| require 'serrano/styles' | ||
| require "erb" | ||
| require "serrano/version" | ||
| require "serrano/request" | ||
| require "serrano/request_cursor" | ||
| require "serrano/filterhandler" | ||
| require "serrano/cnrequest" | ||
| require "serrano/filters" | ||
| require "serrano/styles" | ||
| require 'rexml/document' | ||
| require 'rexml/xpath' | ||
| require "rexml/document" | ||
| require "rexml/xpath" | ||
@@ -155,4 +155,4 @@ # @!macro serrano_params | ||
| define_setting :access_secret | ||
| define_setting :mailto, ENV['CROSSREF_EMAIL'] | ||
| define_setting :base_url, 'https://api.crossref.org/' | ||
| define_setting :mailto, ENV["CROSSREF_EMAIL"] | ||
| define_setting :base_url, "https://api.crossref.org/" | ||
@@ -233,10 +233,10 @@ ## | ||
| def self.works(ids: nil, query: nil, filter: nil, offset: nil, | ||
| limit: nil, sample: nil, sort: nil, order: nil, facet: nil, | ||
| select: nil, options: nil, verbose: false, cursor: nil, | ||
| cursor_max: 5000, **args) | ||
| limit: nil, sample: nil, sort: nil, order: nil, facet: nil, | ||
| select: nil, options: nil, verbose: false, cursor: nil, | ||
| cursor_max: 5000, **args) | ||
| assert_valid_filters(filter) if filter | ||
| RequestCursor.new('works', ids, query, filter, offset, | ||
| limit, sample, sort, order, facet, select, nil, nil, options, | ||
| verbose, cursor, cursor_max, args).perform | ||
| RequestCursor.new("works", ids, query, filter, offset, | ||
| limit, sample, sort, order, facet, select, nil, nil, options, | ||
| verbose, cursor, cursor_max, args).perform | ||
| end | ||
@@ -291,10 +291,10 @@ | ||
| def self.members(ids: nil, query: nil, filter: nil, offset: nil, | ||
| limit: nil, sample: nil, sort: nil, order: nil, facet: nil, | ||
| select: nil, works: false, options: nil, verbose: false, | ||
| cursor: nil, cursor_max: 5000, **args) | ||
| limit: nil, sample: nil, sort: nil, order: nil, facet: nil, | ||
| select: nil, works: false, options: nil, verbose: false, | ||
| cursor: nil, cursor_max: 5000, **args) | ||
| assert_valid_filters(filter) if filter | ||
| RequestCursor.new('members', ids, query, filter, offset, | ||
| limit, sample, sort, order, facet, select, works, nil, | ||
| options, verbose, cursor, cursor_max, args).perform | ||
| RequestCursor.new("members", ids, query, filter, offset, | ||
| limit, sample, sort, order, facet, select, works, nil, | ||
| options, verbose, cursor, cursor_max, args).perform | ||
| end | ||
@@ -340,10 +340,10 @@ | ||
| def self.prefixes(ids:, filter: nil, offset: nil, | ||
| limit: nil, sample: nil, sort: nil, order: nil, facet: nil, | ||
| select: nil, works: false, options: nil, verbose: false, | ||
| cursor: nil, cursor_max: 5000, **args) | ||
| limit: nil, sample: nil, sort: nil, order: nil, facet: nil, | ||
| select: nil, works: false, options: nil, verbose: false, | ||
| cursor: nil, cursor_max: 5000, **args) | ||
| assert_valid_filters(filter) if filter | ||
| RequestCursor.new('prefixes', ids, nil, filter, offset, | ||
| limit, sample, sort, order, facet, select, works, nil, | ||
| options, verbose, cursor, cursor_max, args).perform | ||
| RequestCursor.new("prefixes", ids, nil, filter, offset, | ||
| limit, sample, sort, order, facet, select, works, nil, | ||
| options, verbose, cursor, cursor_max, args).perform | ||
| end | ||
@@ -394,10 +394,10 @@ | ||
| def self.funders(ids: nil, query: nil, filter: nil, offset: nil, | ||
| limit: nil, sample: nil, sort: nil, order: nil, facet: nil, | ||
| select: nil, works: false, options: nil, verbose: false, | ||
| cursor: nil, cursor_max: 5000, **args) | ||
| limit: nil, sample: nil, sort: nil, order: nil, facet: nil, | ||
| select: nil, works: false, options: nil, verbose: false, | ||
| cursor: nil, cursor_max: 5000, **args) | ||
| assert_valid_filters(filter) if filter | ||
| RequestCursor.new('funders', ids, query, filter, offset, | ||
| limit, sample, sort, order, facet, select, works, nil, options, | ||
| verbose, cursor, cursor_max, args).perform | ||
| RequestCursor.new("funders", ids, query, filter, offset, | ||
| limit, sample, sort, order, facet, select, works, nil, options, | ||
| verbose, cursor, cursor_max, args).perform | ||
| end | ||
@@ -448,10 +448,10 @@ | ||
| def self.journals(ids: nil, query: nil, filter: nil, offset: nil, | ||
| limit: nil, sample: nil, sort: nil, order: nil, facet: nil, | ||
| select: nil, works: false, options: nil, verbose: false, | ||
| cursor: nil, cursor_max: 5000, **args) | ||
| limit: nil, sample: nil, sort: nil, order: nil, facet: nil, | ||
| select: nil, works: false, options: nil, verbose: false, | ||
| cursor: nil, cursor_max: 5000, **args) | ||
| assert_valid_filters(filter) if filter | ||
| RequestCursor.new('journals', ids, query, filter, offset, | ||
| limit, sample, sort, order, facet, select, works, nil, options, | ||
| verbose, cursor, cursor_max, args).perform | ||
| RequestCursor.new("journals", ids, query, filter, offset, | ||
| limit, sample, sort, order, facet, select, works, nil, options, | ||
| verbose, cursor, cursor_max, args).perform | ||
| end | ||
@@ -494,7 +494,7 @@ | ||
| def self.types(ids: nil, offset: nil, limit: nil, select: nil, works: false, | ||
| options: nil, verbose: false, cursor: nil, cursor_max: 5000, **args) | ||
| options: nil, verbose: false, cursor: nil, cursor_max: 5000, **args) | ||
| RequestCursor.new('types', ids, nil, nil, offset, | ||
| limit, nil, nil, nil, nil, select, works, nil, options, | ||
| verbose, cursor, cursor_max, args).perform | ||
| RequestCursor.new("types", ids, nil, nil, offset, | ||
| limit, nil, nil, nil, nil, select, works, nil, options, | ||
| verbose, cursor, cursor_max, args).perform | ||
| end | ||
@@ -535,7 +535,7 @@ | ||
| def self.licenses(query: nil, offset: nil, | ||
| limit: nil, sample: nil, sort: nil, order: nil, | ||
| facet: nil, options: nil, verbose: false) | ||
| limit: nil, sample: nil, sort: nil, order: nil, | ||
| facet: nil, options: nil, verbose: false) | ||
| Request.new('licenses', nil, query, nil, offset, | ||
| limit, sample, sort, order, facet, nil, nil, nil, options, verbose).perform | ||
| Request.new("licenses", nil, query, nil, offset, | ||
| limit, sample, sort, order, facet, nil, nil, nil, options, verbose).perform | ||
| end | ||
@@ -555,4 +555,4 @@ | ||
| def self.registration_agency(ids:, options: nil, verbose: false) | ||
| Request.new('works', ids, nil, nil, nil, | ||
| nil, nil, nil, nil, nil, nil, false, true, options, verbose).perform | ||
| Request.new("works", ids, nil, nil, nil, | ||
| nil, nil, nil, nil, nil, nil, false, true, options, verbose).perform | ||
| end | ||
@@ -578,5 +578,5 @@ | ||
| def self.random_dois(sample: 10, options: nil, verbose: false) | ||
| tmp = Request.new('works', nil, nil, nil, nil, | ||
| nil, sample, nil, nil, nil, nil, false, nil, options, verbose).perform | ||
| tmp['message']['items'].collect { |x| x['DOI'] } | ||
| tmp = Request.new("works", nil, nil, nil, nil, | ||
| nil, sample, nil, nil, nil, nil, false, nil, options, verbose).perform | ||
| tmp["message"]["items"].collect { |x| x["DOI"] } | ||
| end | ||
@@ -644,3 +644,3 @@ | ||
| # puts x | ||
| def self.content_negotiation(ids:, format: 'bibtex', style: 'apa', locale: 'en-US') | ||
| def self.content_negotiation(ids:, format: "bibtex", style: "apa", locale: "en-US") | ||
| ids = Array(ids).map { |x| ERB::Util.url_encode(x) } | ||
@@ -665,13 +665,12 @@ CNRequest.new(ids, format, style, locale).perform | ||
| # Serrano.citation_count(doi: "10.1016/j.fbr.2012") | ||
| def self.citation_count(doi:, url: 'https://www.crossref.org/openurl/', | ||
| key: 'cboettig@ropensci.org', options: nil) | ||
| def self.citation_count(doi:, url: "https://www.crossref.org/openurl/", | ||
| key: "cboettig@ropensci.org", options: nil) | ||
| args = { id: 'doi:' + doi, pid: key, noredirect: true } | ||
| args = {id: "doi:" + doi, pid: key, noredirect: true} | ||
| opts = args.delete_if { |_k, v| v.nil? } | ||
| conn = Faraday.new(url: url, request: options) | ||
| res = conn.get '', opts | ||
| res = conn.get "", opts | ||
| x = res.body | ||
| oc = REXML::Document.new("<doc>#{x}</doc>") | ||
| value = REXML::XPath.first(oc, '//query').attributes['fl_count'].to_i | ||
| value | ||
| REXML::XPath.first(oc, "//query").attributes["fl_count"].to_i | ||
| end | ||
@@ -678,0 +677,0 @@ |
| # frozen_string_literal: true | ||
| require 'serrano/version' | ||
| require 'serrano/cnrequest' | ||
| require "serrano/version" | ||
| require "serrano/cnrequest" | ||
@@ -17,3 +17,3 @@ ## | ||
| def initialize(ids, format = 'bibtex', style = 'apa', locale = 'en-US') | ||
| def initialize(ids, format = "bibtex", style = "apa", locale = "en-US") | ||
| self.ids = ids | ||
@@ -20,0 +20,0 @@ self.format = format |
+30
-30
| # frozen_string_literal: true | ||
| require 'faraday' | ||
| require 'faraday_middleware' | ||
| require 'multi_json' | ||
| require 'serrano/error' | ||
| require 'serrano/utils' | ||
| require 'serrano/helpers/configuration' | ||
| require "faraday" | ||
| require "faraday_middleware" | ||
| require "multi_json" | ||
| require "serrano/error" | ||
| require "serrano/utils" | ||
| require "serrano/helpers/configuration" | ||
| CN_FORMAT_HEADERS = { 'rdf-xml' => 'application/rdf+xml', | ||
| 'turtle' => 'text/turtle', | ||
| 'citeproc-json' => 'transform/application/vnd.citationstyles.csl+json', | ||
| 'text' => 'text/x-bibliography', | ||
| 'ris' => 'application/x-research-info-systems', | ||
| 'bibtex' => 'application/x-bibtex', | ||
| 'crossref-xml' => 'application/vnd.crossref.unixref+xml', | ||
| 'datacite-xml' => 'application/vnd.datacite.datacite+xml', | ||
| 'bibentry' => 'application/x-bibtex', | ||
| 'crossref-tdm' => 'application/vnd.crossref.unixsd+xml' }.freeze | ||
| CN_FORMAT_HEADERS = {"rdf-xml" => "application/rdf+xml", | ||
| "turtle" => "text/turtle", | ||
| "citeproc-json" => "transform/application/vnd.citationstyles.csl+json", | ||
| "text" => "text/x-bibliography", | ||
| "ris" => "application/x-research-info-systems", | ||
| "bibtex" => "application/x-bibtex", | ||
| "crossref-xml" => "application/vnd.crossref.unixref+xml", | ||
| "datacite-xml" => "application/vnd.datacite.datacite+xml", | ||
| "bibentry" => "application/x-bibtex", | ||
| "crossref-tdm" => "application/vnd.crossref.unixsd+xml"}.freeze | ||
@@ -33,5 +33,5 @@ ## | ||
| CN_FORMATS = %w[rdf-xml turtle citeproc-json | ||
| citeproc-json-ish text ris bibtex | ||
| crossref-xml datacite-xml bibentry | ||
| crossref-tdm].freeze | ||
| citeproc-json-ish text ris bibtex | ||
| crossref-xml datacite-xml bibentry | ||
| crossref-tdm].freeze | ||
@@ -47,6 +47,6 @@ def initialize(ids, format, style, locale) | ||
| unless CN_FORMATS.include? format | ||
| raise 'format not one of accepted types' | ||
| raise "format not one of accepted types" | ||
| end | ||
| conn = Faraday.new 'https://doi.org/' do |c| | ||
| conn = Faraday.new "https://doi.org/" do |c| | ||
| c.use FaradayMiddleware::FollowRedirects | ||
@@ -73,19 +73,19 @@ c.adapter :net_http | ||
| if format == 'citeproc-json' | ||
| endpt = 'https://api.crossref.org/works/' + ids + '/' + type | ||
| if format == "citeproc-json" | ||
| endpt = "https://api.crossref.org/works/" + ids + "/" + type | ||
| cr_works = Faraday.new(url: endpt) | ||
| cr_works.headers[:user_agent] = make_ua | ||
| cr_works.headers['X-USER-AGENT'] = make_ua | ||
| cr_works.headers["X-USER-AGENT"] = make_ua | ||
| res = cr_works.get | ||
| else | ||
| if format == 'text' | ||
| type = type + '; style = ' + style + '; locale = ' + locale | ||
| if format == "text" | ||
| type = type + "; style = " + style + "; locale = " + locale | ||
| end | ||
| res = conn.get do |req| | ||
| res = conn.get { |req| | ||
| req.url ids | ||
| req.headers['Accept'] = type | ||
| req.headers["Accept"] = type | ||
| req.headers[:user_agent] = make_ua | ||
| req.headers['X-USER-AGENT'] = make_ua | ||
| end | ||
| req.headers["X-USER-AGENT"] = make_ua | ||
| } | ||
| end | ||
@@ -92,0 +92,0 @@ |
+11
-11
| # frozen_string_literal: true | ||
| require 'faraday' | ||
| require 'multi_json' | ||
| require "faraday" | ||
| require "multi_json" | ||
@@ -18,9 +18,9 @@ # @private | ||
| when 500 | ||
| raise Serrano::InternalServerError, error_message_500(response, 'Something is technically wrong.') | ||
| raise Serrano::InternalServerError, error_message_500(response, "Something is technically wrong.") | ||
| when 502 | ||
| raise Serrano::BadGateway, error_message_500(response, 'The server returned an invalid or incomplete response.') | ||
| raise Serrano::BadGateway, error_message_500(response, "The server returned an invalid or incomplete response.") | ||
| when 503 | ||
| raise Serrano::ServiceUnavailable, error_message_500(response, 'Crossref is rate limiting your requests.') | ||
| raise Serrano::ServiceUnavailable, error_message_500(response, "Crossref is rate limiting your requests.") | ||
| when 504 | ||
| raise Serrano::GatewayTimeout, error_message_500(response, '504 Gateway Time-out') | ||
| raise Serrano::GatewayTimeout, error_message_500(response, "504 Gateway Time-out") | ||
| end | ||
@@ -45,8 +45,8 @@ end | ||
| body = ::MultiJson.load(body) | ||
| if body['message'].nil? | ||
| if body["message"].nil? | ||
| body = nil | ||
| elseif body['message'].length == 1 | ||
| body = body['message'] | ||
| elseif body["message"].length == 1 | ||
| body = body["message"] | ||
| else | ||
| body = body['message'].collect { |x| x['message'] }.join('; ') | ||
| body = body["message"].collect { |x| x["message"] }.join("; ") | ||
| end | ||
@@ -64,3 +64,3 @@ end | ||
| def error_message_500(response, body = nil) | ||
| "#{response[:method].to_s.upcase} #{response[:url]}: #{[response[:status].to_s + ':', body].compact.join(' ')}" | ||
| "#{response[:method].to_s.upcase} #{response[:url]}: #{[response[:status].to_s + ":", body].compact.join(" ")}" | ||
| end | ||
@@ -67,0 +67,0 @@ |
@@ -7,3 +7,3 @@ # frozen_string_literal: true | ||
| others = %w[license_url license_version license_delay full_text_version full_text_type | ||
| award_number award_funder] | ||
| award_number award_funder] | ||
| if x.nil? | ||
@@ -15,19 +15,19 @@ nil | ||
| if nn.collect { |w| others.include? w }.any? | ||
| nn = nn.collect do |b| | ||
| nn = nn.collect { |b| | ||
| if others.include? b | ||
| case b | ||
| when 'license_url' | ||
| 'license.url' | ||
| when 'license_version' | ||
| 'license.version' | ||
| when 'license_delay' | ||
| 'license.delay' | ||
| when 'full_text_version' | ||
| 'full-text.version' | ||
| when 'full_text_type' | ||
| 'full-text.type' | ||
| when 'award_number' | ||
| 'award.number' | ||
| when 'award_funder' | ||
| 'award.funder' | ||
| when "license_url" | ||
| "license.url" | ||
| when "license_version" | ||
| "license.version" | ||
| when "license_delay" | ||
| "license.delay" | ||
| when "full_text_version" | ||
| "full-text.version" | ||
| when "full_text_type" | ||
| "full-text.type" | ||
| when "award_number" | ||
| "award.number" | ||
| when "award_funder" | ||
| "award.funder" | ||
| end | ||
@@ -37,9 +37,9 @@ else | ||
| end | ||
| end | ||
| } | ||
| end | ||
| newnn = nn.collect { |m| m.tr('_', '-') } | ||
| newnn = nn.collect { |m| m.tr("_", "-") } | ||
| x = rename_keys(x, newnn) | ||
| x = x.collect { |k, v| [k, v].join(':') }.join(',') | ||
| x | ||
| x.collect { |k, v| [k, v].join(":") }.join(",") | ||
| end | ||
@@ -46,0 +46,0 @@ end |
+67
-67
@@ -31,71 +31,71 @@ # frozen_string_literal: true | ||
| FILTER_DETAILS = { | ||
| 'has_funder' => { 'possible_values' => nil, 'description' => 'metadata which includes one or more funder entry' }, | ||
| 'funder' => { 'possible_values' => '{funder_id}', 'description' => 'metadata which include the {funder_id} in FundRef data' }, | ||
| 'location' => { 'possible_values' => '{country_name}', 'description' => 'funder records where location = {country name}. Only works on /funders route' }, | ||
| 'prefix' => { 'possible_values' => '{owner_prefix}', 'description' => "metadata belonging to a DOI owner prefix {owner_prefix} (e.g. '10.1016' )" }, | ||
| 'member' => { 'possible_values' => '{member_id}', 'description' => 'metadata belonging to a CrossRef member' }, | ||
| 'from_index_date' => { 'possible_values' => '{date}', 'description' => 'metadata indexed since (inclusive) {date}' }, | ||
| 'until_index_date' => { 'possible_values' => '{date}', 'description' => 'metadata indexed before (inclusive) {date}' }, | ||
| 'from_deposit_date' => { 'possible_values' => '{date}', 'description' => 'metadata last (re)deposited since (inclusive) {date}' }, | ||
| 'until_deposit_date' => { 'possible_values' => '{date}', 'description' => 'metadata last (re)deposited before (inclusive) {date}' }, | ||
| 'from_update_date' => { 'possible_values' => '{date}', 'description' => "Metadata updated since (inclusive) {date} Currently the same as 'from_deposit_date'" }, | ||
| 'until_update_date' => { 'possible_values' => '{date}', 'description' => "Metadata updated before (inclusive) {date} Currently the same as 'until_deposit_date'" }, | ||
| 'from_created_date' => { 'possible_values' => '{date}', 'description' => 'metadata first deposited since (inclusive) {date}' }, | ||
| 'until_created_date' => { 'possible_values' => '{date}', 'description' => 'metadata first deposited before (inclusive) {date}' }, | ||
| 'from_pub_date' => { 'possible_values' => '{date}', 'description' => 'metadata where published date is since (inclusive) {date}' }, | ||
| 'until_pub_date' => { 'possible_values' => '{date}', 'description' => 'metadata where published date is before (inclusive) {date}' }, | ||
| 'from_online_pub_date' => { 'possible_values' => '{date}', 'description' => 'metadata where online published date is since (inclusive) {date}' }, | ||
| 'until_online_pub_date' => { 'possible_values' => '{date}', 'description' => 'metadata where online published date is before (inclusive) {date}' }, | ||
| 'from_print_pub_date' => { 'possible_values' => '{date}', 'description' => 'metadata where print published date is since (inclusive) {date}' }, | ||
| 'until_print_pub_date' => { 'possible_values' => '{date}', 'description' => 'metadata where print published date is before (inclusive) {date}' }, | ||
| 'from_posted_date' => { 'possible_values' => '{date}', 'description' => 'metadata where posted date is since (inclusive) {date}' }, | ||
| 'until_posted_date' => { 'possible_values' => '{date}', 'description' => 'metadata where posted date is before (inclusive) {date}' }, | ||
| 'from_accepted_date' => { 'possible_values' => '{date}', 'description' => 'metadata where accepted date is since (inclusive) {date}' }, | ||
| 'until_accepted_date' => { 'possible_values' => '{date}', 'description' => 'metadata where accepted date is before (inclusive) {date}' }, | ||
| 'has_license' => { 'possible_values' => nil, 'description' => "metadata that includes any '<license_ref>' elements" }, | ||
| 'license_url' => { 'possible_values' => '{url}', 'description' => "metadata where '<license_ref>' value equals {url}" }, | ||
| 'license_version' => { 'possible_values' => '{string}', 'description' => "metadata where the '<license_ref>''s 'applies_to' attribute is '{string}'" }, | ||
| 'license_delay' => { 'possible_values' => '{integer}', 'description' => "metadata where difference between publication date and the '<license_ref>''s 'start_date' attribute is <= '{integer}' (in days" }, | ||
| 'has_full_text' => { 'possible_values' => nil, 'description' => "metadata that includes any full text '<resource>' elements_" }, | ||
| 'full_text_version' => { 'possible_values' => '{string}', 'description' => "metadata where '<resource>' element's 'content_version' attribute is '{string}'" }, | ||
| 'full_text_type' => { 'possible_values' => '{mime_type}', 'description' => "metadata where '<resource>' element's 'content_type' attribute is '{mime_type}' (e.g. 'application/pdf')" }, | ||
| 'full_text_application' => { 'possible_values' => '{string}', 'description' => 'metadata where <resource> link has one of the following intended applications: text-mining, similarity-checking or unspecified' }, | ||
| 'has_references' => { 'possible_values' => nil, 'description' => 'metadata for works that have a list of references' }, | ||
| 'has_archive' => { 'possible_values' => nil, 'description' => 'metadata which include name of archive partner' }, | ||
| 'archive' => { 'possible_values' => '{string}', 'description' => "metadata which where value of archive partner is '{string}'" }, | ||
| 'has_orcid' => { 'possible_values' => nil, 'description' => 'metadata which includes one or more ORCIDs' }, | ||
| 'has_authenticated_orcid' => { 'possible_values' => nil, 'description' => 'metadata which includes one or more ORCIDs where the depositing publisher claims to have witness the ORCID owner authenticate with ORCID' }, | ||
| 'orcid' => { 'possible_values' => '{orcid}', 'description' => "metadata where '<orcid>' element's value = '{orcid}'" }, | ||
| 'issn' => { 'possible_values' => '{issn}', 'description' => "metadata where record has an ISSN = '{issn}' Format is 'xxxx_xxxx'." }, | ||
| 'directory' => { 'possible_values' => '{directory}', 'description' => "metadata records whose article or serial are mentioned in the given '{directory}'. Currently the only supported value is 'doaj'" }, | ||
| 'doi' => { 'possible_values' => '{doi}', 'description' => "metadata describing the DOI '{doi}'" }, | ||
| 'updates' => { 'possible_values' => '{doi}', 'description' => "metadata for records that represent editorial updates to the DOI '{doi}'" }, | ||
| 'is_update' => { 'possible_values' => nil, 'description' => 'metadata for records that represent editorial updates' }, | ||
| 'has_update_policy' => { 'possible_values' => nil, 'description' => 'metadata for records that include a link to an editorial update policy' }, | ||
| 'container_title' => { 'possible_values' => nil, 'description' => 'metadata for records with a publication title exactly with an exact match' }, | ||
| 'category_name' => { 'possible_values' => nil, 'description' => 'metadata for records with an exact matching category label' }, | ||
| 'type' => { 'possible_values' => '{type}', 'description' => "metadata records whose type = '{type}' Type must be an ID value from the list of types returned by the '/types' resource" }, | ||
| 'type_name' => { 'possible_values' => nil, 'description' => 'metadata for records with an exacty matching type label' }, | ||
| 'award_number' => { 'possible_values' => '{award_number}', 'description' => "metadata for records with a matching award nunber_ Optionally combine with 'award_funder'" }, | ||
| 'award_funder' => { 'possible_values' => '{funder doi or id}', 'description' => "metadata for records with an award with matching funder. Optionally combine with 'award_number'" }, | ||
| 'has_assertion' => { 'possible_values' => nil, 'description' => 'metadata for records with any assertions' }, | ||
| 'assertion_group' => { 'possible_values' => nil, 'description' => 'metadata for records with an assertion in a particular group' }, | ||
| 'assertion' => { 'possible_values' => nil, 'description' => 'metadata for records with a particular named assertion' }, | ||
| 'has_affiliation' => { 'possible_values' => nil, 'description' => 'metadata for records that have any affiliation information' }, | ||
| 'alternative_id' => { 'possible_values' => nil, 'description' => 'metadata for records with the given alternative ID, which may be a publisher_specific ID, or any other identifier a publisher may have provided' }, | ||
| 'article_number' => { 'possible_values' => nil, 'description' => 'metadata for records with a given article number' }, | ||
| 'has_abstract' => { 'possible_values' => nil, 'description' => 'metadata for records which include an abstract' }, | ||
| 'has_clinical_trial_number' => { 'possible_values' => nil, 'description' => 'metadata for records which include a clinical trial number' }, | ||
| 'content_domain' => { 'possible_values' => nil, 'description' => 'metadata where the publisher records a particular domain name as the location Crossmark content will appear' }, | ||
| 'has_content_domain' => { 'possible_values' => nil, 'description' => 'metadata where the publisher records a domain name location for Crossmark content' }, | ||
| 'has_crossmark_restriction' => { 'possible_values' => nil, 'description' => 'metadata where the publisher restricts Crossmark usage to content domains' }, | ||
| 'has_relation' => { 'possible_values' => nil, 'description' => 'metadata for records that either assert or are the object of a relation' }, | ||
| 'relation_type' => { 'possible_values' => nil, 'description' => 'One of the relation types from the Crossref relations schema (e.g. is-referenced-by, is-parent-of, is-preprint-of)' }, | ||
| 'relation_object' => { 'possible_values' => nil, 'description' => 'Relations where the object identifier matches the identifier provided' }, | ||
| 'relation_object_type' => { 'possible_values' => nil, 'description' => 'One of the identifier types from the Crossref relations schema (e.g. doi, issn)' }, | ||
| 'public_references' => { 'possible_values' => nil, 'description' => 'metadata where publishers allow references to be distributed publically' }, | ||
| 'publisher_name' => { 'possible_values' => nil, 'description' => 'metadata for records with an exact matching publisher name' }, | ||
| 'affiliation' => { 'possible_values' => nil, 'description' => 'metadata for records with at least one contributor with the given affiliation' } | ||
| "has_funder" => {"possible_values" => nil, "description" => "metadata which includes one or more funder entry"}, | ||
| "funder" => {"possible_values" => "{funder_id}", "description" => "metadata which include the {funder_id} in FundRef data"}, | ||
| "location" => {"possible_values" => "{country_name}", "description" => "funder records where location = {country name}. Only works on /funders route"}, | ||
| "prefix" => {"possible_values" => "{owner_prefix}", "description" => "metadata belonging to a DOI owner prefix {owner_prefix} (e.g. '10.1016' )"}, | ||
| "member" => {"possible_values" => "{member_id}", "description" => "metadata belonging to a CrossRef member"}, | ||
| "from_index_date" => {"possible_values" => "{date}", "description" => "metadata indexed since (inclusive) {date}"}, | ||
| "until_index_date" => {"possible_values" => "{date}", "description" => "metadata indexed before (inclusive) {date}"}, | ||
| "from_deposit_date" => {"possible_values" => "{date}", "description" => "metadata last (re)deposited since (inclusive) {date}"}, | ||
| "until_deposit_date" => {"possible_values" => "{date}", "description" => "metadata last (re)deposited before (inclusive) {date}"}, | ||
| "from_update_date" => {"possible_values" => "{date}", "description" => "Metadata updated since (inclusive) {date} Currently the same as 'from_deposit_date'"}, | ||
| "until_update_date" => {"possible_values" => "{date}", "description" => "Metadata updated before (inclusive) {date} Currently the same as 'until_deposit_date'"}, | ||
| "from_created_date" => {"possible_values" => "{date}", "description" => "metadata first deposited since (inclusive) {date}"}, | ||
| "until_created_date" => {"possible_values" => "{date}", "description" => "metadata first deposited before (inclusive) {date}"}, | ||
| "from_pub_date" => {"possible_values" => "{date}", "description" => "metadata where published date is since (inclusive) {date}"}, | ||
| "until_pub_date" => {"possible_values" => "{date}", "description" => "metadata where published date is before (inclusive) {date}"}, | ||
| "from_online_pub_date" => {"possible_values" => "{date}", "description" => "metadata where online published date is since (inclusive) {date}"}, | ||
| "until_online_pub_date" => {"possible_values" => "{date}", "description" => "metadata where online published date is before (inclusive) {date}"}, | ||
| "from_print_pub_date" => {"possible_values" => "{date}", "description" => "metadata where print published date is since (inclusive) {date}"}, | ||
| "until_print_pub_date" => {"possible_values" => "{date}", "description" => "metadata where print published date is before (inclusive) {date}"}, | ||
| "from_posted_date" => {"possible_values" => "{date}", "description" => "metadata where posted date is since (inclusive) {date}"}, | ||
| "until_posted_date" => {"possible_values" => "{date}", "description" => "metadata where posted date is before (inclusive) {date}"}, | ||
| "from_accepted_date" => {"possible_values" => "{date}", "description" => "metadata where accepted date is since (inclusive) {date}"}, | ||
| "until_accepted_date" => {"possible_values" => "{date}", "description" => "metadata where accepted date is before (inclusive) {date}"}, | ||
| "has_license" => {"possible_values" => nil, "description" => "metadata that includes any '<license_ref>' elements"}, | ||
| "license_url" => {"possible_values" => "{url}", "description" => "metadata where '<license_ref>' value equals {url}"}, | ||
| "license_version" => {"possible_values" => "{string}", "description" => "metadata where the '<license_ref>''s 'applies_to' attribute is '{string}'"}, | ||
| "license_delay" => {"possible_values" => "{integer}", "description" => "metadata where difference between publication date and the '<license_ref>''s 'start_date' attribute is <= '{integer}' (in days"}, | ||
| "has_full_text" => {"possible_values" => nil, "description" => "metadata that includes any full text '<resource>' elements_"}, | ||
| "full_text_version" => {"possible_values" => "{string}", "description" => "metadata where '<resource>' element's 'content_version' attribute is '{string}'"}, | ||
| "full_text_type" => {"possible_values" => "{mime_type}", "description" => "metadata where '<resource>' element's 'content_type' attribute is '{mime_type}' (e.g. 'application/pdf')"}, | ||
| "full_text_application" => {"possible_values" => "{string}", "description" => "metadata where <resource> link has one of the following intended applications: text-mining, similarity-checking or unspecified"}, | ||
| "has_references" => {"possible_values" => nil, "description" => "metadata for works that have a list of references"}, | ||
| "has_archive" => {"possible_values" => nil, "description" => "metadata which include name of archive partner"}, | ||
| "archive" => {"possible_values" => "{string}", "description" => "metadata which where value of archive partner is '{string}'"}, | ||
| "has_orcid" => {"possible_values" => nil, "description" => "metadata which includes one or more ORCIDs"}, | ||
| "has_authenticated_orcid" => {"possible_values" => nil, "description" => "metadata which includes one or more ORCIDs where the depositing publisher claims to have witness the ORCID owner authenticate with ORCID"}, | ||
| "orcid" => {"possible_values" => "{orcid}", "description" => "metadata where '<orcid>' element's value = '{orcid}'"}, | ||
| "issn" => {"possible_values" => "{issn}", "description" => "metadata where record has an ISSN = '{issn}' Format is 'xxxx_xxxx'."}, | ||
| "directory" => {"possible_values" => "{directory}", "description" => "metadata records whose article or serial are mentioned in the given '{directory}'. Currently the only supported value is 'doaj'"}, | ||
| "doi" => {"possible_values" => "{doi}", "description" => "metadata describing the DOI '{doi}'"}, | ||
| "updates" => {"possible_values" => "{doi}", "description" => "metadata for records that represent editorial updates to the DOI '{doi}'"}, | ||
| "is_update" => {"possible_values" => nil, "description" => "metadata for records that represent editorial updates"}, | ||
| "has_update_policy" => {"possible_values" => nil, "description" => "metadata for records that include a link to an editorial update policy"}, | ||
| "container_title" => {"possible_values" => nil, "description" => "metadata for records with a publication title exactly with an exact match"}, | ||
| "category_name" => {"possible_values" => nil, "description" => "metadata for records with an exact matching category label"}, | ||
| "type" => {"possible_values" => "{type}", "description" => "metadata records whose type = '{type}' Type must be an ID value from the list of types returned by the '/types' resource"}, | ||
| "type_name" => {"possible_values" => nil, "description" => "metadata for records with an exacty matching type label"}, | ||
| "award_number" => {"possible_values" => "{award_number}", "description" => "metadata for records with a matching award nunber_ Optionally combine with 'award_funder'"}, | ||
| "award_funder" => {"possible_values" => "{funder doi or id}", "description" => "metadata for records with an award with matching funder. Optionally combine with 'award_number'"}, | ||
| "has_assertion" => {"possible_values" => nil, "description" => "metadata for records with any assertions"}, | ||
| "assertion_group" => {"possible_values" => nil, "description" => "metadata for records with an assertion in a particular group"}, | ||
| "assertion" => {"possible_values" => nil, "description" => "metadata for records with a particular named assertion"}, | ||
| "has_affiliation" => {"possible_values" => nil, "description" => "metadata for records that have any affiliation information"}, | ||
| "alternative_id" => {"possible_values" => nil, "description" => "metadata for records with the given alternative ID, which may be a publisher_specific ID, or any other identifier a publisher may have provided"}, | ||
| "article_number" => {"possible_values" => nil, "description" => "metadata for records with a given article number"}, | ||
| "has_abstract" => {"possible_values" => nil, "description" => "metadata for records which include an abstract"}, | ||
| "has_clinical_trial_number" => {"possible_values" => nil, "description" => "metadata for records which include a clinical trial number"}, | ||
| "content_domain" => {"possible_values" => nil, "description" => "metadata where the publisher records a particular domain name as the location Crossmark content will appear"}, | ||
| "has_content_domain" => {"possible_values" => nil, "description" => "metadata where the publisher records a domain name location for Crossmark content"}, | ||
| "has_crossmark_restriction" => {"possible_values" => nil, "description" => "metadata where the publisher restricts Crossmark usage to content domains"}, | ||
| "has_relation" => {"possible_values" => nil, "description" => "metadata for records that either assert or are the object of a relation"}, | ||
| "relation_type" => {"possible_values" => nil, "description" => "One of the relation types from the Crossref relations schema (e.g. is-referenced-by, is-parent-of, is-preprint-of)"}, | ||
| "relation_object" => {"possible_values" => nil, "description" => "Relations where the object identifier matches the identifier provided"}, | ||
| "relation_object_type" => {"possible_values" => nil, "description" => "One of the identifier types from the Crossref relations schema (e.g. doi, issn)"}, | ||
| "public_references" => {"possible_values" => nil, "description" => "metadata where publishers allow references to be distributed publically"}, | ||
| "publisher_name" => {"possible_values" => nil, "description" => "metadata for records with an exact matching publisher name"}, | ||
| "affiliation" => {"possible_values" => nil, "description" => "metadata for records with at least one contributor with the given affiliation"} | ||
| }.freeze | ||
| end | ||
| end |
| # frozen_string_literal: true | ||
| require 'erb' | ||
| require 'faraday' | ||
| require 'faraday_middleware' | ||
| require 'multi_json' | ||
| require 'serrano/error' | ||
| require 'serrano/helpers/configuration' | ||
| require 'serrano/filterhandler' | ||
| require 'serrano/error' | ||
| require 'serrano/faraday' | ||
| require 'serrano/utils' | ||
| require "erb" | ||
| require "faraday" | ||
| require "faraday_middleware" | ||
| require "multi_json" | ||
| require "serrano/error" | ||
| require "serrano/helpers/configuration" | ||
| require "serrano/filterhandler" | ||
| require "serrano/error" | ||
| require "serrano/faraday" | ||
| require "serrano/utils" | ||
@@ -40,5 +40,5 @@ ## | ||
| def initialize(endpt, id, query, filter, offset, | ||
| limit, sample, sort, order, facet, select, | ||
| works, agency, options, verbose, cursor, | ||
| cursor_max, args) | ||
| limit, sample, sort, order, facet, select, | ||
| works, agency, options, verbose, cursor, | ||
| cursor_max, args) | ||
@@ -68,12 +68,12 @@ self.endpt = endpt | ||
| fieldqueries = field_query_handler(args) | ||
| self.select = select.join(',') if select && select.class == Array | ||
| self.select = select.join(",") if select && select.class == Array | ||
| unless cursor_max.class.nil? | ||
| raise 'cursor_max must be of class int' unless cursor_max.is_a?(Integer) | ||
| raise "cursor_max must be of class int" unless cursor_max.is_a?(Integer) | ||
| end | ||
| arguments = { query: query, filter: filt, offset: offset, | ||
| rows: limit, sample: sample, sort: sort, | ||
| order: order, facet: facet, select: select, | ||
| cursor: cursor }.tostrings | ||
| arguments = {query: query, filter: filt, offset: offset, | ||
| rows: limit, sample: sample, sort: sort, | ||
| order: order, facet: facet, select: select, | ||
| cursor: cursor}.tostrings | ||
| arguments = arguments.merge(fieldqueries) | ||
@@ -83,16 +83,16 @@ opts = arguments.delete_if { |_k, v| v.nil? } | ||
| conn = if verbose | ||
| Faraday.new(url: Serrano.base_url, request: options || []) do |f| | ||
| f.response :logger | ||
| f.use FaradayMiddleware::RaiseHttpException | ||
| f.adapter Faraday.default_adapter | ||
| end | ||
| else | ||
| Faraday.new(url: Serrano.base_url, request: options || []) do |f| | ||
| f.use FaradayMiddleware::RaiseHttpException | ||
| f.adapter Faraday.default_adapter | ||
| end | ||
| end | ||
| Faraday.new(url: Serrano.base_url, request: options || []) do |f| | ||
| f.response :logger | ||
| f.use FaradayMiddleware::RaiseHttpException | ||
| f.adapter Faraday.default_adapter | ||
| end | ||
| else | ||
| Faraday.new(url: Serrano.base_url, request: options || []) do |f| | ||
| f.use FaradayMiddleware::RaiseHttpException | ||
| f.adapter Faraday.default_adapter | ||
| end | ||
| end | ||
| conn.headers[:user_agent] = make_ua | ||
| conn.headers['X-USER-AGENT'] = make_ua | ||
| conn.headers["X-USER-AGENT"] = make_ua | ||
@@ -102,6 +102,6 @@ if id.nil? | ||
| js = _req(conn, endpt, opts) | ||
| cu = js['message']['next-cursor'] | ||
| max_avail = js['message']['total-results'] | ||
| res = _redo_req(conn, js, opts, cu, max_avail) | ||
| res | ||
| cu = js["message"]["next-cursor"] | ||
| max_avail = js["message"]["total-results"] | ||
| _redo_req(conn, js, opts, cu, max_avail) | ||
| else | ||
@@ -114,14 +114,14 @@ self.id = Array(id) | ||
| endpt2 = if works | ||
| endpt + '/' + x.to_s + '/works' | ||
| else | ||
| endpt2 = if agency | ||
| endpt + '/' + x.to_s + '/agency' | ||
| else | ||
| endpt + '/' + x.to_s | ||
| end | ||
| end | ||
| endpt + "/" + x.to_s + "/works" | ||
| else | ||
| endpt2 = if agency | ||
| endpt + "/" + x.to_s + "/agency" | ||
| else | ||
| endpt + "/" + x.to_s | ||
| end | ||
| end | ||
| js = _req(conn, endpt2, opts) | ||
| cu = js['message']['next-cursor'] | ||
| max_avail = js['message']['total-results'] | ||
| cu = js["message"]["next-cursor"] | ||
| max_avail = js["message"]["total-results"] | ||
| coll << _redo_req(conn, js, opts, cu, max_avail) | ||
@@ -134,11 +134,11 @@ end | ||
| def _redo_req(conn, js, opts, cu, max_avail) | ||
| if !cu.nil? && (cursor_max > js['message']['items'].length) | ||
| if !cu.nil? && (cursor_max > js["message"]["items"].length) | ||
| res = [js] | ||
| total = js['message']['items'].length | ||
| total = js["message"]["items"].length | ||
| while !cu.nil? && (cursor_max > total) && (total < max_avail) | ||
| opts[:cursor] = cu | ||
| out = _req(conn, endpt2, opts) | ||
| cu = out['message']['next-cursor'] | ||
| cu = out["message"]["next-cursor"] | ||
| res << out | ||
| total = res.collect { |x| x['message']['items'].length }.reduce(0, :+) | ||
| total = res.collect { |x| x["message"]["items"].length }.sum | ||
| end | ||
@@ -145,0 +145,0 @@ res |
+31
-31
| # frozen_string_literal: true | ||
| require 'erb' | ||
| require 'faraday' | ||
| require 'multi_json' | ||
| require 'serrano/error' | ||
| require 'serrano/utils' | ||
| require 'serrano/helpers/configuration' | ||
| require "erb" | ||
| require "faraday" | ||
| require "multi_json" | ||
| require "serrano/error" | ||
| require "serrano/utils" | ||
| require "serrano/helpers/configuration" | ||
@@ -33,4 +33,4 @@ ## | ||
| def initialize(endpt, id, query, filter, offset, | ||
| limit, sample, sort, order, facet, select, | ||
| works, agency, options, verbose) | ||
| limit, sample, sort, order, facet, select, | ||
| works, agency, options, verbose) | ||
@@ -57,25 +57,25 @@ self.endpt = endpt | ||
| self.select = select.join(',') if select && select.class == Array | ||
| self.select = select.join(",") if select && select.class == Array | ||
| args = { query: query, filter: filt, offset: offset, | ||
| rows: limit, sample: sample, sort: sort, | ||
| order: order, facet: facet, | ||
| select: select } | ||
| args = {query: query, filter: filt, offset: offset, | ||
| rows: limit, sample: sample, sort: sort, | ||
| order: order, facet: facet, | ||
| select: select} | ||
| opts = args.delete_if { |_k, v| v.nil? } | ||
| conn = if verbose | ||
| Faraday.new(url: Serrano.base_url, request: options || []) do |f| | ||
| f.response :logger | ||
| f.use FaradayMiddleware::RaiseHttpException | ||
| f.adapter Faraday.default_adapter | ||
| end | ||
| else | ||
| Faraday.new(url: Serrano.base_url, request: options || []) do |f| | ||
| f.use FaradayMiddleware::RaiseHttpException | ||
| f.adapter Faraday.default_adapter | ||
| end | ||
| end | ||
| Faraday.new(url: Serrano.base_url, request: options || []) do |f| | ||
| f.response :logger | ||
| f.use FaradayMiddleware::RaiseHttpException | ||
| f.adapter Faraday.default_adapter | ||
| end | ||
| else | ||
| Faraday.new(url: Serrano.base_url, request: options || []) do |f| | ||
| f.use FaradayMiddleware::RaiseHttpException | ||
| f.adapter Faraday.default_adapter | ||
| end | ||
| end | ||
| conn.headers[:user_agent] = make_ua | ||
| conn.headers['X-USER-AGENT'] = make_ua | ||
| conn.headers["X-USER-AGENT"] = make_ua | ||
@@ -92,8 +92,8 @@ if id.nil? | ||
| endpt = if works | ||
| self.endpt + '/' + x.to_s + '/works' | ||
| elsif agency | ||
| self.endpt + '/' + x.to_s + '/agency' | ||
| else | ||
| self.endpt + '/' + x.to_s | ||
| end | ||
| self.endpt + "/" + x.to_s + "/works" | ||
| elsif agency | ||
| self.endpt + "/" + x.to_s + "/agency" | ||
| else | ||
| self.endpt + "/" + x.to_s | ||
| end | ||
@@ -100,0 +100,0 @@ res = conn.get endpt, opts |
+15
-15
| # frozen_string_literal: true | ||
| require 'faraday' | ||
| require 'multi_json' | ||
| require "faraday" | ||
| require "multi_json" | ||
| def fetch_styles | ||
| base = 'https://api.github.com/repos/citation-style-language/styles' | ||
| conn = Faraday.new(url: base) do |f| | ||
| base = "https://api.github.com/repos/citation-style-language/styles" | ||
| conn = Faraday.new(url: base) { |f| | ||
| f.use FaradayMiddleware::RaiseHttpException | ||
| f.adapter Faraday.default_adapter | ||
| end | ||
| args = { per_page: 1 } | ||
| tt = conn.get 'commits', args | ||
| } | ||
| args = {per_page: 1} | ||
| tt = conn.get "commits", args | ||
| commres = MultiJson.load(tt.body) | ||
| sha = commres[0]['sha'] | ||
| sty = conn.get 'git/trees/' + sha | ||
| sha = commres[0]["sha"] | ||
| sty = conn.get "git/trees/" + sha | ||
| res = MultiJson.load(sty.body) | ||
| files = res['tree'].collect { |x| x['path'] } | ||
| matches = files.collect do |x| | ||
| if x.match('csl').nil? | ||
| files = res["tree"].collect { |x| x["path"] } | ||
| matches = files.collect { |x| | ||
| if x.match("csl").nil? | ||
| nil | ||
| else | ||
| x.match('csl').string | ||
| x.match("csl").string | ||
| end | ||
| end | ||
| } | ||
| csls = matches.compact | ||
| csls.collect { |z| z.gsub('.csl', '') } | ||
| csls.collect { |z| z.gsub(".csl", "") } | ||
| end |
| # frozen_string_literal: true | ||
| def make_ua | ||
| requa = 'Faraday/v' + Faraday::VERSION | ||
| habua = 'Serrano/v' + Serrano::VERSION | ||
| ua = requa + ' ' + habua | ||
| requa = "Faraday/v" + Faraday::VERSION | ||
| habua = "Serrano/v" + Serrano::VERSION | ||
| ua = requa + " " + habua | ||
| if Serrano.mailto | ||
| ua = ua + " (mailto:%s)" % Serrano.mailto | ||
| ua += " (mailto:%s)" % Serrano.mailto | ||
| end | ||
@@ -21,5 +21,4 @@ # ua += format(' (mailto:%s)', Serrano.mailto) if Serrano.mailto | ||
| foo = foo.tostrings | ||
| foo = foo.map { |x, y| [x.to_s.sub('container_title', 'container-title'), y] }.to_h | ||
| foo = foo.map { |x, y| [x.to_s.sub('query_', 'query.'), y] }.to_h | ||
| foo | ||
| foo = foo.map { |x, y| [x.to_s.sub("container_title", "container-title"), y] }.to_h | ||
| foo.map { |x, y| [x.to_s.sub("query_", "query."), y] }.to_h | ||
| end | ||
@@ -26,0 +25,0 @@ |
| # frozen_string_literal: true | ||
| module Serrano | ||
| VERSION = '0.6.2' | ||
| VERSION = "1.0.0" | ||
| end |
+17
-20
| # frozen_string_literal: true | ||
| require 'bundler/gem_tasks' | ||
| require 'rake/testtask' | ||
| require 'rubocop/rake_task' | ||
| require "bundler/gem_tasks" | ||
| require "rake/testtask" | ||
| require "standard" | ||
| require "standard/rake" | ||
| Rake::TestTask.new do |t| | ||
| t.libs << 'test' | ||
| t.test_files = FileList['test/test_*.rb'] | ||
| t.libs << "test" | ||
| t.test_files = FileList["test/test_*.rb"] | ||
| t.verbose = true | ||
@@ -14,30 +15,26 @@ t.warning = false | ||
| desc 'Run tests' | ||
| desc "Run tests" | ||
| task default: :test | ||
| RuboCop::RakeTask.new(:rubocop) do |t| | ||
| t.options = ['--display-cop-names'] | ||
| end | ||
| desc 'Build serrano docs' | ||
| desc "Build serrano docs" | ||
| task :docs do | ||
| system 'yardoc' | ||
| system "yardoc" | ||
| end | ||
| desc 'bundle install' | ||
| desc "bundle install" | ||
| task :bundle do | ||
| system 'bundle install' | ||
| system "bundle install" | ||
| end | ||
| desc 'clean out builds' | ||
| desc "clean out builds" | ||
| task :clean do | ||
| system 'ls | grep [0-9].gem | xargs rm' | ||
| system "ls | grep [0-9].gem | xargs rm" | ||
| end | ||
| desc 'Build serrano' | ||
| desc "Build serrano" | ||
| task :build do | ||
| system 'gem build serrano.gemspec' | ||
| system "gem build serrano.gemspec" | ||
| end | ||
| desc 'Install serrano' | ||
| desc "Install serrano" | ||
| task install: %i[bundle build] do | ||
@@ -47,5 +44,5 @@ system "gem install serrano-#{Serrano::VERSION}.gem" | ||
| desc 'Release to Rubygems' | ||
| desc "Release to Rubygems" | ||
| task release: :build do | ||
| system "gem push serrano-#{Serrano::VERSION}.gem" | ||
| end |
+2
-1
@@ -8,6 +8,7 @@ serrano | ||
| [](https://zenodo.org/badge/latestdoi/2600/sckott/serrano) | ||
| [](https://github.com/testdouble/standard) | ||
| `serrano` is a low level client for Crossref APIs | ||
| Docs: http://www.rubydoc.info/gems/serrano | ||
| Docs: https://www.rubydoc.info/gems/serrano | ||
@@ -14,0 +15,0 @@ Other Crossref API clients: |
+34
-34
| # frozen_string_literal: true | ||
| lib = File.expand_path('lib', __dir__) | ||
| lib = File.expand_path("lib", __dir__) | ||
| $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
| require 'serrano/version' | ||
| require "serrano/version" | ||
| Gem::Specification.new do |s| | ||
| s.name = 'serrano' | ||
| s.version = Serrano::VERSION | ||
| s.platform = Gem::Platform::RUBY | ||
| s.required_ruby_version = '>= 2.1' | ||
| s.date = '2020-05-29' | ||
| s.summary = 'Crossref Client' | ||
| s.description = 'Low Level Ruby Client for the Crossref Search API' | ||
| s.authors = 'Scott Chamberlain' | ||
| s.email = 'myrmecocystus@gmail.com' | ||
| s.homepage = 'https://github.com/sckott/serrano' | ||
| s.licenses = 'MIT' | ||
| s.name = "serrano" | ||
| s.version = Serrano::VERSION | ||
| s.platform = Gem::Platform::RUBY | ||
| s.required_ruby_version = ">= 2.1" | ||
| s.date = "2020-10-19" | ||
| s.summary = "Crossref Client" | ||
| s.description = "Low Level Ruby Client for the Crossref Search API" | ||
| s.authors = "Scott Chamberlain" | ||
| s.email = "myrmecocystus@gmail.com" | ||
| s.homepage = "https://github.com/sckott/serrano" | ||
| s.licenses = "MIT" | ||
@@ -23,30 +23,30 @@ s.files = `git ls-files -z`.split("\x0").reject do |f| | ||
| end | ||
| s.require_paths = ['lib'] | ||
| s.require_paths = ["lib"] | ||
| s.bindir = 'bin' | ||
| s.executables = ['serrano'] | ||
| s.bindir = "bin" | ||
| s.executables = ["serrano"] | ||
| s.add_development_dependency 'bundler', '~> 2.0', '>= 2.0.2' | ||
| s.add_development_dependency 'codecov', '~> 0.1.10' | ||
| s.add_development_dependency 'json', '~> 2.1' | ||
| s.add_development_dependency 'rake', '>= 12.3.1', '~> 13.0' | ||
| s.add_development_dependency 'rubocop', '~> 0.84.0' | ||
| s.add_development_dependency 'simplecov', '~> 0.18.5' | ||
| s.add_development_dependency 'test-unit', '~> 3.2', '>= 3.2.7' | ||
| s.add_development_dependency 'vcr', '~> 6.0' | ||
| s.add_development_dependency 'webmock', '~> 3.4', '>= 3.4.1' | ||
| s.add_development_dependency "bundler", '~> 2.1', '>= 2.1.4' | ||
| s.add_development_dependency "codecov", "~> 0.2.0" | ||
| s.add_development_dependency "json", '~> 2.3', '>= 2.3.1' | ||
| s.add_development_dependency "rake", '~> 13.0', '>= 13.0.1' | ||
| s.add_development_dependency "standard", "~> 0.7" | ||
| s.add_development_dependency "simplecov", "~> 0.19.0" | ||
| s.add_development_dependency "test-unit", '~> 3.3', '>= 3.3.6' | ||
| s.add_development_dependency "vcr", "~> 6.0" | ||
| s.add_development_dependency "webmock", '~> 3.9', '>= 3.9.3' | ||
| s.add_runtime_dependency 'faraday', '~> 1.0', '>= 1.0.1' | ||
| s.add_runtime_dependency 'faraday_middleware', '~> 1.0' | ||
| s.add_runtime_dependency 'multi_json', '~> 1.13', '>= 1.13.1' | ||
| s.add_runtime_dependency 'thor', '>= 0.20', '< 1.1' | ||
| s.add_runtime_dependency "faraday", "~> 1.1" | ||
| s.add_runtime_dependency "faraday_middleware", "~> 1.0" | ||
| s.add_runtime_dependency "multi_json", '~> 1.15' | ||
| s.add_runtime_dependency 'thor', '~> 1.0', '>= 1.0.1' | ||
| s.metadata = { | ||
| 'homepage_uri' => 'https://github.com/sckott/serrano', | ||
| 'documentation_uri' => 'https://www.rubydoc.info/gems/serrano', | ||
| 'changelog_uri' => | ||
| "homepage_uri" => "https://github.com/sckott/serrano", | ||
| "documentation_uri" => "https://www.rubydoc.info/gems/serrano", | ||
| "changelog_uri" => | ||
| "https://github.com/sckott/serrano/releases/tag/v#{s.version}", | ||
| 'source_code_uri' => 'https://github.com/sckott/serrano', | ||
| 'bug_tracker_uri' => 'https://github.com/sckott/serrano/issues' | ||
| "source_code_uri" => "https://github.com/sckott/serrano", | ||
| "bug_tracker_uri" => "https://github.com/sckott/serrano/issues" | ||
| } | ||
| end |
| # This configuration was generated by | ||
| # `rubocop --auto-gen-config` | ||
| # on 2020-02-18 08:24:37 -0800 using RuboCop version 0.80.0. | ||
| # The point is for the user to remove these configuration records | ||
| # one by one as the offenses are removed from the code base. | ||
| # Note that changes in the inspected code, or installation of new | ||
| # versions of RuboCop, may require this file to be generated again. | ||
| # Offense count: 1 | ||
| # Configuration parameters: Include. | ||
| # Include: **/*.gemspec | ||
| Gemspec/RequiredRubyVersion: | ||
| Exclude: | ||
| - 'serrano.gemspec' | ||
| # Offense count: 32 | ||
| Metrics/AbcSize: | ||
| Max: 91 | ||
| # Offense count: 1 | ||
| # Configuration parameters: CountBlocks. | ||
| Metrics/BlockNesting: | ||
| Max: 4 | ||
| # Offense count: 2 | ||
| # Configuration parameters: CountComments. | ||
| Metrics/ClassLength: | ||
| Max: 367 | ||
| # Offense count: 5 | ||
| Metrics/CyclomaticComplexity: | ||
| Max: 11 | ||
| # Offense count: 21 | ||
| # Configuration parameters: CountComments, ExcludedMethods. | ||
| Metrics/MethodLength: | ||
| Max: 54 | ||
| # Offense count: 8 | ||
| Metrics/PerceivedComplexity: | ||
| Max: 15 | ||
| # Offense count: 7 | ||
| # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. | ||
| # AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp | ||
| Naming/MethodParameterName: | ||
| Exclude: | ||
| - 'lib/serrano/filterhandler.rb' | ||
| - 'lib/serrano/request_cursor.rb' | ||
| - 'lib/serrano/utils.rb' | ||
| # Offense count: 3 | ||
| # Cop supports --auto-correct. | ||
| # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. | ||
| # SupportedStyles: assign_to_condition, assign_inside_condition | ||
| Style/ConditionalAssignment: | ||
| Exclude: | ||
| - 'bin/serrano' | ||
| # Offense count: 6 | ||
| Style/Documentation: | ||
| Exclude: | ||
| - 'spec/**/*' | ||
| - 'test/**/*' | ||
| - 'bin/serrano' | ||
| - 'lib/serrano.rb' | ||
| - 'lib/serrano/cn.rb' | ||
| - 'lib/serrano/filters.rb' | ||
| - 'lib/serrano/utils.rb' | ||
| # Offense count: 1 | ||
| # Cop supports --auto-correct. | ||
| # Configuration parameters: EnforcedStyle. | ||
| # SupportedStyles: format, sprintf, percent | ||
| Style/FormatString: | ||
| Exclude: | ||
| - 'lib/serrano/utils.rb' | ||
| # Offense count: 1 | ||
| # Configuration parameters: EnforcedStyle. | ||
| # SupportedStyles: annotated, template, unannotated | ||
| Style/FormatStringToken: | ||
| Exclude: | ||
| - 'lib/serrano/utils.rb' | ||
| # Offense count: 3 | ||
| # Cop supports --auto-correct. | ||
| Style/IfUnlessModifier: | ||
| Exclude: | ||
| - 'lib/serrano/cnrequest.rb' | ||
| - 'lib/serrano/utils.rb' | ||
| # Offense count: 1 | ||
| # Cop supports --auto-correct. | ||
| Style/SelfAssignment: | ||
| Exclude: | ||
| - 'lib/serrano/utils.rb' | ||
| # Offense count: 1 | ||
| # Cop supports --auto-correct. | ||
| # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. | ||
| # SupportedStyles: single_quotes, double_quotes | ||
| Style/StringLiterals: | ||
| Exclude: | ||
| - 'lib/serrano/utils.rb' |
-50
| inherit_from: .rubocop_todo.yml | ||
| Naming/FileName: | ||
| Exclude: | ||
| - 'test/test-helper.rb' | ||
| Metrics/ParameterLists: | ||
| Max: 18 | ||
| Metrics/ModuleLength: | ||
| Max: 800 | ||
| # Offense count: 22 | ||
| # Configuration parameters: AllowedVariables. | ||
| Lint/UselessAssignment: | ||
| Exclude: | ||
| - 'lib/serrano/filters.rb' | ||
| Lint/RaiseException: | ||
| Enabled: true | ||
| Lint/StructNewOverride: | ||
| Enabled: true | ||
| Style/HashEachMethods: | ||
| Enabled: true | ||
| Style/HashTransformKeys: | ||
| Enabled: true | ||
| Style/HashTransformValues: | ||
| Enabled: true | ||
| Layout/LineLength: | ||
| Max: 525 | ||
| Layout/SpaceAroundMethodCallOperator: | ||
| Enabled: true | ||
| Style/ExponentialNotation: | ||
| Enabled: true | ||
| Layout/EmptyLinesAroundAttributeAccessor: | ||
| Enabled: true | ||
| Style/SlicingWithRange: | ||
| Enabled: true | ||
| Lint/DeprecatedOpenSSLConstant: | ||
| Enabled: false |
-82
| PATH | ||
| remote: . | ||
| specs: | ||
| serrano (0.6.2) | ||
| faraday (~> 1.0, >= 1.0.1) | ||
| faraday_middleware (~> 1.0) | ||
| multi_json (~> 1.13, >= 1.13.1) | ||
| thor (>= 0.20, < 1.1) | ||
| GEM | ||
| remote: https://rubygems.org/ | ||
| specs: | ||
| addressable (2.7.0) | ||
| public_suffix (>= 2.0.2, < 5.0) | ||
| ast (2.4.0) | ||
| codecov (0.1.16) | ||
| json | ||
| simplecov | ||
| url | ||
| crack (0.4.3) | ||
| safe_yaml (~> 1.0.0) | ||
| docile (1.3.2) | ||
| faraday (1.0.1) | ||
| multipart-post (>= 1.2, < 3) | ||
| faraday_middleware (1.0.0) | ||
| faraday (~> 1.0) | ||
| hashdiff (1.0.1) | ||
| json (2.3.0) | ||
| multi_json (1.14.1) | ||
| multipart-post (2.1.1) | ||
| parallel (1.19.1) | ||
| parser (2.7.1.2) | ||
| ast (~> 2.4.0) | ||
| power_assert (1.1.7) | ||
| public_suffix (4.0.4) | ||
| rainbow (3.0.0) | ||
| rake (13.0.1) | ||
| rexml (3.2.4) | ||
| rubocop (0.84.0) | ||
| parallel (~> 1.10) | ||
| parser (>= 2.7.0.1) | ||
| rainbow (>= 2.2.2, < 4.0) | ||
| rexml | ||
| rubocop-ast (>= 0.0.3) | ||
| ruby-progressbar (~> 1.7) | ||
| unicode-display_width (>= 1.4.0, < 2.0) | ||
| rubocop-ast (0.0.3) | ||
| parser (>= 2.7.0.1) | ||
| ruby-progressbar (1.10.1) | ||
| safe_yaml (1.0.5) | ||
| simplecov (0.18.5) | ||
| docile (~> 1.1) | ||
| simplecov-html (~> 0.11) | ||
| simplecov-html (0.12.2) | ||
| test-unit (3.3.5) | ||
| power_assert | ||
| thor (1.0.1) | ||
| unicode-display_width (1.7.0) | ||
| url (0.3.2) | ||
| vcr (6.0.0) | ||
| webmock (3.8.3) | ||
| addressable (>= 2.3.6) | ||
| crack (>= 0.3.2) | ||
| hashdiff (>= 0.4.0, < 2.0.0) | ||
| PLATFORMS | ||
| ruby | ||
| DEPENDENCIES | ||
| bundler (~> 2.0, >= 2.0.2) | ||
| codecov (~> 0.1.10) | ||
| json (~> 2.1) | ||
| rake (~> 13.0, >= 12.3.1) | ||
| rubocop (~> 0.84.0) | ||
| serrano! | ||
| simplecov (~> 0.18.5) | ||
| test-unit (~> 3.2, >= 3.2.7) | ||
| vcr (~> 6.0) | ||
| webmock (~> 3.4, >= 3.4.1) | ||
| BUNDLED WITH | ||
| 2.1.4 |