Skip to content

Commit

Permalink
Update Ruby & gems. Add example config
Browse files Browse the repository at this point in the history
  • Loading branch information
fbacall committed Dec 12, 2024
1 parent 352304d commit cfe8b17
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-3.0.4
ruby-3.2.5
1 change: 0 additions & 1 deletion .travis.yml

This file was deleted.

31 changes: 25 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://dev.tess.elixir-europe.org> 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' => '[email protected]',
'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'
Expand All @@ -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)
10 changes: 5 additions & 5 deletions tess_api_client.gemspec
Original file line number Diff line number Diff line change
@@ -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 = '[email protected]'
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
7 changes: 7 additions & 0 deletions uploader_config.example.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Main]
host = dev.tess.elixir-europe.org
protocol = https
port = 443
user_token = my_secret_api_string
user_email = [email protected]
debug = false

0 comments on commit cfe8b17

Please sign in to comment.