figshare_api_v2 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e35222cd91463f8b07d07968964587e8d979c937d82f8910f6975b3d57d9934
4
- data.tar.gz: b6a7f81dc93cae897a554071106b3eed9827e1f2fc8dc5b7fede1c04c9ed0081
3
+ metadata.gz: 36c39b92b903060de17387c48901a4fe606938a50361549c3981013c962ebae6
4
+ data.tar.gz: d67537244545182b7d7075b8dbe1ce19480aad7ad13af441289f5a7b7959ffd1
5
5
  SHA512:
6
- metadata.gz: bfaf7209932807418f286899b17b7bbbd8f289f2835a2b6bb4c0eafd67aae9f1b8b9f5b7dcbaa5f348cc97eb2d35ab86a502c82cf739637f2578801e0cf8e8d6
7
- data.tar.gz: f601643c473fa166e6cd47942943a3933dc266669b977232fcbcdd249c9d97b71f39a03cb9499b763cfcab704f5bc3c1cd024e3d6360b7ee2dccf3a02cb334fb
6
+ metadata.gz: ca3d9efee24f0e8a4d07573e46d35c1518b4461506093a75d73f0179fd90185e1a311704420ee74dcea5f70b4a900bbc434eac187978a323c310799683f13b6b
7
+ data.tar.gz: 20e43ce7f22338c3dcf96c8fe371f4c5c66a020b21bd0bd5ac23e04718039c619aeceb81ecfb73ff02261cae5220ef21a94871a1f174d329ef3cd29b1d66279c
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ robertburrowes Tue Mar 16 14:08:00 2021 +1300
2
+ private articles create was broken: Added private article body method
3
+ robertburrowes Tue Dec 1 14:43:50 2020 +1300
4
+ more testing
1
5
  robertburrowes Tue Dec 1 13:19:01 2020 +1300
2
6
  bump build version
3
7
  robertburrowes Tue Dec 1 13:18:27 2020 +1300
@@ -1,5 +1,5 @@
1
1
  module Figshare
2
- VERSION = '0.9.4'
2
+ VERSION = '0.9.5'
3
3
 
4
4
  require "wikk_webbrowser"
5
5
  require "wikk_json"
data/lib/institutions.rb CHANGED
@@ -176,9 +176,9 @@ module Figshare
176
176
  # @param institution_user_id [String] As set in the HR upload
177
177
  # @param email [String] as set in the HR upload
178
178
  # @yield [Hash] {id, first_name, last_name, institution_id, email, active, institution_user_id}
179
- def account_search(search_for:, is_active: nil, institution_user_id: nil, email: nil, &block)
179
+ def account_search(search_for: nil, is_active: nil, institution_user_id: nil, email: nil, &block)
180
180
  args = {}
181
- args['search_for'] = search_for
181
+ args['search_for'] = search_for unless search_for.nil?
182
182
  args['is_active'] = is_active if ! is_active.nil?
183
183
  args['institution_user_id'] = institution_user_id if ! institution_user_id.nil?
184
184
  args['email'] = email if ! email.nil?
@@ -51,14 +51,59 @@ module Figshare
51
51
  post(api_query: 'account/articles/search', args: args, &block)
52
52
  end
53
53
 
