No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/json_roa
spec
.gitignore
.rspec
.rubocop.yml
Gemfile
LICENSE.txt
README.md
Rakefile
json_roa-client.gemspec

README.md

Ruby JSON-ROA Client

A ruby client for JSON-ROA.

State

[Code Climate][]

[Code Climate]: https://codeclimate.com/github/json-roa/json-roa_ruby-client

Usage

Connecting

require 'json_roa/client'

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

conn is a Faraday connection.

Resources

Retrieving the Resource of the Root Relation

@root_resource= @root_relation.get()

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

Semantic Versioning and Rubygems Versioning

This library is BETA because the JSON-ROA specifciation itself is BETA. This library uses Semantic Versioning and the current version is 1.0.0-beta.2.

The rubygems system claims also to use semantic versioning and even urges gem developers to follow it. Rubygems transforms the version as given above into 1.0.0.pre.beta.1. Any work using this library should specify the following in the Gemfile

gem 'json_roa-client', '= 1.0.0.pre.beta.2' 

or the following in the gemspec

spec.add_runtime_dependency 'json_roa-client', '= 1.0.0.pre.beta.2'

In the latter case, building the gem will result in a warning because of the prerelease. You can safely ignore this warning. It is in the context of semantic versioning misleading. However, it is important to fix the dependency by using the = sign. In this case, violation would warrant a warning.