From cfe8b17bf45265c1697029f5f5b305cd1c95bb65 Mon Sep 17 00:00:00 2001 From: Finn Bacall Date: Thu, 12 Dec 2024 10:42:42 +0000 Subject: [PATCH] Update Ruby & gems. Add example config --- .ruby-version | 2 +- .travis.yml | 1 - README.md | 31 +++++++++++++++++++++++++------ tess_api_client.gemspec | 10 +++++----- uploader_config.example.txt | 7 +++++++ 5 files changed, 38 insertions(+), 13 deletions(-) delete mode 100644 .travis.yml create mode 100644 uploader_config.example.txt diff --git a/.ruby-version b/.ruby-version index 79bc2c7..ac55709 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.0.4 +ruby-3.2.5 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f819a51..0000000 --- a/.travis.yml +++ /dev/null @@ -1 +0,0 @@ -language: ruby diff --git a/README.md b/README.md index 4222172..3cddd33 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,31 @@ A gem for uploading data to the [TeSS](http://tess.elixir-uk.org) portal. Use if ## Get Started Add the TeSS API to your Gemfile and use bundle to install -`$ echo "gem 'tess_api_client', :git => git://github.com/ElixirUK/TeSS_api_client.git" >> Gemfile` + echo "gem 'tess_api_client', :git => git://github.com/ElixirUK/TeSS_api_client.git" >> Gemfile -`$ bundle install` + bundle install -Create a new ruby script which uses the gem. Use the ContentProvider model to create a new content provider in TeSS and the Material or Event model to create new resources. -`$ nano my_upload_script.rb` +Create a config file containing the TeSS instance info & your TeSS credentials (uses by default): + + cp uploader_config.example.txt uploader_config.txt + + nano uploader_config.txt + +...OR configure in your code: + +```ruby +Tess::API.config = { + 'host' => 'dev.tess.elixir-europe.org', + 'port' => '443', + 'protocol' => 'https', + 'user_email' => 'test.user@example.com', + 'user_token' => 'MyAPIToken' +} +``` + +Create a new ruby script which uses the gem. Use the ContentProvider model to create a new content provider in TeSS and the Material or Event model to create new resources. + + $ nano my_upload_script.rb ```ruby require 'tess_api_client' @@ -30,8 +49,8 @@ material = Tess::API::Material.new( scientific_topic: ['Computational Biology'], keywords: ['tutorial', 'TeSS', 'sharing']) -material.create +material.create_or_update # Creates the material, or updates the existing entry if it already exists ``` -## Futher Examples +## Further Examples More examples can be found in the `test` directory of this repository, or in the [TeSS Scrapers repository](https://github.com/ElixirTeSS/TeSS_scrapers) diff --git a/tess_api_client.gemspec b/tess_api_client.gemspec index 0daac60..bbe20e5 100644 --- a/tess_api_client.gemspec +++ b/tess_api_client.gemspec @@ -1,19 +1,19 @@ Gem::Specification.new do |s| s.name = 'tess_api_client' - s.version = '0.4.2' - s.date = '2022-07-28' + s.version = '0.4.3' + s.date = '2024-12-12' s.summary = 'Libraries for uploading files to https://github.com/ElixirTeSS/TeSS' - s.description = 'Uses the a Custom RoR API on https://tess.elixir-europe.org to upload data in the format being used by the TeSS project.' + s.description = 'Uses the legacy JSON API on https://tess.elixir-europe.org' s.authors = ['Milo Thurston','Niall Beard','Aleksandra Nenadic','Finn Bacall'] s.email = 'tess-support@googlegroups.com' s.files = `git ls-files`.split("\n") s.homepage = 'https://github.com/ElixirTeSS/TeSS_api_client' s.license = 'BSD' s.add_runtime_dependency 'inifile', '~> 3.0.0' - s.add_runtime_dependency 'rest-client', '~> 2.0.0' + s.add_runtime_dependency 'rest-client', '~> 2.1.0' s.add_development_dependency 'rake' s.add_development_dependency 'webmock' - s.add_development_dependency 'vcr', '~> 3.0.3' + s.add_development_dependency 'vcr', '~> 6.2.0' s.add_development_dependency 'test-unit', '~> 3.5.3' s.add_development_dependency 'simplecov' end diff --git a/uploader_config.example.txt b/uploader_config.example.txt new file mode 100644 index 0000000..f69a964 --- /dev/null +++ b/uploader_config.example.txt @@ -0,0 +1,7 @@ +[Main] +host = dev.tess.elixir-europe.org +protocol = https +port = 443 +user_token = my_secret_api_string +user_email = me@elixir.eu +debug = false