54
+ # Create a body for use with create and update methods
55
+ #
56
+ # @param title [String] Required
57
+ # @param description [String] The article description. In a publisher case, usually this is the remote article description
58
+ # @param keywords [Array] List of tags (strings) to be associated with the article. Tags can be used instead
59
+ # @param references [Array] List of links to be associated with the article (e.g ["http://link1", "http://link2", "http://link3"])
60
+ # @param categories [Array] List of category ids to be associated with the article(e.g [1, 23, 33, 66])
61
+ # @param authors [Array] List of authors to be associated with the article. The list can contain the following fields: id, name, first_name, last_name, email, orcid_id. If an id is supplied, it will take priority and everything else will be ignored. No more than 10 authors. For adding more authors use the specific authors endpoint. e.g. { "name" => "Joe X"} and or { "id" => 123 }
62
+ # @param custom_fields [Hash] List of key, values pairs to be associated with the article. eg. { "key" => "value"}
63
+ # @param defined_type [String] one of "figshare","media","dataset","poster","journal contribution", "presentation", "thesis", "software", "online resource", "preprint", "book", "conference contribution", "chapter", "peer review", "educational resource", "report", "standard", "composition", "funding", "physical object", "data management plan", "workflow", "monograph", "performance", "event", "service", "model", "registration"
64
+ # @param funding [String] Grant number or funding authority
65
+ # @param funding_list [Array] Funding creation / update items. eg {"id" => 0, "title" => "string"}
66
+ # @param license [Integer] License id for this article.
67
+ # @param doi [String] Not applicable for regular users. In an institutional case, make sure your group supports setting DOIs. This setting is applied by figshare via opening a ticket through our support/helpdesk system.
68
+ # @param handle [String] Not applicable for regular users. In an institutional case, make sure your group supports setting Handles. This setting is applied by figshare via opening a ticket through our support/helpdesk system.
69
+ # @param resource_doi [String] Not applicable to regular users. In a publisher case, this is the publisher article DOI.
70
+ # @param resource_title [String] Not applicable to regular users. In a publisher case, this is the publisher article title.
71
+ # @param timeline [Hash] Various timeline dates ie. { "firstOnline" => "date_string", "publisherPublication" => "date_string", "publisherAcceptance" => "date_string"},
72
+ # @param group_id [Integer] Not applicable to regular users. This field is reserved to institutions/publishers with access to assign to specific groups
73
+ def body(title:, description: nil, keywords: nil, references: nil, categories: nil, authors: nil, custom_fields: nil, defined_type: nil, funding: nil, funding_list: nil, license: nil, doi: nil, handle: nil, resource_doi: nil, resource_title: nil, timeline: nil, group_id: nil, contact: nil)
74
+ _body = {
75
+ 'title' => title
76
+ }
77
+ _body['description'] = description unless description.nil?
78
+ _body['keywords'] = keywords unless keywords.nil?
79
+ _body['references'] = references unless references.nil?
80
+ _body['categories'] = categories unless categories.nil?
81
+ _body['authors'] = authors unless authors.nil?
82
+ _body['custom_fields'] = custom_fields unless custom_fields.nil?
83
+ _body['defined_type'] = defined_type unless defined_type.nil?
84
+ _body['funding'] = funding unless funding.nil?
85
+ _body['funding_list'] = funding_list unless funding_list.nil?
86
+ _body['license'] = license unless license.nil?
87
+ _body['doi'] = doi unless doi.nil?
88
+ _body['handle'] = handle unless handle.nil?
89
+ _body['resource_doi'] = resource_doi unless resource_doi.nil?
90
+ _body['resource_title'] = resource_title unless resource_title.nil?
91
+ _body['timeline'] = timeline unless timeline.nil?
92
+ _body['group_id'] = group_id unless group_id.nil?
93
+
94
+ return _body
95
+ end
96
+
54
97
  # Create a new Article by sending article information
98
+ # The user calling the API (or impersonated user) looks to be added as an author, even if they aren't.
99
+ # A duplicate "Author" entry occurs when adding them explicitly
55
100
  #
56
101
  # @param impersonate [Integer] Figshare account_id of the user we are making this call on behalf of
57
102
  # @yield [Hash] { location }
58
- def create(impersonate: nil, &block)
103
+ def create(body:, impersonate: nil, &block)
59
104
  args = {}
60
105
  args["impersonate"] = impersonate if ! impersonate.nil?
61
- post(api_query: "account/articles/#{article_id}", args: args, &block)
106
+ post(api_query: "account/articles", args: args, data: body, &block)
62
107
  end
63
108
 
64
109
  # Delete an article (WARNING!!!!!)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: figshare_api_v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Burrowes
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-01 00:00:00.000000000 Z
11
+ date: 2021-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: wikk_json
@@ -112,7 +112,7 @@ homepage: https://UoA-eResearch.github.io/figshare_api_v2/
112
112
  licenses:
113
113
  - MIT
114
114
  metadata: {}
115
- post_install_message:
115
+ post_install_message:
116
116
  rdoc_options:
117
117
  - "--markup"
118
118
  - markdown
@@ -133,8 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  requirements: []
136
- rubygems_version: 3.1.2
137
- signing_key:
136
+ rubygems_version: 3.1.4
137
+ signing_key:
138
138
  specification_version: 4
139
139
  summary: Figshare version 2 API.
140
140
  test_files: []