Class: Figshare::Other

Inherits:
Base
  • Object
show all
Defined in:
lib/other.rb

Overview

Misc Figshare API calls that they have classified as Other.

Instance Attribute Summary

Attributes inherited from Base

#api_url, #article_index_file, #auth_token, #base_dir, #hostname, #institute_id

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Figshare::Base

Instance Method Details

#item_types(group_id:) {|Array| ... } ⇒ Object

Fetch item types

Parameters:

  • group_id (Integer)

Yields:

  • (Array)

    [{id: 0, name:, string_id:, icon:, public_description:, is_selectable: , url_name: } ]



9
10
11
# File 'lib/other.rb', line 9

def item_types(group_id:, &block)
  get(api_query: 'item_types', args: { 'group_id' => group_id }, &block)
end

#private_account_info(impersonate: nil) {|Hash| ... } ⇒ Object

Get Account information for current user

Yields:

  • (Hash)

    first_name, … see figshare API docs



24
25
26
27
28
# File 'lib/other.rb', line 24

def (impersonate: nil, &block)
  args = {}
  args['impersonate'] = impersonate unless impersonate.nil?
  get(api_query: 'account', args: args, &block)
end

#private_account_licenses {|Array| ... } ⇒ Object

Get private licenses

Yields:

  • (Array)

    [name:, url:]



48
49
50
# File 'lib/other.rb', line 48

def 
  get(api_query: 'account/licenses', &block)
end

#public_categories {|Array| ... } ⇒ Object

Get public categories

Yields:

  • (Array)

    [id:, title:, path:, source_id:, taxonomy_id:]



33
34
35
36
# File 'lib/other.rb', line 33

def public_categories(&block)
  args = {}
  get(api_query: 'categories', &block)
end

#public_file_download(file_id:) {|Data| ... } ⇒ Object

Download a file

Parameters:

  • file_id (Integer)

    Figshare file id

Yields:

  • (Data)

    Binary data



56
57
58
# File 'lib/other.rb', line 56

def public_file_download(file_id:, &block)
  get(api_query: "file/download/#{file_id}", &block)
end

#public_licenses {|Array| ... } ⇒ Object

Get public licenses

Yields:

  • (Array)

    [name:, url:]



41
42
43
# File 'lib/other.rb', line 41

def public_licenses
  get(api_query: 'licenses', &block)
end

#search_funding(search_for:) {|Array| ... } ⇒ Object

Search from funding records

Parameters:

  • search_for (String)

    string to search for

Yields:

  • (Array)

    [title, grant_code, funder_name, is_user_defined, url]



17
18
19
# File 'lib/other.rb', line 17

def search_funding(search_for:, &block)
  post(api_query: 'account/funding/search', args: { 'search_for' => search_for }, &block)
end