Sha256: 0126b56f41fb96cbc73e8fc44a93413223eeea8ec34665feb93255032b40b055
Contents?: true
Size: 1.94 KB
Versions: 8
Compression:
Stored size: 1.94 KB
Contents
= Foreman API bindings for Ruby == Summary Usage: require 'foreman_api' require 'logger' # optional architectures = ForemanApi::Resources::Architecture.new( { :logger => Logger.new(STDOUT), # optional :base_url => 'http://foreman-url', :username => 'admin', :password => 'changeme' }) puts architectures.index.inspect == Description This gem contains Foreman API bindings for the Ruby language. The bindings are generated from API documentation using {Apidoc}[https://github.com/Pajk/apipie-rails] tool. The bindings brings support for new versioned API which is not complete yet. The number of supported controllers is limited but more are coming soon. === Regenerating bindings The code for generating the bindings is a part of this repo. The generator needs a running Foreman instance to load the apidoc.json. Usage: bin/generate.rb -h Script for generating API bindings for Foreman API from Apipie docs. -u, --url FOREMAN_APIDOC_URL By default http://localhost:3000/apidoc -h, --help Only files under +lib/foreman_api/resources+ are touched by the generator. === Authentication Foreman API uses OAuth for authentication, you need to provide url, key and secret. Also, it is required to provide user which will be used for the request if oauth_map_users setting in the Foreman instance is set, otherwise 401 error will occur and Foreman log will state "users mapping error". When setting base_url make sure it *does not* include trailing slash, otherwise request can be refused with 401. require 'foreman_api' architectures = ForemanApi::Resources::Architecture.new( { :base_url => 'http://foreman-url', :oauth => { :consumer_key => 'katello', :consumer_secret => "shhhh" } },{ :headers => { :foreman_user => "admin", } }) puts architectures.index.inspect == License The bindings are released under MIT license
Version data entries
8 entries across 8 versions & 1 rubygems