Class: Figshare::PrivateProjects
Overview
Figshare private project api
Instance Attribute Summary
Attributes inherited from Base
#api_url, #article_index_file, #auth_token, #base_dir, #hostname, #institute_id
Instance Method Summary collapse
-
#article_create(project_id:, article:, impersonate: nil) {|Hash| ... } ⇒ Object
Create a new Article and associate it with this project.
-
#article_delete(project_id:, article_id:, impersonate: nil, &block) ⇒ Object
delete an article from a project.
-
#article_detail(project_id:, article_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Get the details of an artilcle in a project.
-
#articles(project_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Return details of list of articles for a specific project.
-
#artilce_file_detail(project_id:, article_id:, file_id:, impersonate: nil, &block) ⇒ Object
Get the files associated with an artilcle in a project.
-
#artilce_files(project_id:, article_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Get the files associated with an artilcle in a project.
-
#collaborator_invite(project_id:, role_name:, user_id: nil, email: nil, comment:, impersonate: nil) {|String| ... } ⇒ Object
Invite a new collaborators to the project.
-
#collaborator_remove(project_id:, user_id:, impersonate: nil, &block) ⇒ Object
Leave a project (Please note: project’s owner cannot leave the project.).
-
#collaborators(project_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Get the project collaborators.
-
#create(title:, description:, funding: '', funding_list: [], group_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Create a new project.
-
#detail(project_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Return details of specific private project.
-
#list(storage: nil, roles: nil, order: 'published_date', order_direction: 'desc', impersonate: nil) {|Hash| ... } ⇒ Object
Requests a list private projects.
-
#note_create(project_id:, note_id:, text:, impersonate: nil, &block) ⇒ Object
update a project note.
-
#note_delete(project_id:, note_id:, impersonate: nil, &block) ⇒ Object
Delete a project note.
-
#note_detail(impersonate: nil) {|Hash| ... } ⇒ Object
Get a note’s text.
-
#notes(project_id:, impersonate: nil) {|Hash| ... } ⇒ Object
List projects notes.
-
#private_project_collaborators_leave(project_id:, impersonate: nil, &block) ⇒ Object
Leave a project (Please note: project’s owner cannot leave the project.).
-
#project_delete(project_id:, impersonate: nil, &block) ⇒ Object
Delete an existing project.
-
#publish(project_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Publish a project.
-
#search(institute: false, group_id: nil, impersonate: nil, published_since: nil, modified_since: nil, order: 'published_date', order_direction: 'desc', search_for:) {|Hash| ... } ⇒ Object
Search within the own (or institute’s) projects.
-
#update(project_id:, title: nil, description: nil, funding: nil, funding_list: nil, impersonate: nil) {|Hash| ... } ⇒ Object
Update an existing project.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Figshare::Base
Instance Method Details
#article_create(project_id:, article:, impersonate: nil) {|Hash| ... } ⇒ Object
Create a new Article and associate it with this project
253 254 255 256 257 258 |
# File 'lib/private_projects.rb', line 253 def article_create(project_id:, article:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? # Figshare Docs say this should be post_paginate, but that makes no sense. Will have to test post_paginate(api_query: "account/projects/#{project_id}/articles", args: args, &block) end |
#article_delete(project_id:, article_id:, impersonate: nil, &block) ⇒ Object
delete an article from a project
265 266 267 268 269 |
# File 'lib/private_projects.rb', line 265 def article_delete(project_id:, article_id:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? delete(api_query: "account/projects/#{project_id}/articles/#{article_id}", args: args, &block) end |
#article_detail(project_id:, article_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Get the details of an artilcle in a project
277 278 279 280 281 |
# File 'lib/private_projects.rb', line 277 def article_detail(project_id:, article_id:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? get(api_query: "account/projects/#{project_id}/articles/#{article_id}", args: args, &block) end |
#articles(project_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Return details of list of articles for a specific project
241 242 243 244 245 |
# File 'lib/private_projects.rb', line 241 def articles(project_id:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? get_paginate(api_query: "account/projects/#{project_id}/articles", args: args, &block) end |
#artilce_file_detail(project_id:, article_id:, file_id:, impersonate: nil, &block) ⇒ Object
Get the files associated with an artilcle in a project
301 302 303 304 305 |
# File 'lib/private_projects.rb', line 301 def artilce_file_detail(project_id:, article_id:, file_id:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? delete(api_query: "account/projects/#{project_id}/articles/#{article_id}/files/#{file_id}", args: args, &block) end |
#artilce_files(project_id:, article_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Get the files associated with an artilcle in a project
289 290 291 292 293 |
# File 'lib/private_projects.rb', line 289 def artilce_files(project_id:, article_id:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? get(api_query: "account/projects/#{project_id}/articles/#{article_id}/files", args: args, &block) end |
#collaborator_invite(project_id:, role_name:, user_id: nil, email: nil, comment:, impersonate: nil) {|String| ... } ⇒ Object
Invite a new collaborators to the project
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/private_projects.rb', line 208 def collaborator_invite(project_id:, role_name:, user_id: nil, email: nil, comment:, impersonate: nil, &block) args = { 'role_name' => role_name, 'comment' => comment } if ! user_id.nil? args['user_id'] = user_id elsif ! email.nil? args['email'] = email else raise "collaborator_invite(): Need a user_id or an email address" end args["impersonate"] = impersonate if ! impersonate.nil? collaborator = { "role_name" => role_name, "user_id" => user_id, "email" => email, "comment" => comment } post(api_query: "account/project/#{project_id}/collaborators", args: args, data: collaborator, &block) end |
#collaborator_remove(project_id:, user_id:, impersonate: nil, &block) ⇒ Object
Leave a project (Please note: project’s owner cannot leave the project.)
230 231 232 233 234 |
# File 'lib/private_projects.rb', line 230 def collaborator_remove(project_id:, user_id:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? delete(api_query: "account/project/#{project_id}/collaborators/#{user_id}", args: args, &block) end |
#collaborators(project_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Get the project collaborators
194 195 196 197 198 |
# File 'lib/private_projects.rb', line 194 def collaborators(project_id:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? get(api_query: "account/projects/#{project_id}/collaborators", args: args, &block) end |
#create(title:, description:, funding: '', funding_list: [], group_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Create a new project
#param group_id [Integer] Figshare group the project falls under.
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/private_projects.rb', line 60 def create(title:, description:, funding: '', funding_list: [], group_id:, impersonate: nil, &block) args = { "title" => title, "description" => description, "group_id" => group_id, "funding" => funding, "funding_list" => funding_list } args["impersonate"] = impersonate if ! impersonate.nil? post(api_query: 'account/projects', args: args, &block) end |
#detail(project_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Return details of specific private project
86 87 88 89 90 |
# File 'lib/private_projects.rb', line 86 def detail(project_id:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? get(api_query: "account/projects/#{project_id}", args: args, &block) end |
#list(storage: nil, roles: nil, order: 'published_date', order_direction: 'desc', impersonate: nil) {|Hash| ... } ⇒ Object
Requests a list private projects
14 15 16 17 18 19 20 21 22 |
# File 'lib/private_projects.rb', line 14 def list(storage: nil, roles: nil, order: 'published_date', order_direction: 'desc', impersonate: nil, &block) args = {} args['storage'] = storage if ! storage.nil? args['roles'] = roles if ! roles.nil? args['order'] = order if ! order.nil? args['order_direction'] = order_direction if ! order_direction.nil? args["impersonate"] = impersonate if ! impersonate.nil? get_paginate(api_query: 'account/projects', args: args, &block) end |
#note_create(project_id:, note_id:, text:, impersonate: nil, &block) ⇒ Object
update a project note
139 140 141 142 143 |
# File 'lib/private_projects.rb', line 139 def note_create(project_id:, text:, impersonate: nil, &block) args = { 'text' => text } args["impersonate"] = impersonate if ! impersonate.nil? post(api_query: "account/projects/#{project_id}/notes", args: args, &block) end |
#note_delete(project_id:, note_id:, impersonate: nil, &block) ⇒ Object
Delete a project note
150 151 152 153 154 |
# File 'lib/private_projects.rb', line 150 def note_delete(project_id:, note_id:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? delete(api_query: "account/projects/#{project_id}/notes/#{note_id}", args: args, &block) end |
#note_detail(impersonate: nil) {|Hash| ... } ⇒ Object
Get a note’s text
162 163 164 165 166 |
# File 'lib/private_projects.rb', line 162 def note_detail(impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? get(api_query: "account/projects/#{project_id}/notes/#{note_id}", args: args, &block) end |
#notes(project_id:, impersonate: nil) {|Hash| ... } ⇒ Object
List projects notes
127 128 129 130 131 |
# File 'lib/private_projects.rb', line 127 def notes(project_id:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? get_paginate(api_query: "account/projects/#{project_id}/notes", args: args, &block) end |
#private_project_collaborators_leave(project_id:, impersonate: nil, &block) ⇒ Object
Leave a project (Please note: project’s owner cannot leave the project.)
183 184 185 186 187 |
# File 'lib/private_projects.rb', line 183 def private_project_collaborators_leave(project_id:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? post(api_query: "account/projects/#{project_id}/leave", args: args, &block) end |
#project_delete(project_id:, impersonate: nil, &block) ⇒ Object
Delete an existing project
75 76 77 78 79 |
# File 'lib/private_projects.rb', line 75 def project_delete(project_id:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? delete(api_query: 'account/projects/#{project_id}', args: args, &block) end |
#publish(project_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Publish a project
116 117 118 119 120 |
# File 'lib/private_projects.rb', line 116 def publish(project_id:, impersonate: nil, &block) args = {} args["impersonate"] = impersonate if ! impersonate.nil? post(api_query: "account/projects/#{project_id}/publish", args: args, &block) end |
#search(institute: false, group_id: nil, impersonate: nil, published_since: nil, modified_since: nil, order: 'published_date', order_direction: 'desc', search_for:) {|Hash| ... } ⇒ Object
Search within the own (or institute’s) projects
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/private_projects.rb', line 34 def search(institute: false, group_id: nil, impersonate: 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["impersonate"] = impersonate if ! impersonate.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 |
#update(project_id:, title: nil, description: nil, funding: nil, funding_list: nil, impersonate: nil) {|Hash| ... } ⇒ Object
Update an existing project
101 102 103 104 105 106 107 108 109 |
# File 'lib/private_projects.rb', line 101 def update(project_id:, title: nil, description: nil, funding: nil, funding_list: nil, impersonate: nil, &block) args = {} args["title"] = title if ! title.nil? args["description"] = description if ! description.nil? args["funding"] = funding if ! funding.nil? args["funding_list"] = funding_list if ! funding_list.nil? args["impersonate"] = impersonate if ! impersonate.nil? put(api_query: "account/projects/#{project_id}", args: args, &block) end |