Ruby JSON-ROA Client

A ruby client for JSON_ROA.

Usage

Connecting

require 'json_roa/client'

@root_resource = JSON_ROA::Client.connect @base_url do |conn|
  conn.basic_auth(@username,@password)
end

conn is a Faraday connection.

Resources

Data

@root_resource.data

JSON-ROA Data

@root_resource.json_roa_data

Relations

@root_resource.relation('execution')

Resource of a Relation

In this case the relation is based on an URI Template and we must provide an id parameter.

@execution_resource= @root_resource.relation('execution').get('id' => '55744c40-b764-4fd4-98e2-7a69bc57f496')

Collections

A resource that is conceptual an index can be processed as an Enumerable of its relations. The client will abstract pagination away.

@root_resource.relation('executions').get.collection.each do |execution_relation| 
  puts execution_relation.get.data
end