Examples

Initialize SDK

Import the module and set up an API client user agent:

require 'arvados'
arv = Arvados.new(apiVersion: 'v1')

The SDK retrieves the list of API methods from the server at run time. Therefore, the set of available methods is determined by the server version rather than the SDK version.

create

Create an object:

new_link = arv.link.create(link: {link_class: 'test', name: 'test'})

delete

Delete an object:

arv.link.delete(uuid: new_link[:uuid])

get

Retrieve an object by ID:

some_user = arv.user.get(uuid: current_user_uuid)

list

Get a list of objects:

repos = arv.repository.list
first_repo = repos[:items][0]
puts "UUID of first repo returned is #{first_repo[:uuid]}"</code>

UUID of first repo returned is zzzzz-s0uqq-b1bnybpx3u5temz

update

Update an object:

updated_link = arv.link.update(uuid: new_link[:uuid],
                               link: {properties: {foo: 'bar'}})

Get current user

Get the User object for the current user:

current_user = arv.user.current

Get the UUID of an object that was retrieved using the SDK:

current_user_uuid = current_user[:uuid]

Previous: Installation

The content of this documentation is licensed under the Creative Commons Attribution-Share Alike 3.0 United States licence.
Code samples in this documentation are licensed under the Apache License, Version 2.0.