Class: Figshare::PublicCollections
- Defined in:
- lib/public_collections.rb
Overview
Figshare public colections api calls
Instance Attribute Summary
Attributes inherited from Base
#api_url, #article_index_file, #auth_token, #base_dir, #hostname, #institute_id
Instance Method Summary collapse
-
#articles(collection_id:, page: nil, page_size: nil, offset: nil, limit: nil) {|Hash| ... } ⇒ Object
Get details of list of articles for a specific collection.
-
#detail(collection_id:) {|Hash| ... } ⇒ Object
Get details of specific collection (default version).
-
#list(institute: false, group_id: nil, published_since: nil, modified_since: nil, resource_doi: nil, doi: nil, handle: nil, order: 'published_date', order_direction: 'desc', page: nil, page_size: nil, offset: nil, limit: nil) {|Hash| ... } ⇒ Object
Requests a list of public collections.
-
#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 collections.
-
#version_detail(collection_id:, version_id:) {|Hash| ... } ⇒ Object
Get details of specific collection version.
-
#versions(collection_id:) {|Hash| ... } ⇒ Object
Return details of a list of public collection Versions.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Figshare::Base
Instance Method Details
#articles(collection_id:, page: nil, page_size: nil, offset: nil, limit: nil) {|Hash| ... } ⇒ Object
Get details of list of articles for a specific collection
125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/public_collections.rb', line 125 def articles( collection_id:, page: nil, page_size: nil, offset: nil, limit: nil, &block ) args = {} 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: "collections/#{collection_id}/articles", args: args, &block) end |
#detail(collection_id:) {|Hash| ... } ⇒ Object
Get details of specific collection (default version)
96 97 98 |
# File 'lib/public_collections.rb', line 96 def detail(collection_id:, &block) get(api_query: "collections/#{collection_id}", &block) end |
#list(institute: false, group_id: nil, published_since: nil, modified_since: nil, resource_doi: nil, doi: nil, handle: nil, order: 'published_date', order_direction: 'desc', page: nil, page_size: nil, offset: nil, limit: nil) {|Hash| ... } ⇒ Object
Requests a list of public collections
21 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 |
# File 'lib/public_collections.rb', line 21 def list( institute: false, group_id: nil, published_since: nil, modified_since: 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'] = group_id unless group_id.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: 'collections', 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 collections
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/public_collections.rb', line 65 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: 'account/articles/search', args: args, &block) end |
#version_detail(collection_id:, version_id:) {|Hash| ... } ⇒ Object
Get details of specific collection version
117 118 119 |
# File 'lib/public_collections.rb', line 117 def version_detail(collection_id:, version_id:, &block) get(api_query: "collections/#{collection_id}/versions/#{version_id}", &block) end |
#versions(collection_id:) {|Hash| ... } ⇒ Object
Return details of a list of public collection Versions
104 105 106 |
# File 'lib/public_collections.rb', line 104 def versions(collection_id:, &block) get(api_query: "collections/#{collection_id}/versions", &block) end |