Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Align to EcoPortal #23

Open
wants to merge 23 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
948a7e1
first commit: original ontologies_api_ruby_client from V.A. v2.5
ccruschi Jun 8, 2020
5ff1fba
added datacite metadata + doi creation
ccruschi Jun 8, 2020
fb61d25
update .gitignore
ccruschi Jun 8, 2020
80f524b
Initial commit
manuelfiorelli Sep 6, 2022
3eafccb
Merge branch 'master' into belisa-master
manuelfiorelli Mar 24, 2023
1b0fce6
Merge remote-tracking branch 'ontologies_api_ruby_client_archived/mas…
Apr 5, 2023
89c6d98
add identifier_request model
syphax-bouazzouni Apr 15, 2023
e932948
add the possibility to use bearer_token for authentification
syphax-bouazzouni Apr 15, 2023
fc70caa
enable read/write feature to Group and Category models
syphax-bouazzouni Apr 15, 2023
749e9fe
Merge pull request #2 from ontoportal-lirmm/feature/ecoportal/groups-…
syphax-bouazzouni May 14, 2023
24dc6bb
Merge branch 'master' into ecoportal-ontoportal-reset
syphax-bouazzouni May 14, 2023
1a0caae
Merge pull request #4 from lifewatch-eric/feature/ecoportal/doi-creation
syphax-bouazzouni May 14, 2023
8fc3c77
Merge pull request #6 from ontoportal-lirmm/feature/add-agent-model
syphax-bouazzouni Jul 9, 2023
90bb0bc
Merge pull request #3 from lifewatch-eric/feature/ecoportal/improve-a…
syphax-bouazzouni Sep 12, 2023
d0e5d81
Merge pull request #1 from lifewatch-eric/ecoportal-ontoportal-reset
syphax-bouazzouni Sep 23, 2023
951e95c
Merge branch 'master' into ecoportal-ontoportal-reset
syphax-bouazzouni May 27, 2024
877f1e3
Merge remote-tracking branch 'ecoportal/master' into ecoportal-ontopo…
syphax-bouazzouni May 27, 2024
24fb254
Merge to master: Release 2.1.0 - Refactor the cache code (#16)
syphax-bouazzouni May 27, 2024
b369660
Merge branch 'master' into ecoportal-ontoportal-reset
syphax-bouazzouni May 27, 2024
3f24957
Merge pull request #7 from lifewatch-eric/ecoportal-ontoportal-reset
syphax-bouazzouni May 27, 2024
574a045
clean no more ecoportal old code
syphax-bouazzouni Jun 2, 2024
2e9540f
Merge branch 'ecoportal-ontoportal-reset' into ecoportal
syphax-bouazzouni Jun 2, 2024
1f3ea01
Merge branch 'development' into feature/ecoportal/align-to-agroportal…
syphax-bouazzouni Oct 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ config/config.rb
.idea/

# Specific to rbenv
.ruby-version
.ruby-version

./vs
2 changes: 1 addition & 1 deletion lib/ontologies_api_client/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ def populate_attributes(hash)

end
end
end
end
1 change: 1 addition & 0 deletions lib/ontologies_api_client/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def self.post(path, obj, options = {})
else
recursive_struct(load_json(response.body))
end

end

def self.put(path, obj)
Expand Down
14 changes: 11 additions & 3 deletions lib/ontologies_api_client/middleware/faraday-user-apikey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ def initialize(app, *arguments)
end

def call(env)
user = Thread.current[:session] && Thread.current[:session][:user] ? Thread.current[:session][:user] : nil
if user
bearer_token = Thread.current[:ontologies_api_client_token]

if bearer_token
headers = env[:request_headers]
headers["Authorization"] = headers["Authorization"] + "&userapikey=" + user.apikey
headers["Authorization"] = "Bearer #{bearer_token}"
env[:request_headers] = headers
else
user = Thread.current[:session] && Thread.current[:session][:user] ? Thread.current[:session][:user] : nil
if user
headers = env[:request_headers]
headers["Authorization"] = headers["Authorization"] + "&userapikey=" + user.apikey
env[:request_headers] = headers
end
end
@app.call(env)
end
Expand Down
13 changes: 13 additions & 0 deletions lib/ontologies_api_client/models/identifier_request.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require_relative "../base"

module LinkedData
module Client
module Models
class IdentifierRequest < LinkedData::Client::Base
include LinkedData::Client::Collection
include LinkedData::Client::ReadWrite
@media_type = "http://data.bioontology.org/metadata/IdentifierRequest"
end
end
end
end
2 changes: 1 addition & 1 deletion lib/ontologies_api_client/models/note.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Note < LinkedData::Client::Base
@media_type = "http://data.bioontology.org/metadata/Note"

def deletable?(user)
false
!user.nil? && user.admin? # Administrators can delete notes
end

def uuid
Expand Down
17 changes: 17 additions & 0 deletions lib/ontologies_api_client/models/review.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ class Review < LinkedData::Client::Base
include LinkedData::Client::ReadWrite

@media_type = "http://data.bioontology.org/metadata/Review"
@include_attrs = "all"

def self.more_recent_review(r1, r2)
time1 = r1.created
time2 = r2.created

time2 <=> time1 # reversed order
end

def self.sort_reviews(reviews)
reviews.sort { |r1, r2| more_recent_review(r1, r2) }
end

def self.sort_reviews!(reviews)
reviews.sort! { |r1, r2| more_recent_review(r1, r2) }
reviews
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ontologies_api_client/read_write.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ def refresh_cache

end
end
end
end
Loading