Module: Zenodo::DSL::Depositions
- Included in:
- Zenodo::DSL
- Defined in:
- lib/zenodo/dsl/depositions.rb
Instance Method Summary collapse
-
#create_deposition(deposition:) ⇒ Zenodo::Resources::deposition?
POST /Deposit/Depositions Creates a deposition.
-
#delete_deposition(id:) ⇒ Faraday::Response
DELETE /Deposit/Depositions/id Deletes a deposition.
-
#get_deposition(id:) ⇒ Zenodo::Resources::deposition?
GET /Deposit/Deposition/id Get a deposition.
-
#get_depositions ⇒ Array?
GET /Deposit/Depositions Get depositions.
-
#update_deposition(id:, deposition:) ⇒ Zenodo::Resources::deposition?
PUT /Deposit/Depositions Updates a deposition.
Instance Method Details
#create_deposition(deposition:) ⇒ Zenodo::Resources::deposition?
POST /Deposit/Depositions Creates a deposition.
27 28 29 30 |
# File 'lib/zenodo/dsl/depositions.rb', line 27 def create_deposition(deposition:) raise ArgumentError, "Deposition cannot be blank" if deposition.blank? Resources::Deposition.parse(request(:post, "deposit/depositions/", deposition)) end |
#delete_deposition(id:) ⇒ Faraday::Response
DELETE /Deposit/Depositions/id Deletes a deposition.
49 50 51 52 |
# File 'lib/zenodo/dsl/depositions.rb', line 49 def delete_deposition(id:) raise ArgumentError, "ID cannot be blank" if id.blank? request(:delete, "deposit/depositions/#{id}") end |
#get_deposition(id:) ⇒ Zenodo::Resources::deposition?
GET /Deposit/Deposition/id Get a deposition.
17 18 19 20 |
# File 'lib/zenodo/dsl/depositions.rb', line 17 def get_deposition(id:) raise ArgumentError, "ID cannot be blank" if id.blank? Resources::Deposition.parse(request(:get, "deposit/depositions/#{id}")) end |
#get_depositions ⇒ Array?
GET /Deposit/Depositions Get depositions.
8 9 10 |
# File 'lib/zenodo/dsl/depositions.rb', line 8 def get_depositions Resources::Deposition.parse(request(:get, "deposit/depositions/", nil, nil)) end |
#update_deposition(id:, deposition:) ⇒ Zenodo::Resources::deposition?
PUT /Deposit/Depositions Updates a deposition.
38 39 40 41 42 |
# File 'lib/zenodo/dsl/depositions.rb', line 38 def update_deposition(id:, deposition:) raise ArgumentError, "ID cannot be blank" if id.blank? raise ArgumentError, "Deposition cannot be blank" if deposition.blank? Resources::Deposition.parse(request(:put, "deposit/depositions/#{id}", deposition)) end |