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_record: nil, page: nil, page_size: nil, offset: nil, limit: nil, 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:, page: nil, page_size: nil, offset: nil, limit: nil, impersonate: nil) {|Array| ... } ⇒ 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) {|Array| ... } ⇒ Object
Get the files associated with an artilcle in a project.
-
#collaborator_invite(project_id:, role_name:, comment:, user_id: nil, email: nil, 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) {|Array| ... } ⇒ Object
Get the project collaborators.
-
#create(title:, description:, group_id:, funding: '', funding_list: [], custom_field_list: nil, 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', page: nil, page_size: nil, offset: nil, limit: nil, impersonate: nil) {|Array| ... } ⇒ Object
Requests a list private projects.
-
#note_create(project_id:, text:, impersonate: nil) {|Hash| ... } ⇒ Object
Create a project note.
-
#note_delete(project_id:, note_id:, impersonate: nil, &block) ⇒ Object
Delete a project note.
-
#note_detail(project_id:, note_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Get a note’s text.
-
#note_update(project_id:, note_id:, text:, impersonate: nil, &block) ⇒ Object
update a project note.
-
#notes(project_id:, page: nil, page_size: nil, offset: nil, limit: nil, impersonate: nil) {|Array| ... } ⇒ Object
List projects notes.
-
#project_collaborators_leave(project_id:, impersonate: nil, &block) ⇒ Object
Leave a project (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(search_for:, institute: false, group_id: nil, published_since: nil, modified_since: nil, order: 'published_date', order_direction: 'desc', page: nil, page_size: nil, offset: nil, limit: nil, impersonate: nil) {|Hash| ... } ⇒ Object
Search within the own (or institute’s) projects.
-
#update(project_id:, title: nil, description: nil, funding: nil, funding_list: nil, custom_field_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_record: nil, page: nil, page_size: nil, offset: nil, limit: nil, impersonate: nil) {|Hash| ... } ⇒ Object
Create a new Article and associate it with this project
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/private_projects.rb', line 319 def article_create( project_id:, article_record: nil, page: nil, page_size: nil, offset: nil, limit: nil, impersonate: nil, &block ) args = { 'article' => article_record } 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? args['impersonate'] = impersonate unless 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
343 344 345 346 347 |
# File 'lib/private_projects.rb', line 343 def article_delete(project_id:, article_id:, impersonate: nil, &block) args = {} args['impersonate'] = impersonate unless 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
355 356 357 358 359 |
# File 'lib/private_projects.rb', line 355 def article_detail(project_id:, article_id:, impersonate: nil, &block) args = {} args['impersonate'] = impersonate unless impersonate.nil? get(api_query: "account/projects/#{project_id}/articles/#{article_id}", args: args, &block) end |
#articles(project_id:, page: nil, page_size: nil, offset: nil, limit: nil, impersonate: nil) {|Array| ... } ⇒ Object
Return details of list of articles for a specific project
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/private_projects.rb', line 292 def articles( project_id:, page: nil, page_size: nil, offset: nil, limit: nil, impersonate: 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? args['impersonate'] = impersonate unless 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
379 380 381 382 383 |
# File 'lib/private_projects.rb', line 379 def artilce_file_detail(project_id:, article_id:, file_id:, impersonate: nil, &block) args = {} args['impersonate'] = impersonate unless 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) {|Array| ... } ⇒ Object
Get the files associated with an artilcle in a project
367 368 369 370 371 |
# File 'lib/private_projects.rb', line 367 def artilce_files(project_id:, article_id:, impersonate: nil, &block) args = {} args['impersonate'] = impersonate unless impersonate.nil? get(api_query: "account/projects/#{project_id}/articles/#{article_id}/files", args: args, &block) end |
#collaborator_invite(project_id:, role_name:, comment:, user_id: nil, email: nil, impersonate: nil) {|String| ... } ⇒ Object
Invite a new collaborators to the project
256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/private_projects.rb', line 256 def collaborator_invite(project_id:, role_name:, comment:, user_id: nil, email: nil, impersonate: nil, &block) raise 'collaborator_invite(): Need a user_id or an email address' if user_id.nil? && email.nil? args = { 'role_name' => role_name, 'comment' => comment } args['user_id'] = user_id unless user_id.nil? args['email'] = email unless email.nil? args['impersonate'] = impersonate unless 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.)
275 276 277 278 279 280 281 |
# File 'lib/private_projects.rb', line 275 def collaborator_remove(project_id:, user_id:, impersonate: nil, &block) raise 'collaborator_remove(): Need a user_id' if user_id.nil? args = {} args['impersonate'] = impersonate unless impersonate.nil? delete(api_query: "account/project/#{project_id}/collaborators/#{user_id}", args: args, &block) end |
#collaborators(project_id:, impersonate: nil) {|Array| ... } ⇒ Object
Get the project collaborators
242 243 244 245 246 |
# File 'lib/private_projects.rb', line 242 def collaborators(project_id:, impersonate: nil, &block) args = {} args['impersonate'] = impersonate unless impersonate.nil? get(api_query: "account/projects/#{project_id}/collaborators", args: args, &block) end |
#create(title:, description:, group_id:, funding: '', funding_list: [], custom_field_list: nil, impersonate: nil) {|Hash| ... } ⇒ Object
Create a new project
param group_id [Integer] Figshare group the project falls under.
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/private_projects.rb', line 90 def create(title:, description:, group_id:, funding: '', funding_list: [], custom_field_list: nil, impersonate: nil, &block) args = { 'title' => title, 'description' => description, 'group_id' => group_id, 'funding' => funding, 'funding_list' => funding_list } args['custom_field_list'] = custom_field_list unless custom_field_list.nil? args['impersonate'] = impersonate unless impersonate.nil? post(api_query: 'account/projects', args: args, &block) end |
#detail(project_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Return details of specific private project
117 118 119 120 121 |
# File 'lib/private_projects.rb', line 117 def detail(project_id:, impersonate: nil, &block) args = {} args['impersonate'] = impersonate unless impersonate.nil? get(api_query: "account/projects/#{project_id}", args: args, &block) end |
#list(storage: nil, roles: nil, order: 'published_date', order_direction: 'desc', page: nil, page_size: nil, offset: nil, limit: nil, impersonate: nil) {|Array| ... } ⇒ Object
Requests a list private 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/private_projects.rb', line 17 def list( storage: nil, roles: nil, order: 'published_date', order_direction: 'desc', page: nil, page_size: nil, offset: nil, limit: nil, impersonate: nil, &block ) args = {} args['storage'] = storage unless storage.nil? args['roles'] = roles unless roles.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? args['impersonate'] = impersonate unless impersonate.nil? get_paginate(api_query: 'account/projects', args: args, &block) end |
#note_create(project_id:, text:, impersonate: nil) {|Hash| ... } ⇒ Object
Create a project note
187 188 189 190 191 |
# File 'lib/private_projects.rb', line 187 def note_create(project_id:, text:, impersonate: nil, &block) args = { 'text' => text } args['impersonate'] = impersonate unless 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
198 199 200 201 202 |
# File 'lib/private_projects.rb', line 198 def note_delete(project_id:, note_id:, impersonate: nil, &block) args = {} args['impersonate'] = impersonate unless impersonate.nil? delete(api_query: "account/projects/#{project_id}/notes/#{note_id}", args: args, &block) end |
#note_detail(project_id:, note_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Get a note’s text
210 211 212 213 214 |
# File 'lib/private_projects.rb', line 210 def note_detail(project_id:, note_id:, impersonate: nil, &block) args = {} args['impersonate'] = impersonate unless impersonate.nil? get(api_query: "account/projects/#{project_id}/notes/#{note_id}", args: args, &block) end |
#note_update(project_id:, note_id:, text:, impersonate: nil, &block) ⇒ Object
update a project note
222 223 224 225 226 |
# File 'lib/private_projects.rb', line 222 def note_update(project_id:, note_id:, text:, impersonate: nil, &block) args = { 'text' => text } args['impersonate'] = impersonate unless impersonate.nil? put(api_query: "account/projects/#{project_id}/notes/#{note_id}", args: args, &block) end |
#notes(project_id:, page: nil, page_size: nil, offset: nil, limit: nil, impersonate: nil) {|Array| ... } ⇒ Object
List projects notes
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/private_projects.rb', line 164 def notes( project_id:, page: nil, page_size: nil, offset: nil, limit: nil, impersonate: 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? args['impersonate'] = impersonate unless impersonate.nil? get_paginate(api_query: "account/projects/#{project_id}/notes", args: args, &block) end |
#project_collaborators_leave(project_id:, impersonate: nil, &block) ⇒ Object
Leave a project (Note: project’s owner cannot leave the project.)
231 232 233 234 235 |
# File 'lib/private_projects.rb', line 231 def project_collaborators_leave(project_id:, impersonate: nil, &block) args = {} args['impersonate'] = impersonate unless 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
106 107 108 109 110 |
# File 'lib/private_projects.rb', line 106 def project_delete(project_id:, impersonate: nil, &block) args = {} args['impersonate'] = impersonate unless impersonate.nil? delete(api_query: "account/projects/#{project_id}", args: args, &block) end |
#publish(project_id:, impersonate: nil) {|Hash| ... } ⇒ Object
Publish a project
149 150 151 152 153 |
# File 'lib/private_projects.rb', line 149 def publish(project_id:, impersonate: nil, &block) args = {} args['impersonate'] = impersonate unless impersonate.nil? post(api_query: "account/projects/#{project_id}/publish", args: args, &block) end |
#search(search_for:, institute: false, group_id: nil, published_since: nil, modified_since: nil, order: 'published_date', order_direction: 'desc', page: nil, page_size: nil, offset: nil, limit: nil, impersonate: nil) {|Hash| ... } ⇒ Object
Search within the own (or institute’s) projects
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/private_projects.rb', line 51 def search( search_for:, institute: false, group_id: nil, published_since: nil, modified_since: nil, order: 'published_date', order_direction: 'desc', page: nil, page_size: nil, offset: nil, limit: nil, impersonate: nil, &block ) args = { 'search_for' => search_for } args['institution'] = @institute_id.to_i if institute args['group'] = group_id unless group_id.nil? args['impersonate'] = impersonate unless impersonate.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? post_paginate(api_query: 'account/projects/search', args: args, &block) end |
#update(project_id:, title: nil, description: nil, funding: nil, funding_list: nil, custom_field_list: nil, impersonate: nil) {|Hash| ... } ⇒ Object
Update an existing project
133 134 135 136 137 138 139 140 141 142 |
# File 'lib/private_projects.rb', line 133 def update(project_id:, title: nil, description: nil, funding: nil, funding_list: nil, custom_field_list: nil, impersonate: nil, &block) args = {} args['title'] = title unless title.nil? args['description'] = description unless description.nil? args['funding'] = funding unless funding.nil? args['funding_list'] = funding_list unless funding_list.nil? args['custom_field_list'] = custom_field_list unless custom_field_list.nil? args['impersonate'] = impersonate unless impersonate.nil? put(api_query: "account/projects/#{project_id}", args: args, &block) end |