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', page: nil, page_size: nil, offset: nil, limit: nil) {|Hash| ... } ⇒ Object
Requests a list projects.
-
#search(search_for:, institute: false, group_id: nil, published_since: nil, modified_since: nil, order: 'published_date', order_direction: 'desc') {|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
81 82 83 |
# File 'lib/public_projects.rb', line 81 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
73 74 75 |
# File 'lib/public_projects.rb', line 73 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', page: nil, page_size: nil, offset: nil, limit: nil) {|Hash| ... } ⇒ Object
Requests a list projects
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/public_projects.rb', line 17 def list( institute: false, group_id: nil, published_since: 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['published_since'] = published_since unless published_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: 'projects', args: args, &block) end |
#search(search_for:, institute: false, group_id: nil, published_since: nil, modified_since: nil, order: 'published_date', order_direction: 'desc') {|Hash| ... } ⇒ Object
Search within all projects
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/public_projects.rb', line 50 def search( search_for:, institute: false, group_id: nil, published_since: nil, modified_since: nil, order: 'published_date', order_direction: 'desc', &block ) args = { 'search_for' => search_for } args['institution'] = @institute_id.to_i if institute args['group'] = group_id unless group_id.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/projects/search', args: args, &block) end |