Class: IntegrationHelper

Inherits:
Object
  • Object
show all
Includes:
CloudmunchService, Util
Defined in:
IntegrationHelper.rb

Instance Method Summary (collapse)

Methods included from Util

getJSONArgs, log, logClose, logInit, logIt, openJSONFile

Methods included from CloudmunchService

#deleteCloudmunchData, #deleteKeys, #downloadKeys, #generateServerURL, #getCloudmunchData, getCustomDataContext, #getDataForContext, http_get, http_post, #parseResponse, putCustomDataContext, #updateCloudmunchData, #updateDataForContext

Constructor Details

- (IntegrationHelper) initialize

Returns a new instance of IntegrationHelper



22
23
# File 'IntegrationHelper.rb', line 22

def initialize()
end

Instance Method Details

- (Object) getIntegration(jsonParams, integrationHash)



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'IntegrationHelper.rb', line 47

def getIntegration(jsonParams, integrationHash)
    providerName = jsonParams["providername"]
    log("DEBUG", "Provider Name: " + providerName)
    integrationDetailsHash = nil

    if !providerName.nil? && providerName.chop.length > 0 then
        regFields = integrationHash[providerName]["configuration"]

        integrationDetailsHash = {}
        regFields.each do |k,v|
            integrationDetailsHash[k] = v
        end

        return integrationDetailsHash
    else
        return nil
    end
end

- (Object) getService(jsonParams)



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'IntegrationHelper.rb', line 25

def getService(jsonParams)
    cloudproviders = jsonParams["cloudproviders"]
    cloudproviders = JSON.parse(cloudproviders)
    providerName = jsonParams["providername"]
    log("DEBUG", "Provider Name: " + providerName)
    integrationDetailsHash = nil

    if !providerName.nil? && providerName.chop.length > 0 then
        regFields = cloudproviders[providerName]

        integrationDetailsHash = {}
        regFields.each do |k,v|
            integrationDetailsHash[k] = v
        end

        return integrationDetailsHash
    else
        return nil
    end
end