Module: BpmManager

Defined in:
lib/bpm_manager.rb,
lib/bpm_manager/version.rb,
lib/generators/bpm_manager/install_generator.rb

Defined Under Namespace

Classes: InstallGenerator

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.configObject

Returns the configuration hash



21
22
23
# File 'lib/bpm_manager.rb', line 21

def self.config
  @config
end

.configure(opts = {}) ⇒ Object

Configure through hash



16
17
18
# File 'lib/bpm_manager.rb', line 16

def self.configure(opts = {})
  opts.each{ |k,v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym }
end

.deploymentsObject

Gets all server deployments



36
37
38
# File 'lib/bpm_manager.rb', line 36

def self.deployments()
  return JSON.parse(RestClient.get(BpmManager.uri('/deployment'), :accept => :json))
end

.tasks(user_id = "") ⇒ Object

Gets all server deployments



41
42
43
# File 'lib/bpm_manager.rb', line 41

def self.tasks(user_id = "")
  return JSON.parse(RestClient.get(BpmManager.uri('/task/query' + (user_id.empty? ? '' : '?taskOwner='+user_id)), :accept => :json))
end

.tasks_with_opts(opts = {}) ⇒ Object

Gets all server deployments



46
47
48
# File 'lib/bpm_manager.rb', line 46

def self.tasks_with_opts(opts = {})
  return JSON.parse(RestClient.get(BpmManager.uri('/task/query' + (opts.empty? ? '' : '?' + opts.map{|k,v| puts k.to_s + '=' + v.to_s}.join('&'))), :accept => :json))
end

.uri(suffix = '') ⇒ Object

Returns the URI for the server plus a suffix



26
27
28
29
30
31
32
33
# File 'lib/bpm_manager.rb', line 26

def self.uri(suffix = '')
  case @config[:bpm_vendor].downcase
    when 'redhat'
      URI.encode('http' + (@config[:bpm_use_ssl] ? 's' : '') + '://' + @config[:bpm_username] + ':' + @config[:bpm_password] + '@' + @config[:bpm_url] + '/business-central/rest' + (suffix.nil? ? '' : suffix))
    else
      ''
  end
end