class Conjur::API
Public Class Methods
trial_factory_asset_host()
click to toggle source
# File lib/conjur/trial-factory-api.rb, line 37 def trial_factory_asset_host Conjur.configuration.trial_factory_url end
Public Instance Methods
create_trial(account, email, options = {})
click to toggle source
Creates a new trial
# File lib/conjur/api/trial_factories.rb, line 40 def create_trial account, email, options = {} resp = trial_factory_resource.post({ account: account, email: email }.merge(options.slice(:imageid))) build_trial resp end
trial(account, options = {})
click to toggle source
Show a specific trial
# File lib/conjur/api/trial_factories.rb, line 34 def trial account, options = {} resource = trial_factory_resource(account) build_trial resource.get(params: options) end
trials()
click to toggle source
List all trials
# File lib/conjur/api/trial_factories.rb, line 27 def trials JSON.parse(trial_factory_resource.get).map do |resp| build_trial resp end end
Protected Instance Methods
build_trial(resp)
click to toggle source
# File lib/conjur/api/trial_factories.rb, line 50 def build_trial resp resp = JSON.parse(resp) if resp.is_a?(String) Trial.new(trial_factory_path(resp['account']), credentials).tap do |trial| trial.attributes = resp end end
trial_factory_path(*args)
click to toggle source
# File lib/conjur/api/trial_factories.rb, line 61 def trial_factory_path *args args.map{|a| fully_escape(a)}.join('/') end
trial_factory_resource(*path)
click to toggle source
# File lib/conjur/api/trial_factories.rb, line 57 def trial_factory_resource *path RestClient::Resource.new(Conjur::API.trial_factory_asset_host, credentials)[trial_factory_path *path] end