Class: Figshare::PublicArticles
Overview
Figshare Public Articles API
Instance Attribute Summary
Attributes inherited from Base
#api_url, #article_index_file, #auth_token, #base_dir, #hostname, #institute_id
Instance Method Summary collapse
-
#detail(article_id:) {|Hash| ... } ⇒ Object
Return details of specific article (default version).
-
#file_detail(article_id:, file_id:) {|Hash| ... } ⇒ Object
Return details of a specific file for a specific articles.
-
#files(article_id:) {|Hash| ... } ⇒ Object
Return details of list of files for a specific articles.
-
#list(institute: false, group_id: nil, published_since: nil, modified_since: nil, item_type: nil, resource_doi: nil, doi: nil, handle: nil, order: 'published_date', order_direction: 'desc', page: nil, page_size: nil, offset: nil, limit: nil) {|Array| ... } ⇒ Object
Requests a list of public articles.
-
#search(search_for:, institute: false, group_id: nil, published_since: nil, modified_since: nil, item_type: nil, resource_doi: nil, doi: nil, handle: nil, order: 'published_date', order_direction: 'desc') {|Hash| ... } ⇒ Object
Search within the public articles.
-
#version_detail(article_id:, version_id:, embargo: false, confidentiality: false) {|Hash| ... } ⇒ Object
Return details of specific article version.
-
#versions(article_id:) {|Hash| ... } ⇒ Object
Return details of list of versions for a specific article.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Figshare::Base
Instance Method Details
#detail(article_id:) {|Hash| ... } ⇒ Object
Return details of specific article (default version)
100 101 102 |
# File 'lib/public_articles.rb', line 100 def detail(article_id:, &block) get(api_query: "articles/#{article_id}", &block) end |
#file_detail(article_id:, file_id:) {|Hash| ... } ⇒ Object
Return details of a specific file for a specific articles
142 143 144 |
# File 'lib/public_articles.rb', line 142 def file_detail(article_id:, file_id:, &block) get(api_query: "articles/#{article_id}/files/#{file_id}", &block) end |
#files(article_id:) {|Hash| ... } ⇒ Object
Return details of list of files for a specific articles
133 134 135 |
# File 'lib/public_articles.rb', line 133 def files(article_id:, &block) get(api_query: "articles/#{article_id}/files", &block) end |
#list(institute: false, group_id: nil, published_since: nil, modified_since: nil, item_type: nil, resource_doi: nil, doi: nil, handle: nil, order: 'published_date', order_direction: 'desc', page: nil, page_size: nil, offset: nil, limit: nil) {|Array| ... } ⇒ Object
Requests a list of public articles
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/public_articles.rb', line 22 def list( institute: false, group_id: nil, published_since: nil, modified_since: nil, item_type: nil, resource_doi: nil, doi: nil, handle: nil, order: 'published_date', order_direction: 'desc', page: nil, page_size: nil, offset: nil, limit: nil, &block ) args = {} args['institution'] = @institute_id.to_i if institute args['group_id'] = group_id unless group_id.nil? # Not sure if this should be 'group' or 'group_id'. API has conflicting info args['item_type'] = item_type unless item_type.nil? args['resource_doi'] = resource_doi unless resource_doi.nil? args['doi'] = doi unless doi.nil? args['handle'] = handle unless handle.nil? args['published_since'] = published_since unless published_since.nil? args['modified_since'] = modified_since unless modified_since.nil? args['order'] = order unless order.nil? args['order_direction'] = order_direction unless order_direction.nil? args['page'] = page unless page.nil? args['page_size'] = page_size unless page_size.nil? args['offset'] = offset unless offset.nil? args['limit'] = limit unless limit.nil? get_paginate(api_query: 'articles', args: args, &block) end |
#search(search_for:, institute: false, group_id: nil, published_since: nil, modified_since: nil, item_type: nil, resource_doi: nil, doi: nil, handle: nil, order: 'published_date', order_direction: 'desc') {|Hash| ... } ⇒ Object
Search within the public articles
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/public_articles.rb', line 69 def search( search_for:, institute: false, group_id: nil, published_since: nil, modified_since: nil, item_type: nil, resource_doi: nil, doi: nil, handle: nil, order: 'published_date', order_direction: 'desc', &block ) args = { 'search_for' => search_for } args['institution'] = @institute_id.to_i if institute args['group_id'] = group_id unless group_id.nil? args['item_type'] = item_type unless item_type.nil? args['resource_doi'] = resource_doi unless resource_doi.nil? args['doi'] = doi unless doi.nil? args['handle'] = handle unless handle.nil? args['published_since'] = published_since unless published_since.nil? args['modified_since'] = modified_since unless modified_since.nil? args['order'] = order unless order.nil? args['order_direction'] = order_direction unless order_direction.nil? post(api_query: 'articles/search', args: args, &block) end |
#version_detail(article_id:, version_id:, embargo: false, confidentiality: false) {|Hash| ... } ⇒ Object
Return details of specific article version
119 120 121 122 123 124 125 126 127 |
# File 'lib/public_articles.rb', line 119 def version_detail(article_id:, version_id:, embargo: false, confidentiality: false, &block) if get(api_query: "articles/#{article_id}/versions/#{version_id}/embargo", &block) elsif confidentiality get(api_query: "articles/#{article_id}/versions/#{version_id}/confidentiality", &block) else get(api_query: "articles/#{article_id}/versions/#{version_id}", &block) end end |
#versions(article_id:) {|Hash| ... } ⇒ Object
Return details of list of versions for a specific article
108 109 110 |
# File 'lib/public_articles.rb', line 108 def versions(article_id:, &block) get(api_query: "articles/#{article_id}/versions", &block) end |