class Figshare::PublicArticles

Figshare Public Articles API

Public Instance Methods

detail(article_id:, &block) click to toggle source

Return details of specific article (default version)

@param article_id [Integer] Figshare id of the article @yield [Hash] See figshare api docs

# File lib/public_articles.rb, line 78
def detail(article_id:, &block)
  get(api_query: "articles/#{article_id}",  &block)
end
file_detail(article_id:, file_id:) click to toggle source

Return details of a specific file for a specific articles

@param article_id [Integer] Figshare id of the article @param file_id [Integer] Figshare id of the file @yield [Hash] See figshare api docs

# File lib/public_articles.rb, line 120
def file_detail(article_id:, file_id:)
  get(api_query: "articles/#{article_id}/files/#{file_id}", &block)
end
files(article_id:) click to toggle source

Return details of list of files for a specific articles

@param article_id [Integer] Figshare id of the article @yield [Hash] {id, title, doi, handle, url, published_date}

# File lib/public_articles.rb, line 111
def files(article_id:)
  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', &block ) click to toggle source

Requests a list of public articles

@param institution [Boolean] Just our institution @param group_id [Integer] Only return this group's collections @param published_since [Time] Return results if published after this time @param modified_since [Time] Return results if modified after this time @param resource_doi [String] Matches this resource doi @param item_type [String] Matches this item_type. See Figshare API docs for list (docs.figshare.com/#articles_list) @param doi [String] Matches this doi @param handle [String] Matches this handle @param order [String] “published_date” Default, “modified_date”, “views”, “cites”, “shares” @param order_direction [String] “desc” Default, “asc” @yield [Hash] {id, title, doi, handle, url, published_date}

# File lib/public_articles.rb, line 20
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',
                    &block
                    )
  args = {}
  args['institution'] = @institute_id  if ! institute.nil?
  args['group_id'] = group_id if ! group_id.nil?
  args['item_type'] = item_type if ! item_type.nil?
  args['resource_doi'] = resource_doi if ! resource_doi.nil?
  args['doi'] = doi if ! doi.nil?
  args['handle'] = handle if ! handle.nil?
  args['published_since'] = published_since if ! published_since.nil?
  args['modified_since'] = modified_since if ! modified_since.nil?
  args['order'] = order if ! order.nil?
  args['order_direction'] = order_direction if ! order_direction.nil?
  get_paginate(api_query: 'articles', args: args, &block)
end
version_detail(article_id:, version_id: , embargo: false, confidentiality: false, &block) click to toggle source

Return details of specific article version

@param article_id [Integer] Figshare id of the article @param version_id [Integer] Figshare id of the article's version @param embargo [Boolean] Include only embargoed items @param confidentiality [Boolean] Include only confidential items @yield [Hash] See figshare api docs

# File lib/public_articles.rb, line 97
def version_detail(article_id:, version_id: , embargo: false, confidentiality: false, &block)
    if embargo
      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:, &block) click to toggle source

Return details of list of versions for a specific article

@param article_id [Integer] Figshare id of the artcle @yield [Hash] See figshare api docs

# File lib/public_articles.rb, line 86
def versions(article_id:, &block)
  get(api_query: "articles/#{article_id}/versions",  &block)
end