class Figshare::PrivateCollections

Figshare Private Collections API

Public Instance Methods

article_delete(collection_id:, article_id: , impersonate: nil, &block) click to toggle source

Get a private article's details (Not a figshare API call. Duplicates PrivateArticles:article_detail)

@param collection_id [Integer] Figshare id of the collection @param article_id [Integer] Figshare id of the article @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of

# File lib/private_collections.rb, line 272
def article_delete(collection_id:, article_id: , impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  delete( api_query: "account/collections/#{collection_id}/articles/#{article_id}", args: args, &block)
end
article_detail(article_id:, impersonate: nil, &block) click to toggle source

Get a private article's details (Not a figshare API call. Duplicates PrivateArticles:article_detail)

@param article_id [Integer] Figshare id of the article @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of

# File lib/private_collections.rb, line 238
def article_detail(article_id:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  get(api_query: "account/articles/#{article_id}", args: args, &block)
end
articles(collection_id:, impersonate: nil, &block) click to toggle source

Yield collection articles

@param collection_id [Integer] Figshare id of the collection @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of @yield [Hash] See Figshare API docs

# File lib/private_collections.rb, line 228
def articles(collection_id:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  get(api_query: "account/collections/#{collection_id}/articles", args: args, &block)
end
articles_add(collection_id:, articles: , impersonate: nil, &block) click to toggle source

Associate new articles with the collection. This will add new articles to the list of already associated articles

@param collection_id [Integer] Figshare id of the collection @param articles [Array] array of Figshare article ids @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of @yield [Hash] { location }

# File lib/private_collections.rb, line 250
def articles_add(collection_id:, articles: , impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  post( api_query: "account/collections/#{collection_id}/articles", args: args, data: { "articles": articles}, &block)
end
articles_replace(collection_id:, articles:, impersonate: nil, &block) click to toggle source

Get a private article's details (Not a figshare API call. Duplicates PrivateArticles:article_detail)

@param collection_id [Integer] Figshare id of the collection @param articles [Array] array of Figshare article ids @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of

# File lib/private_collections.rb, line 261
def articles_replace(collection_id:, articles:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  put( api_query: "account/collections/#{collection_id}/articles/#{article_id}", args: args, data: { "articles": articles}, &block)
end
author_delete(collection_id:, impersonate: nil, author_id:) click to toggle source

Remove author from the collection

@param collection_id [Integer] Figshare id of the collection @param author_id [Integer] Figshare id for the author @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of

# File lib/private_collections.rb, line 171
def author_delete(collection_id:, impersonate: nil, author_id:)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  delete(api_query: "account/collections/#{collection_id}/authors/#{author_id}", args: args, &block)
end
authors(article_id, impersonate: nil, &block) click to toggle source

Yield collections authors

@param collection_id [Integer] Figshare id of the collection @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of @yield [Hash] {id, full_name, is_active, url_name, orcid_id}

# File lib/private_collections.rb, line 137
def authors(article_id, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  get(api_query: "account/collections/#{collection_id}/authors", args: args, &block)
end
authors_add(article_id, impersonate: nil, authors:) click to toggle source

Associate new authors with the collection. This will add new authors to the list of already associated authors

@param collection_id [Integer] Figshare id of the collection @param authors [Array] Can be a mix of { id } and/or { name } @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of @yield [Hash] { location }

# File lib/private_collections.rb, line 149
def authors_add(article_id, impersonate: nil, authors:)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  post(api_query: "account/collections/#{collection_id}/authors", args: args, data: {"authors" => authors}, &block)
end
authors_replace(article_id, impersonate: nil, authors:) click to toggle source

Replace existing authors list with a new list

@param collection_id [Integer] Figshare id of the collection @param authors [Array] Can be a mix of { id } and/or { name } @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of

# File lib/private_collections.rb, line 160
def authors_replace(article_id, impersonate: nil, authors:)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  put(api_query: "account/collections/#{collection_id}/authors", args: args, data: {"authors" => authors}, &block)
end
categories(collection_id:, impersonate: nil, &block) click to toggle source

Yield collection categories

@param collection_id [Integer] Figshare id of the collection @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of @yield [Hash] {parent_id, id, title}

# File lib/private_collections.rb, line 182
def categories(collection_id:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  get(api_query: 'account/collections/#{collection_id}/categories', args: args, &block)
end
categories_add(collection_id:, categories:, impersonate: nil, &block) click to toggle source

Associate new categories with the collection. This will add new categories to the list of already associated categories

@param collection_id [Integer] Figshare id of the collection @param categories [Array] [ categorie_id, … ] @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of @yield [Hash] { location }

# File lib/private_collections.rb, line 195
def categories_add(collection_id:, categories:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  post(api_query: "account/collections/#{collection_id}/categories", args: args, data: { 'categories' => categories }, &block)
end
categories_delete(collection_id:, category_id:, impersonate: nil, &block) click to toggle source

Delete category from collection's categories

@param collection_id [Integer] Figshare id of the collection @param category_id [Integer] Figshare id of the category @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of

# File lib/private_collections.rb, line 217
def categories_delete(collection_id:, category_id:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  delete(api_query: "account/collections/#{collection_id}/categories/#{category_id}", args: args, &block)
end
categories_replace(collection_id:, categories:, impersonate: nil, &block) click to toggle source

Associate new categories with the collection. This will remove all already associated categories and add these new ones

@param collection_id [Integer] Figshare id of the collection @param categories [Array] [ categorie_id, … ] @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of

# File lib/private_collections.rb, line 206
def categories_replace(collection_id:, categories:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  put(api_query: "account/collections/#{collection_id}/categories", args: args, data: { 'categories' => categories }, &block)
end
collection_delete(collection_id:, impersonate: nil, &block) click to toggle source

Delete a private collection

@param collection_id [Integer] Figshare id of the collection @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of

# File lib/private_collections.rb, line 69
def collection_delete(collection_id:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  delete( api_query: "account/collections/#{collection_id}/files/#{file_id}", args: args, &block )
end
create(body:, impersonate: nil, &block) click to toggle source

Create a new private Collection by sending collection information

@param body [Hash] See Figshare API docs @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of

# File lib/private_collections.rb, line 59
def create(body:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  post(api_query: "account/collections", args: args, data: body, &block)
end
detail(collection_id:, impersonate: nil, &block) click to toggle source

Return details of specific collection (default version)

@param collection_id [Integer] Figshare id of the collection @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of @yield [Hash] See figshare api docs

# File lib/private_collections.rb, line 80
def detail(collection_id:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  get(api_query: "account/collections/#{collection_id}", args: args, &block)
end
list(order: 'published_date', order_direction: 'desc', impersonate: nil, &block) click to toggle source

Requests a list of own (or institute's) collections

@param order [String] “published_date” Default, “modified_date”, “views”, “cites”, “shares” @param order_direction [String] “desc” Default, “asc” @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of @yield [Hash] {id, title, doi, handle, url, published_date}

# File lib/private_collections.rb, line 13
def list(order: 'published_date', order_direction: 'desc', impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  args['order'] = order if ! order.nil?
  args['order_direction'] = order_direction if ! order_direction.nil?
  get_paginate(api_query: 'account/collections', args: args, &block)
end
publish(collection_id:, impersonate: nil, &block) click to toggle source

When a collection is published, a new public version will be generated. Any further updates to the collection will affect the private collection data. In order to make these changes publicly visible, an explicit publish operation is needed.

@param collection_id [Integer] Figshare id of the collection @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of @yield [Hash] { location }

# File lib/private_collections.rb, line 126
def publish(collection_id:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  post(api_query: 'account/collections/#{collection_id}/publish', args: args, &block)
end
reserve_doi(collection_id:, impersonate: nil, &block) click to toggle source

Reserve DOI for collection

@param collection_id [Integer] Figshare id of the collection @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of @yield [Hash] { doi }

# File lib/private_collections.rb, line 102
def reserve_doi(collection_id:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  post(api_query: 'account/collections/#{collection_id}/reserve_doi', args: args, &block)
end
reserve_handle(collection_id:, impersonate: nil, &block) click to toggle source

Reserve Handle for collection

@param collection_id [Integer] Figshare id of the collection @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of @yield [Hash] { handle }

# File lib/private_collections.rb, line 113
def reserve_handle(collection_id:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  post(api_query: 'account/collections/#{collection_id}/reserve_handle', args: args, &block)
end
update(collection_id:, body:, impersonate: nil, &block) click to toggle source

Create a new private Collection by sending collection information

@param collection_id [Integer] Figshare id of the collection @param body [Hash] See Figshare API docs @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of

# File lib/private_collections.rb, line 91
def update(collection_id:, body:, impersonate: nil, &block)
  args = {}
  args["impersonate"] = impersonate  if ! impersonate.nil?
  put(api_query: "account/collections", args: args, data: body, &block)
end