Class: Figshare::PublicProjects
Overview
Figshare public projects api
Instance Attribute Summary
Attributes inherited from Base
#api_url, #article_index_file, #auth_token, #base_dir, #hostname, #institute_id
Instance Method Summary collapse
-
#articles(project_id:) {|Hash| ... } ⇒ Object
Get list of articles for a specific project.
-
#detail(project_id:) {|Hash| ... } ⇒ Object
Return details of specific project_id.
-
#list(institute: false, group_id: nil, published_since: nil, order: 'published_date', order_direction: 'desc') {|Hash| ... } ⇒ Object
Requests a list projects.
-
#search(institute: false, group_id: nil, published_since: nil, modified_since: nil, order: 'published_date', order_direction: 'desc', search_for:) {|Hash| ... } ⇒ Object
Search within all projects.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Figshare::Base
Instance Method Details
#articles(project_id:) {|Hash| ... } ⇒ Object
Get list of articles for a specific project
61 62 63 |
# File 'lib/public_projects.rb', line 61 def articles(project_id:, &block) get_paginate(api_query: "projects/#{project_id}/articles", &block) end |
#detail(project_id:) {|Hash| ... } ⇒ Object
Return details of specific project_id
53 54 55 |
# File 'lib/public_projects.rb', line 53 def detail(project_id:, &block) get(api_query: "projects/#{project_id}", &block) end |
#list(institute: false, group_id: nil, published_since: nil, order: 'published_date', order_direction: 'desc') {|Hash| ... } ⇒ Object
Requests a list projects
14 15 16 17 18 19 20 21 22 |
# File 'lib/public_projects.rb', line 14 def list(institute: false,group_id: nil, published_since: nil, order: 'published_date', order_direction: 'desc', &block) args = {} args['institution'] = @institute_id if ! institute.nil? args['group'] = group_id if ! group_id.nil? args['published_since'] = published_since if ! published_since.nil? args['order'] = order if ! order.nil? args['order_direction'] = order_direction if ! order_direction.nil? get_paginate(api_query: 'projects', args: args, &block) end |
#search(institute: false, group_id: nil, published_since: nil, modified_since: nil, order: 'published_date', order_direction: 'desc', search_for:) {|Hash| ... } ⇒ Object
Search within all projects
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/public_projects.rb', line 33 def search(institute: false, group_id: nil, published_since: nil, modified_since: nil, order: 'published_date', order_direction: 'desc', search_for:, &block ) args = { 'search_for' => search_for } args['institution'] = @institute_id if ! institute.nil? args['group'] = group_id if ! group_id.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? post(api_query: 'account/projects/search', args: args, &block) end |