项目作者: aptible

项目描述 :
Ruby client for gridiron.aptible.com
高级语言: Ruby
项目地址: git://github.com/aptible/gridiron-ruby.git
创建时间: 2014-07-07T19:22:07Z
项目社区:https://github.com/aptible/gridiron-ruby

开源协议:MIT License

下载


Aptible::Gridiron" class="reference-link"> Aptible::Gridiron

Gem Version
Build Status
Dependency Status

Ruby client for gridiron.aptible.com. The Gridiron server is built on top of HAL+JSON, and so this client is just a thin layer on top of the HyperResource gem.

Installation

Add the following lines to your application’s Gemfile.

  1. gem 'aptible-gridiron'

And then run bundle install.

Usage

First, get a token:

  1. token = Aptible::Auth::Token.create(email: 'user0@example.com', password: 'password')

From here, you can interact with the Gridiron server however you wish:

  1. gridiron = Aptible::Gridiron::Agent.new(token: token)
  2. protocol = gridiron.protocols.first
  3. protocol.procedures.count
  4. # => 356
  5. procedure = protocol.procedures.first
  6. # => "Obtain and review IT acquisition policy and procedures..."
  7. procedure.criteria.count
  8. # => 1
  9. criterion = procedure.criteria.first
  10. criterion.name
  11. # => "Policy Manual"

To work with organization-specific evidence (i.e., documents and events), you may pass :organization as a parameter in any initializer. For example:

  1. organization = Aptible::Auth::Organization.all(token: token).first
  2. gridiron = Aptible::Gridiron::Agent.new(token: token, organization: organization)
  3. criterion = gridiron.protocols.first.procedures.first.criteria.first
  4. criterion.documents.count
  5. # => 1
  6. document = criterion.create_document!(
  7. print_version: 'http://knowyourmeme.com/photos/11296-success'
  8. )
  9. document.print_version.href
  10. # => "http://knowyourmeme.com/photos/11296-success"
  11. document.expires_at
  12. # => 2015-07-08 00:10:31 UTC

Configuration

Parameter Description Default
root_url Root URL of the Gridiron server ENV['GRIDIRON_ROOT_URL'] or https://gridiron.aptible.com

To point the client at a different server (e.g., during development), add the following to your application’s initializers (or set the GRIDIRON_ROOT_URL environment variable):

  1. Aptible::Gridiron.configure do |config|
  2. config.root_url = 'http://some.other.url'
  3. end

Contributing

  1. Fork the project.
  2. Commit your changes, with specs.
  3. Ensure that your code passes specs (rake spec) and meets Aptible’s Ruby style guide (rake rubocop).
  4. Create a new pull request on GitHub.

MIT License, see LICENSE for details.

Copyright (c) 2019 Aptible and contributors.