Class: KineticSdk::Core

Inherits:
Object
  • Object
show all
Includes:
Utils::KineticExportUtils, Utils::KineticHttpUtils
Defined in:
lib/kinetic_sdk/core/core-sdk.rb,
lib/kinetic_sdk/core/lib/jwt.rb,
lib/kinetic_sdk/core/lib/form.rb,
lib/kinetic_sdk/core/lib/kapp.rb,
lib/kinetic_sdk/core/lib/meta.rb,
lib/kinetic_sdk/core/lib/oauth.rb,
lib/kinetic_sdk/core/lib/space.rb,
lib/kinetic_sdk/core/lib/teams.rb,
lib/kinetic_sdk/core/lib/users.rb,
lib/kinetic_sdk/core/lib/bridges.rb,
lib/kinetic_sdk/core/lib/webhooks.rb,
lib/kinetic_sdk/core/lib/categories.rb,
lib/kinetic_sdk/core/lib/form_types.rb,
lib/kinetic_sdk/core/lib/system_api.rb,
lib/kinetic_sdk/core/lib/submissions.rb,
lib/kinetic_sdk/core/lib/webhook_jobs.rb,
lib/kinetic_sdk/core/lib/datastore_form.rb,
lib/kinetic_sdk/core/lib/platform_components.rb,
lib/kinetic_sdk/core/lib/attribute_definitions.rb,
lib/kinetic_sdk/core/lib/datastore_submissions.rb,
lib/kinetic_sdk/core/lib/security_policy_definitions.rb

Overview

Core is a Ruby class that acts as a wrapper for the Core REST API without having to make explicit HTTP requests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::KineticExportUtils

#get_variable_property, #prepare_shape, #process_export, #should_extract, #write_object_to_file

Methods included from Utils::KineticHttpUtils

#default_headers, default_headers, #default_jwt_headers, default_jwt_headers, #delete, #encode, #gateway_retry_delay, #gateway_retry_limit, #get, #head, #header_accept_json, header_accept_json, #header_basic_auth, header_basic_auth, header_bearer_auth, #header_bearer_auth, #header_content_json, header_content_json, header_user_agent, #header_user_agent, #max_redirects, #mimetype, #patch, #post, #post_multipart, #put, #redirect_url, #stream_download_to_file

Constructor Details

#initialize(opts = {}) ⇒ Core

Initalize the Core SDK with the web server URL, the space user username and password, along with any custom option values.

Example: using a configuration file

KineticSdk::Core.new({
  config_file: "/opt/config1.yaml"
})

Example: space user properties hash

KineticSdk::Core.new({
  app_server_url: "http://localhost:8080/kinetic",
  space_slug: "foo",
  username: "space-user-1",
  password: "password",
  options: {
      log_level: "debug",
      ssl_verify_mode: "peer",
      ssl_ca_file: "/usr/local/self_signing_ca.pem"
  }
})

Example: system user properties hash

KineticSdk::Core.new({
  app_server_url: "http://localhost:8080/kinetic",
  username: "admin",
  password: "password",
  options: {
      log_level: "debug",
      ssl_verify_mode: "peer",
      ssl_ca_file: "/usr/local/self_signing_ca.pem"
  }
})

Example: space user properties hash with the space url

# Note: This example results in the same API endpoint as using:
#
#   app_server_url: https://myapp.io

KineticSdk::Core.new({
  space_server_url: "https://myapp.io/foo",
  space_slug: "foo",
  username: "space-user-1",
  password: "password",
  options: {
    log_level: "info",
    max_redirects: 3
  }
})

Example: space user properties hash with the space url as a subdomain

# Note: This example requires a proxy server to rewrite the space slug
#       as a request path parameter rather than a subdomain.
#
#   Ex: https://myapp.io/foo

KineticSdk::Core.new({
  space_server_url: "https://foo.myapp.io",
  space_slug: "foo",
  username: "space-user-1",
  password: "password",
  options: {
    log_level: "info",
    max_redirects: 3
  }
})

Parameters:

  • opts (Hash<Symbol, Object>) (defaults to: {})

    Kinetic Core properties

Options Hash (opts):

  • :config_file (String)

    optional - path to the YAML configuration file

    • Ex: /opt/config/core-configuration1.yaml
  • :app_server_url (String)

    the URL to the Kinetic Core web application

    • Must not be used when :space_server_url is also used.
    • If space_slug is provided, it will be appended to the URL as a path parameter
    • Ex: http://192.168.0.1:8080/kinetic
  • :space_server_url (String)

    the URL to the Kinetic Core space

  • :space_slug (String)

    the slug that identifies the Space

    • Optional when :app_server_url is used
    • Required when :space_server_url is used
    • Required to log in to a Space
    • Must be nil to log in to the System
  • :username (String)

    the username for the user

  • :password (String)

    the password for the user

  • :options (Hash<Symbol, Object>) — default: {}

    optional settings

    • :gateway_retry_limit (FixNum) (defaults to: 5) max number of times to retry a bad gateway
    • :gateway_retry_delay (Float) (defaults to: 1.0) number of seconds to delay before retrying a bad gateway
    • :log_level (String) (defaults to: off) level of logging - off | error | warn | info | debug
    • :log_output (String) (defaults to: STDOUT) where to send output - STDOUT | STDERR
    • :max_redirects (Fixnum) (defaults to: 5) maximum number of redirects to follow
    • :ssl_ca_file (String) full path to PEM certificate used to verify the server
    • :ssl_verify_mode (String) (defaults to: none) - none | peer


127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/kinetic_sdk/core/core-sdk.rb', line 127

def initialize(opts={})
  options = {}

  # process the configuration file if it was provided
  unless opts[:config_file].nil?
    options.merge!(YAML::load_file opts[:config_file])
  end

  # process the configuration hash if it was provided
  options.merge!(opts)

  # allow either :app_server_url or :space_server_url, but not both
  if options[:app_server_url] && options[:space_server_url]
    raise StandardError.new "Expecting one of :app_server_url or :space_server_url, but not both."
  end

  # process any individual options
  @options = options.delete(:options) || {}
  # setup logging
  log_level = @options[:log_level] || @options["log_level"]
  log_output = @options[:log_output] || @options["log_output"]
  @logger = KineticSdk::Utils::KLogger.new(log_level, log_output)

  @username = options[:username]
  @password = options[:password]
  @space_slug = options[:space_slug]
  if options[:app_server_url]
    @server = options[:app_server_url].chomp('/')
    @api_url = @server + (@space_slug.nil? ? "/app/api/v1" : "/#{@space_slug}/app/api/v1")
    @proxy_url = @space_slug.nil? ? nil : "#{@server}/#{@space_slug}/app/components"
  else
    raise StandardError.new "The :space_slug option is required when using the :space_server_url option" if @space_slug.nil?
    @server = options[:space_server_url].chomp('/')
    @api_url = "#{@server}/app/api/v1"
    @proxy_url = "#{@server}/app/components"
  end
  @version = 1
end

Instance Attribute Details

#api_urlObject (readonly)

Returns the value of attribute api_url.



16
17
18
# File 'lib/kinetic_sdk/core/core-sdk.rb', line 16

def api_url
  @api_url
end

#loggerObject (readonly)

Returns the value of attribute logger.



16
17
18
# File 'lib/kinetic_sdk/core/core-sdk.rb', line 16

def logger
  @logger
end

#optionsObject (readonly)

Returns the value of attribute options.



16
17
18
# File 'lib/kinetic_sdk/core/core-sdk.rb', line 16

def options
  @options
end

#passwordObject (readonly)

Returns the value of attribute password.



16
17
18
# File 'lib/kinetic_sdk/core/core-sdk.rb', line 16

def password
  @password
end

#proxy_urlObject (readonly)

Returns the value of attribute proxy_url.



16
17
18
# File 'lib/kinetic_sdk/core/core-sdk.rb', line 16

def proxy_url
  @proxy_url
end

#serverObject (readonly)

Returns the value of attribute server.



16
17
18
# File 'lib/kinetic_sdk/core/core-sdk.rb', line 16

def server
  @server
end

#space_slugObject (readonly)

Returns the value of attribute space_slug.



16
17
18
# File 'lib/kinetic_sdk/core/core-sdk.rb', line 16

def space_slug
  @space_slug
end

#usernameObject (readonly)

Returns the value of attribute username.



16
17
18
# File 'lib/kinetic_sdk/core/core-sdk.rb', line 16

def username
  @username
end

#versionObject (readonly)

Returns the value of attribute version.



16
17
18
# File 'lib/kinetic_sdk/core/core-sdk.rb', line 16

def version
  @version
end

Instance Method Details

#add_agent_component(component_properties, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add Agent Component

Parameters:

  • component_properties (Hash)

    the property values for the team

    • +slug+ - Slug of the agent to be added
    • +url+ - URL for the agent being added
    • +secret+ - Secret for the agent being added
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



58
59
60
61
62
# File 'lib/kinetic_sdk/core/lib/platform_components.rb', line 58

def add_agent_component(component_properties, headers = default_headers)
  raise StandardError.new "Agent Component properties is not valid, must be a Hash." unless component_properties.is_a? Hash
  @logger.info("Creating Agent Component \"#{component_properties["slug"]}\".")
  post("#{@api_url}/platformComponents/agents", component_properties, headers)
end

#add_bridge(body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a Bridge

Parameters:

  • body (Hash)

    properties associated to the Bridge

    • +adapterClass+
    • +name+
    • +slug+
    • +properties+
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



13
14
15
16
# File 'lib/kinetic_sdk/core/lib/bridges.rb', line 13

def add_bridge(body, headers=default_headers)
  @logger.info("Adding the \"#{body['name']}\" bridge through proxy to the agent platform component.")
  post("#{@proxy_url}/agent/app/api/v1/bridges", body, headers)
end

#add_bridge_model(body = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a Bridge Model

Parameters:

  • body (Hash) (defaults to: {})

    optional properties associated to the Bridge Model

    • +name+
    • +status+
    • +activeMappingName+
    • +attributes+
    • +mappings+
    • +qualifications+
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



71
72
73
74
# File 'lib/kinetic_sdk/core/lib/bridges.rb', line 71

def add_bridge_model(body={}, headers=default_headers)
  @logger.info("Adding the \"#{body['name']}\" Bridge Model and Mappings.")
  post("#{@api_url}/models", body, headers)
end

#add_categorization_on_form(kapp_slug, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a categorization on a form

Parameters:

  • kapp_slug (String)

    slug of the Kapp the category belongs to

  • body (Hash)

    categorization properties

    • +category+ - A hash of properties for the category
    • +category/slug+ - The slug of the category to apply to the form
    • +form+ - A hash of properties for the form
    • +form/slug+ - The slug of the form to apply the category
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



27
28
29
30
31
# File 'lib/kinetic_sdk/core/lib/categories.rb', line 27

def add_categorization_on_form(kapp_slug, body, headers=default_headers)
  raise StandardError.new "Category properties is not valid, must be a Hash." unless body.is_a? Hash
  @logger.info("Adding Categorization for \"#{kapp_slug}\" kapp")
  post("#{@api_url}/kapps/#{kapp_slug}/categorizations", body, headers)
end

#add_category_attribute_definition(kapp_slug, name, description, allows_multiple, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a new category attribute definition.

Parameters:

  • kapp_slug (String)

    slug of the kapp where the category exists

  • name (String)

    name of the attribute definition

  • description (String)

    description of the attribute definition

  • allows_multiple (Boolean)

    whether the attribute allows multiple values

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



312
313
314
315
316
317
318
319
320
321
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 312

def add_category_attribute_definition(kapp_slug, name, description, allows_multiple, headers=default_headers)
  body = {
    "allowsMultiple" => allows_multiple,
    "description" => description,
    "name" => name
  }
  @logger.info("Adding Category attribute definition \"#{name}\" to the \"#{kapp_slug}\" kapp.")
  # Create the attribute definition
  post("#{@api_url}/kapps/#{kapp_slug}/categoryAttributeDefinitions", body, headers)
end

#add_category_on_kapp(kapp_slug, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a category on a Kapp

Parameters:

  • kapp_slug (String)

    slug of the Kapp the category belongs to

  • body (Hash)

    category properties

    • +name+ - A descriptive name for the category
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



11
12
13
14
15
# File 'lib/kinetic_sdk/core/lib/categories.rb', line 11

def add_category_on_kapp(kapp_slug, body, headers=default_headers)
  raise StandardError.new "Category properties is not valid, must be a Hash." unless body.is_a? Hash
  @logger.info("Adding Category \"#{body['name']}\" for \"#{kapp_slug}\" kapp")
  post("#{@api_url}/kapps/#{kapp_slug}/categories", body, headers)
end

#add_datastore_form(form_properties = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a Datastore Form

Parameters:

  • form_properties (Hash) (defaults to: {})

    form properties

    • +customHeadContent+
    • +description+
    • +name+
    • +notes+
    • +slug+
    • +status+
    • +submissionLabelExpression+
    • +attributes+
    • +attributesMap+
    • +bridgedResources+
    • +pages+
    • +securityPolicies+
    • +indexDefinitions+
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



22
23
24
25
# File 'lib/kinetic_sdk/core/lib/datastore_form.rb', line 22

def add_datastore_form(form_properties={}, headers=default_headers)
  @logger.info("Adding the \"#{form_properties['name']}\" Form.")
  post("#{@api_url}/datastore/forms", form_properties, headers)
end

#add_datastore_form_attribute_definition(name, description, allows_multiple, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a new datastore form attribute definition.

Parameters:

  • name (String)

    name of the attribute definition

  • description (String)

    description of the attribute definition

  • allows_multiple (Boolean)

    whether the attribute allows multiple values

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



11
12
13
14
15
16
17
18
19
20
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 11

def add_datastore_form_attribute_definition(name, description, allows_multiple, headers=default_headers)
  body = {
    "allowsMultiple" => allows_multiple,
    "description" => description,
    "name" => name
  }
  @logger.info("Adding Datastore Form attribute definition \"#{name}\" to the \"#{space_slug}\" space.")
  # Create the attribute definition
  post("#{@api_url}/datastoreFormAttributeDefinitions", body, headers)
end

#add_datastore_submission(form_slug, payload = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a Datastore Submission

Parameters:

  • form_slug (String)

    slug of the Form

  • payload (Hash) (defaults to: {})

    payload of the submission

    • +origin+ - Origin ID of the submission to be added
    • +parent+ - Parent ID of the submission to be added
    • +values+ - hash of field values for the submission
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/kinetic_sdk/core/lib/datastore_submissions.rb', line 13

def add_datastore_submission(form_slug, payload={}, headers=default_headers)
  # initialize "values" if nil
  payload["values"] = {} if payload["values"].nil?
  # set origin hash if origin was passed as a string
  payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
  # set parent hash if parent was passed as a string
  payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
  # Create the submission
  @logger.info("Adding a submission in the \"#{form_slug}\" Datastore Form.")
  post("#{@api_url}/datastore/forms/#{form_slug}/submissions", payload, headers)
end

#add_datastore_submission_page(form_slug, page_name, payload = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a Datastore Submission page

Parameters:

  • form_slug (String)

    slug of the Form

  • page_name (String)

    name of the Page

  • payload (Hash) (defaults to: {})

    payload of the submission

    • +origin+ - Origin ID of the submission to be added
    • +parent+ - Parent ID of the submission to be added
    • +values+ - hash of field values for the submission
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/kinetic_sdk/core/lib/datastore_submissions.rb', line 35

def add_datastore_submission_page(form_slug, page_name, payload={}, headers=default_headers)
  # initialize "values" if nil
  payload["values"] = {} if payload["values"].nil?
  # set origin hash if origin was passed as a string
  payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
  # set parent hash if parent was passed as a string
  payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
  # Create the submission
  @logger.info("Adding a submission page in the \"#{form_slug}\" Datastore Form.")
  post("#{@api_url}/datastore/forms/#{form_slug}/submissions?page=#{encode(page_name)}", payload, headers)
end

#add_form(kapp_slug, form_properties = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a Form

Parameters:

  • kapp_slug (String)

    slug of the Kapp the form belongs to

  • form_properties (Hash) (defaults to: {})

    form properties

    • +anonymous+
    • +customHeadContent+
    • +description+
    • +name+
    • +notes+
    • +slug+
    • +status+
    • +submissionLabelExpression+
    • +type+
    • +attributes+
    • +bridgedResources+
    • +pages+
    • +securityPolicies+
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



23
24
25
26
# File 'lib/kinetic_sdk/core/lib/form.rb', line 23

def add_form(kapp_slug, form_properties={}, headers=default_headers)
  @logger.info("Adding the \"#{form_properties['name']}\" Form.")
  post("#{@api_url}/kapps/#{kapp_slug}/forms", form_properties, headers)
end

#add_form_attribute_definition(kapp_slug, name, description, allows_multiple, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a new form attribute definition.

Parameters:

  • kapp_slug (String)

    slug of the kapp where the form exists

  • name (String)

    name of the attribute definition

  • description (String)

    description of the attribute definition

  • allows_multiple (Boolean)

    whether the attribute allows multiple values

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



377
378
379
380
381
382
383
384
385
386
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 377

def add_form_attribute_definition(kapp_slug, name, description, allows_multiple, headers=default_headers)
  body = {
    "allowsMultiple" => allows_multiple,
    "description" => description,
    "name" => name
  }
  @logger.info("Adding Form attribute definition \"#{name}\" to the \"#{kapp_slug}\" kapp.")
  # Create the attribute definition
  post("#{@api_url}/kapps/#{kapp_slug}/formAttributeDefinitions", body, headers)
end

#add_form_type_on_kapp(kapp_slug, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a form type on a Kapp

Parameters:

  • kapp_slug (String)

    slug of the Kapp the form type belongs to

  • body (Hash)

    form type properties

    • +name+ - A descriptive name for the form type
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



11
12
13
14
15
# File 'lib/kinetic_sdk/core/lib/form_types.rb', line 11

def add_form_type_on_kapp(kapp_slug, body, headers=default_headers)
  raise StandardError.new "Form Type properties is not valid, must be a Hash." unless body.is_a? Hash
  @logger.info("Adding Form Type \"#{body['name']}\" for \"#{kapp_slug}\" kapp")
  post("#{@api_url}/kapps/#{kapp_slug}/formTypes", body, headers)
end

#add_form_webhook(kapp_slug, webhook_properties, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add form webhook

Parameters:

  • kapp_slug (String)

    slug of the Kapp the form webhook belongs to

  • webhook_properties (Hash)

    hash of webhook properties

    • +event+ - Created | Deleted | Updated
    • +name+ - A descriptive name for the webhook
    • +filter+ - A javascript expression to determine when the webhook should fire
    • +url+ - URL to post the bindings when the event is triggered
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



14
15
16
17
18
# File 'lib/kinetic_sdk/core/lib/webhooks.rb', line 14

def add_form_webhook(kapp_slug, webhook_properties, headers=default_headers)
  raise StandardError.new "Webhook properties is not valid, must be a Hash." unless webhook_properties.is_a? Hash
  payload = { "type" => "Form" }.merge(webhook_properties)
  add_webhook_on_kapp(kapp_slug, payload, headers)
end

#add_kapp(kapp_name, kapp_slug, properties = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a Kapp

Parameters:

  • kapp_name (String)

    name of the Kapp

  • kapp_slug (String)

    slug of the Kapp

  • properties (Hash) (defaults to: {})

    optional properties associated to the Kapp

    • +afterLogoutPath+
    • +bundlePath+
    • +defaultFormDisplayPage+
    • +defaultFormConfirmationPage+
    • +defaultSubmissionLabelExpression+
    • +displayType+
    • +displayValue+
    • +loginPage+
    • +resetPasswordPage+
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



20
21
22
23
24
25
26
27
# File 'lib/kinetic_sdk/core/lib/kapp.rb', line 20

def add_kapp(kapp_name, kapp_slug, properties={}, headers=default_headers)
  properties.merge!({
    "name" => kapp_name,
    "slug" => kapp_slug
  })
  @logger.info("Adding the \"#{kapp_name}\" Kapp.")
  post("#{@api_url}/kapps", properties, headers)
end

#add_kapp_attribute_definition(kapp_slug, name, description, allows_multiple, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a new kapp attribute definition.

Parameters:

  • kapp_slug (String)

    slug of the kapp

  • name (String)

    name of the attribute definition

  • description (String)

    description of the attribute definition

  • allows_multiple (Boolean)

    whether the attribute allows multiple values

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



442
443
444
445
446
447
448
449
450
451
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 442

def add_kapp_attribute_definition(kapp_slug, name, description, allows_multiple, headers=default_headers)
  body = {
    "allowsMultiple" => allows_multiple,
    "description" => description,
    "name" => name
  }
  @logger.info("Adding Kapp attribute definition \"#{name}\" to the \"#{kapp_slug}\" kapp.")
  # Create the attribute definition
  post("#{@api_url}/kapps/#{kapp_slug}/kappAttributeDefinitions", body, headers)
end

#add_oauth_client(options, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add an OAuth client

Parameters:

  • options (Hash)

    oauth client properties

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



9
10
11
12
# File 'lib/kinetic_sdk/core/lib/oauth.rb', line 9

def add_oauth_client(options, headers=default_headers)
  @logger.info("Adding the \"#{options['clientId']}\" OAuth client")
  post("#{@api_url}/oauthClients", options, headers)
end

#add_security_policy_definition(kapp_slug, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a Kapp security policy definition

Parameters:

  • kapp_slug (String)

    slug of the kapp

  • body (Hash)

    properties of the security policy definition

    • +name+ - name of the security policy definition
    • +message+ - message for the security policy definition
    • +rule+ - rule for the security policy definition
    • +type+ - type of the security policy definition
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



88
89
90
91
92
# File 'lib/kinetic_sdk/core/lib/security_policy_definitions.rb', line 88

def add_security_policy_definition(kapp_slug, body, headers=default_headers)
  @logger.info("Adding Security Policy Definition \"#{body['name']}\" to the \"#{kapp_slug}\" kapp.")
  # Create the kapp security policy definition
  post("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions", body, headers)
end

#add_space(name, slug, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a new Space

Parameters:

  • name (String)

    name of the Space

  • slug (String)

    value that is used in URL routes to identity the Space

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



10
11
12
13
14
# File 'lib/kinetic_sdk/core/lib/system_api.rb', line 10

def add_space(name, slug, headers=default_headers)
  payload = { "name" => name, "slug" => slug }
  @logger.info("Creating Space \"#{name}\" with slug \"#{slug}\"")
  post("#{@api_url}/spaces", payload, headers)
end

#add_space_attribute(attribute_name, attribute_value, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add an attribute value to the space, or update an attribute if it already exists

Parameters:

  • attribute_name (String)

    name of the attribute

  • attribute_value (String)

    value of the attribute

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/kinetic_sdk/core/lib/space.rb', line 10

def add_space_attribute(attribute_name, attribute_value, headers=default_headers)
  # first find the space
  response = find_space({ "include" => "attributes"}, headers)
  # hack to try a second time if space isn't found
  if response.status == 404
    sleep 2
    response = find_space({ "include" => "attributes"}, headers)
  end
  space = response.content["space"]
  attributes = space["attributes"]
  # either add or update the attribute value
  exists = false
  attributes.each do |attribute|
    @logger.info("Attribute: #{attribute.inspect}")
    # if the attribute already exists, update it
    if attribute["name"] == attribute_name
      attribute["values"] = [ attribute_value ]
      exists = true
    end
  end
  # add the attribute if it didn't exist
  attributes.push({
    "name" => attribute_name,
    "values" => [ attribute_value ]
    }) unless exists

  # set the updated attributes list
  body = { "attributes" => attributes }
  if exists
    @logger.info("Updating attribute \"#{attribute_name}\" = \"#{attribute_value}\" in the \"#{space_slug}\" space.")
  else
    @logger.info("Adding attribute \"#{attribute_name}\" = \"#{attribute_value}\" to the \"#{space_slug}\" space.")
  end
  # Update the space
  put("#{@api_url}/space", body, headers)
end

#add_space_attribute_definition(name, description, allows_multiple, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a new space attribute definition.

Parameters:

  • name (String)

    name of the attribute definition

  • description (String)

    description of the attribute definition

  • allows_multiple (Boolean)

    whether the attribute allows multiple values

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



71
72
73
74
75
76
77
78
79
80
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 71

def add_space_attribute_definition(name, description, allows_multiple, headers=default_headers)
  body = {
    "allowsMultiple" => allows_multiple,
    "description" => description,
    "name" => name
  }
  @logger.info("Adding Space attribute definition \"#{name}\" to the \"#{space_slug}\" space.")
  # Create the attribute definition
  post("#{@api_url}/spaceAttributeDefinitions", body, headers)
end

#add_space_security_policy_definition(body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a Space security policy definition

Parameters:

  • body (Hash)

    properties of the security policy definition

    • +name+ - name of the security policy definition
    • +message+ - message for the security policy definition
    • +rule+ - rule for the security policy definition
    • +type+ - type of the security policy definition
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



13
14
15
16
17
# File 'lib/kinetic_sdk/core/lib/security_policy_definitions.rb', line 13

def add_space_security_policy_definition(body, headers=default_headers)
  @logger.info("Adding Space Security Policy Definition \"#{body['name']}\".")
  # Create the space security policy definition
  post("#{@api_url}/securityPolicyDefinitions", body, headers)
end

#add_space_webhook(webhook_properties, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add space webhook

Parameters:

  • webhook_properties (Hash)

    hash of webhook properties

    • +event+ - Login Failure
    • +name+ - A descriptive name for the webhook
    • +filter+ - A javascript expression to determine when the webhook should fire
    • +url+ - URL to post the bindings when the event is triggered
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



29
30
31
32
33
# File 'lib/kinetic_sdk/core/lib/webhooks.rb', line 29

def add_space_webhook(webhook_properties, headers=default_headers)
  raise StandardError.new "Webhook properties is not valid, must be a Hash." unless webhook_properties.is_a? Hash
  payload = { "type" => "Space" }.merge(webhook_properties)
  add_webhook_on_space(payload, headers)
end

#add_submission(kapp_slug, form_slug, payload = {}, parameters = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a Submission

Parameters:

  • kapp_slug (String)

    slug of the Kapp

  • form_slug (String)

    slug of the Form

  • payload (Hash) (defaults to: {})

    payload of the submission

    • +origin+ - Origin ID of the submission to be added
    • +parent+ - Parent ID of the submission to be added
    • +values+ - hash of field values for the submission
  • parameters (Hash) (defaults to: {})

    hash of query parameters to append to the URL

    • +include+ - comma-separated list of properties to include in the response
    • +completed+ - signals that the submission should be completed, default is false
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/kinetic_sdk/core/lib/submissions.rb', line 17

def add_submission(kapp_slug, form_slug, payload={}, parameters={}, headers=default_headers)
  # initialize "values" if nil
  payload["values"] = {} if payload["values"].nil?
  # set origin hash if origin was passed as a string
  payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
  # set parent hash if parent was passed as a string
  payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
  # build the uri with the encoded parameters
  uri = URI.parse("#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}/submissions")
  uri.query = URI.encode_www_form(parameters) unless parameters.empty?
  # Create the submission
  @logger.info("Adding a submission in the \"#{form_slug}\" Form.")
  post(uri.to_s, payload, headers)
end

#add_submission_page(kapp_slug, form_slug, page_name, payload = {}, parameters = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a Submission page

Parameters:

  • kapp_slug (String)

    slug of the Kapp

  • form_slug (String)

    slug of the Form

  • page_name (String)

    name of the Page

  • payload (Hash) (defaults to: {})

    payload of the submission

    • +origin+ - Origin ID of the submission to be added
    • +parent+ - Parent ID of the submission to be added
    • +values+ - hash of field values for the submission
  • parameters (Hash) (defaults to: {})

    hash of query parameters to append to the URL

    • +include+ - comma-separated list of properties to include in the response
    • +staged+ - Indicates whether field validations and page advancement should occur, default is false
    • +defer+ - Indicates the submission is for a subform embedded in a parent, default is false
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/kinetic_sdk/core/lib/submissions.rb', line 47

def add_submission_page(kapp_slug, form_slug, page_name, payload={}, parameters={}, headers=default_headers)
  # initialize "values" if nil
  payload["values"] = {} if payload["values"].nil?
  # set origin hash if origin was passed as a string
  payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
  # set parent hash if parent was passed as a string
  payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
  # add the page name to the parameters
  parameters["page"] = page_name
  # build the uri with the encoded parameters
  uri = URI.parse("#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}/submissions")
  uri.query = URI.encode_www_form(parameters)
  # Create the submission
  @logger.info("Adding a submission page in the \"#{form_slug}\" Form.")
  post(uri.to_s, payload, headers)
end

#add_submission_webhook(kapp_slug, webhook_properties, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add submission webhook

Parameters:

  • kapp_slug (String)

    slug of the Kapp the submission webhook belongs to

  • webhook_properties (Hash)

    hash of webhook properties

    • +event+ - Closed | Created | Deleted | Saved | Submitted | Updated
    • +name+ - A descriptive name for the webhook
    • +filter+ - A javascript expression to determine when the webhook should fire
    • +url+ - URL to post the bindings when the event is triggered
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



45
46
47
48
49
# File 'lib/kinetic_sdk/core/lib/webhooks.rb', line 45

def add_submission_webhook(kapp_slug, webhook_properties, headers=default_headers)
  raise StandardError.new "Webhook properties is not valid, must be a Hash." unless webhook_properties.is_a? Hash
  payload = { "type" => "Submission" }.merge(webhook_properties)
  add_webhook_on_kapp(kapp_slug, payload, headers)
end

#add_team(team_properties, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a Team

Parameters:

  • team_properties (Hash)

    the property values for the team

    • +name+ - Name of the team to be added
    • +description+ - Description of the Team to be added
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



52
53
54
55
56
# File 'lib/kinetic_sdk/core/lib/teams.rb', line 52

def add_team(team_properties, headers=default_headers)
  raise StandardError.new "Team properties is not valid, must be a Hash." unless team_properties.is_a? Hash
  @logger.info("Adding Team \"#{team_properties['name']}\"")
  post("#{@api_url}/teams", team_properties, headers)
end

#add_team_attribute(team_name, attribute_name, attribute_value, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add an attribute to a team

Parameters:

  • team_name (String)

    the team name

  • attribute_name (String)

    the attribute name

  • attribute_value (String)

    the attribute value

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/kinetic_sdk/core/lib/teams.rb', line 13

def add_team_attribute(team_name, attribute_name, attribute_value, headers=default_headers)
  # first find the team
  response = find_team(team_name, { "include" => "attributes"}, headers)
  team = response.content["team"]
  attributes = team["attributes"]
  # either add or update the attribute value
  exists = false
  attributes.each do |attribute|
    @logger.info("Attribute: #{attribute.inspect}")
    # if the attribute already exists, update it
    if attribute["name"] == attribute_name
      attribute["values"] = [ attribute_value ]
      exists = true
    end
  end
  # add the attribute if it didn't exist
  attributes.push({
    "name" => attribute_name,
    "values" => [ attribute_value ]
    }) unless exists

  # set the updated attributes list
  body = { "attributes" => attributes }
  if exists
    @logger.info("Updating attribute \"#{attribute_name}\" = \"#{attribute_value}\" in the \"#{team_name}\" team.")
  else
    @logger.info("Adding attribute \"#{attribute_name}\" = \"#{attribute_value}\" to the \"#{team_name}\" team.")
  end
  # Update the space
  put("#{@api_url}/teams/#{team['slug']}", body, headers)
end

#add_team_attribute_definition(name, description, allows_multiple, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a new team attribute definition.

Parameters:

  • name (String)

    name of the attribute definition

  • description (String)

    description of the attribute definition

  • allows_multiple (Boolean)

    whether the attribute allows multiple values

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



131
132
133
134
135
136
137
138
139
140
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 131

def add_team_attribute_definition(name, description, allows_multiple, headers=default_headers)
  body = {
    "allowsMultiple" => allows_multiple,
    "description" => description,
    "name" => name
  }
  @logger.info("Adding Team attribute definition \"#{name}\" to the \"#{space_slug}\" space.")
  # Create the team attribute definition
  post("#{@api_url}/teamAttributeDefinitions", body, headers)
end

#add_team_membership(team_name, username, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a team membership

Parameters:

  • team_name (String)

    the team name

  • username (String)

    the username to add to the team

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/kinetic_sdk/core/lib/teams.rb', line 64

def add_team_membership(team_name, username, headers=default_headers)
  body = {
    "team" => {
      "name" => team_name
    },
    "user" => {
      "username" => username
    }
  }
  @logger.info("Adding user: \"#{username}\" to \"#{team_name}\" team")
  post("#{@api_url}/memberships/", body, headers)
end

#add_user(user, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a user in a space.

If the SDK was initialized as a System user, the space_slug property must be provided in the user hash.

If the SDK was initialized as a Space user, the space_slug property is ignored.

Example

add_user({
  "space_slug" => "bar",
  "username" => "foo",
  "password" => "bar",
  "displayName" => "Foo",
  "email" => "[email protected]",
  "enabled" => true,
  "preferredLocale" => "en_US",
  "spaceAdmin" => false
})

Parameters:

  • user (Hash)

    hash of user properties

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/kinetic_sdk/core/lib/users.rb', line 29

def add_user(user, headers=default_headers)
  if !@space_slug.nil?
    @logger.info("Adding user \"#{user['username']}\" for Space \"#{@space_slug}\" as system user.")
    post("#{@api_url}/users", user, headers)
  elsif !user['space_slug'].nil?
    space_slug = user.delete('space_slug')
    @logger.info("Adding user \"#{user['username']}\" for Space \"#{space_slug}\".")
    post("#{@api_url}/spaces/#{space_slug}/users", user, headers)
  else
    raise StandardError.new "The space slug must be supplied to add the user."
  end
end

#add_user_attribute(username, attribute_name, attribute_value, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add an attribute value to the user, or update an attribute if it already exists

Parameters:

  • username (String)

    username of the user

  • attribute_name (String)

    name of the attribute

  • attribute_value (String)

    value of the attribute

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/kinetic_sdk/core/lib/users.rb', line 89

def add_user_attribute(username, attribute_name, attribute_value, headers=default_headers)
  # first find the user
  response = find_user(username, { "include" => "attributes"}, headers)
  user = response.content["user"]
  attributes = user["attributes"]
  # either add or update the attribute value
  exists = false
  attributes.each do |attribute|
    # if the attribute already exists, update it
    if attribute["name"] == attribute_name
      attribute["values"] = attribute_value.is_a?(Array) ? attribute_value : [ attribute_value ]
      exists = true
    end
  end
  # add the attribute if it didn't exist
  attributes.push({
    "name" => attribute_name,
    "values" => attribute_value.is_a?(Array) ? attribute_value : [ attribute_value ]
    }) unless exists

  # set the updated attributes list
  body = { "attributes" => attributes }
  if exists
    @logger.info("Updating attribute \"#{attribute_name}\" on user \"#{username}\".")
  else
    @logger.info("Adding attribute \"#{attribute_name}\" to user \"#{username}\".")
  end
  # Update the user
  put("#{@api_url}/users/#{encode(username)}", body, headers)
end

#add_user_attribute_definition(name, description, allows_multiple, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a new user attribute definition.

Parameters:

  • name (String)

    name of the attribute definition

  • description (String)

    description of the attribute definition

  • allows_multiple (Boolean)

    whether the attribute allows multiple values

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



191
192
193
194
195
196
197
198
199
200
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 191

def add_user_attribute_definition(name, description, allows_multiple, headers=default_headers)
  body = {
    "allowsMultiple" => allows_multiple,
    "description" => description,
    "name" => name
  }
  @logger.info("Adding User attribute definition \"#{name}\" to the \"#{space_slug}\" space.")
  # Create the user attribute definition
  post("#{@api_url}/userAttributeDefinitions", body, headers)
end

#add_user_attribute_value(username, attribute_name, attribute_value, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Adds an attribute value to an attribute.

Parameters:

  • username (String)

    username of the user

  • attribute_name (String)

    name of the attribute

  • attribute_value (String)

    value of the attribute

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/kinetic_sdk/core/lib/users.rb', line 127

def add_user_attribute_value(username, attribute_name, attribute_value, headers=default_headers)
  # first find the user
  response = find_user(username, { "include" => "attributes"}, headers)
  user = response.content["user"]
  attributes = user["attributes"]
  # either add or update the attribute value
  exists = false
  attributes.each do |attribute|
    # if the attribute already exists, update it
    if attribute["name"] == attribute_name
      if attribute_value.is_a?(Array)
        attribute["values"].concat(attribute_value)
      else 
        attribute["values"] << attribute_value
      end
      attribute["values"].uniq!
      exists = true
    end
  end
  # add the attribute if it didn't exist
  attributes.push({
    "name" => attribute_name,
    "values" => attribute_value.is_a?(Array) ? attribute_value : [ attribute_value ]
    }) unless exists

  # set the updated attributes list
  body = { "attributes" => attributes }
  if exists
    @logger.info("Updating attribute \"#{attribute_name}\" on user \"#{username}\".")
  else
    @logger.info("Adding attribute \"#{attribute_name}\" to user \"#{username}\".")
  end
  # Update the user
  put("#{@api_url}/users/#{encode(username)}", body, headers)
end

#add_user_profile_attribute_definition(name, description, allows_multiple, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a new user profile attribute definition.

Parameters:

  • name (String)

    name of the attribute definition

  • description (String)

    description of the attribute definition

  • allows_multiple (Boolean)

    whether the attribute allows multiple values

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



251
252
253
254
255
256
257
258
259
260
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 251

def (name, description, allows_multiple, headers=default_headers)
  body = {
    "allowsMultiple" => allows_multiple,
    "description" => description,
    "name" => name
  }
  @logger.info("Adding User attribute definition \"#{name}\" to the \"#{space_slug}\" space.")
  # Create the user attribute definition
  post("#{@api_url}/userProfileAttributeDefinitions", body, headers)
end

#add_user_webhook(webhook_properties, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add user webhook

Parameters:

  • webhook_properties (Hash)

    hash of webhook properties

    • +event+ - Login | Logout
    • +name+ - A descriptive name for the webhook
    • +filter+ - A javascript expression to determine when the webhook should fire
    • +url+ - URL to post the bindings when the event is triggered
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



60
61
62
63
64
# File 'lib/kinetic_sdk/core/lib/webhooks.rb', line 60

def add_user_webhook(webhook_properties, headers=default_headers)
  raise StandardError.new "Webhook properties is not valid, must be a Hash." unless webhook_properties.is_a? Hash
  payload = { "type" => "User" }.merge(webhook_properties)
  add_webhook_on_space(payload, headers)
end

#add_webhook_on_kapp(kapp_slug, webhook_properties, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a webhook on a Kapp (either a Form or Submission webhook)

Ideally the shortcut methods (add_form_webhook, add_submission_webhook) would be used instead of this one.

Parameters:

  • kapp_slug (String)

    slug of the Kapp the webhook belongs to

  • webhook_properties (Hash)

    hash of webhook properties

    • +event+ - depends on +type+
    • +name+ - A descriptive name for the webhook
    • +filter+ - A javascript expression to determine when the webhook should fire
    • +url+ - URL to post the bindings when the event is triggered
    • +type+ - The type of model the webhook is bound to: Form | Submission
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



80
81
82
83
84
# File 'lib/kinetic_sdk/core/lib/webhooks.rb', line 80

def add_webhook_on_kapp(kapp_slug, webhook_properties, headers=default_headers)
  raise StandardError.new "Webhook properties is not valid, must be a Hash." unless webhook_properties.is_a? Hash
  @logger.info("Adding a \"#{webhook_properties['event']}\" \"#{webhook_properties['type']}\" webhook for #{kapp_slug}")
  post("#{@api_url}/kapps/#{kapp_slug}/webhooks", webhook_properties, headers)
end

#add_webhook_on_space(webhook_properties, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Add a webhook on a Space (either a Space or User webhook)

Ideally the shortcut methods (add_space_webhook, add_user_webhook) would be used instead of this one.

Parameters:

  • webhook_properties (Hash)

    hash of webhook properties

    • +event+ - depends on +type+
    • +name+ - A descriptive name for the webhook
    • +filter+ - A javascript expression to determine when the webhook should fire
    • +url+ - URL to post the bindings when the event is triggered
    • +type+ - The type of model the webhook is bound to: Space | User
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



99
100
101
102
103
# File 'lib/kinetic_sdk/core/lib/webhooks.rb', line 99

def add_webhook_on_space(webhook_properties, headers=default_headers)
  raise StandardError.new "Webhook properties is not valid, must be a Hash." unless webhook_properties.is_a? Hash
  @logger.info("Adding a \"#{webhook_properties['event']}\" \"#{webhook_properties['type']}\" webhook")
  post("#{@api_url}/webhooks", webhook_properties, headers)
end

#app_version(headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Retrieve Core application version

Parameters:

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



8
9
10
11
# File 'lib/kinetic_sdk/core/lib/meta.rb', line 8

def app_version(headers=default_headers)
  @logger.info("Retrieving Core application version.")
  get("#{@api_url}/version", {}, headers)
end

#build_datastore_form_indexes(form_slug, indexes, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Build Datastore Indexes

Parameters:

  • form_slug (String)

    slug of the form

  • indexes (Array)

    array of index names to build indexes

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



98
99
100
101
102
103
104
105
106
107
# File 'lib/kinetic_sdk/core/lib/datastore_form.rb', line 98

def build_datastore_form_indexes(form_slug, indexes, headers=default_headers)
  payload = {
    "type" => "Datastore Indexing",
    "content" => {
      "indexes" => indexes
    }
  }
  @logger.info("Building indexes for the \"#{form_slug}\" Datastore Form.")
  post("#{@api_url}/datastore/forms/#{form_slug}/backgroundJobs", payload, headers)
end

#delete_agent_component(agent_slug, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete Agent Component

Parameters:

  • agent_slug (String)

    the slug of the agent to retrieve

  • params (Hash)

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



85
86
87
88
# File 'lib/kinetic_sdk/core/lib/platform_components.rb', line 85

def delete_agent_component(agent_slug, headers = default_headers)
  @logger.info("Deleting Agent Component with slug: \"#{agent_slug}\".")
  delete("#{@api_url}/platformComponents/agents/#{agent_slug}", headers)
end

#delete_bridge(slug, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a Bridge

Parameters:

  • slug (String)

    slug of the Bridge

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



23
24
25
26
# File 'lib/kinetic_sdk/core/lib/bridges.rb', line 23

def delete_bridge(slug, headers=default_headers)
  @logger.info("Deleting the \"#{slug}\" bridge through proxy to the agent platform component.")
  delete("#{@proxy_url}/agent/app/api/v1/bridges/#{slug}", headers)
end

#delete_bridge_model(name, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a Bridge Model

Parameters:

  • name (String)

    name of the Bridge Model

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



81
82
83
84
# File 'lib/kinetic_sdk/core/lib/bridges.rb', line 81

def delete_bridge_model(name, headers=default_headers)
  @logger.info("Deleting the \"#{name}\" Bridge Model.")
  delete("#{@api_url}/models/#{encode(name)}", headers)
end

#delete_category_attribute_definition(kapp_slug, name, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a category attribute definition

Parameters:

  • kapp_slug (String)

    slug of the kapp where the category exists

  • name (String)

    name of the attribute definition

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



329
330
331
332
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 329

def delete_category_attribute_definition(kapp_slug, name, headers=default_headers)
  @logger.info("Deleting the \"#{name}\" Category attribute definition from the \"#{kapp_slug}\" kapp.")
  delete("#{@api_url}/kapps/#{kapp_slug}/categoryAttributeDefinitions/#{encode(name)}", headers)
end

#delete_datastore_form(form_slug, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a Datastore Form

Parameters:

  • form_slug (String)

    slug of the form

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



32
33
34
35
# File 'lib/kinetic_sdk/core/lib/datastore_form.rb', line 32

def delete_datastore_form(form_slug, headers=default_headers)
  @logger.info("Deleting the \"#{form_slug}\" Datastore Form")
  delete("#{@api_url}/datastore/forms/#{form_slug}", headers)
end

#delete_datastore_form_attribute_definition(name, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a datastore form attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



27
28
29
30
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 27

def delete_datastore_form_attribute_definition(name, headers=default_headers)
  @logger.info("Deleting the \"#{name}\" Datastore Form Attribute Definition")
  delete("#{@api_url}/datastoreFormAttributeDefinitions/#{encode(name)}", headers)
end

#delete_datastore_submission(submission_id, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a Datastore submission

Parameters:

  • submission_id (String)

    String value of the Submission Id (UUID)

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



162
163
164
165
# File 'lib/kinetic_sdk/core/lib/datastore_submissions.rb', line 162

def delete_datastore_submission(submission_id, headers=default_headers)
  @logger.info("Deleting Datastore Submission \"#{submission_id}\"")
  delete("#{@api_url}/datastore/submissions/#{encode(submission_id)}", headers)
end

#delete_form(kapp_slug, form_slug, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a Form

Parameters:

  • kapp_slug (String)

    slug of the Kapp the form belongs to

  • form_slug (String)

    slug of the form

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



34
35
36
37
# File 'lib/kinetic_sdk/core/lib/form.rb', line 34

def delete_form(kapp_slug, form_slug, headers=default_headers)
  @logger.info("Deleting the \"#{form_slug}\" Form in the \"#{kapp_slug}\" Kapp.")
  delete("#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}", headers)
end

#delete_form_attribute_definition(kapp_slug, name, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a form attribute definition

Parameters:

  • kapp_slug (String)

    slug of the kapp where the form exists

  • name (String)

    name of the attribute definition

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



394
395
396
397
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 394

def delete_form_attribute_definition(kapp_slug, name, headers=default_headers)
  @logger.info("Deleting the \"#{name}\" Form attribute definition from the \"#{kapp_slug}\" kapp.")
  delete("#{@api_url}/kapps/#{kapp_slug}/formAttributeDefinitions/#{encode(name)}", headers)
end

#delete_form_type(kapp_slug, name, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a form type on a Kapp

Parameters:

  • kapp_slug (String)

    slug of the Kapp the form type belongs to

  • name (String)

    name of the form type

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



23
24
25
26
# File 'lib/kinetic_sdk/core/lib/form_types.rb', line 23

def delete_form_type(kapp_slug, name, headers=default_headers)
  @logger.info("Deleting form type \"#{name}\" from \"#{kapp_slug}\" kapp")
  delete("#{@api_url}/kapps/#{kapp_slug}/formTypes/#{encode(name)}", headers)
end

#delete_form_types_on_kapp(kapp_slug, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete all form types on a Kapp

Parameters:

  • kapp_slug (String)

    slug of the Kapp the form types belongs to

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



33
34
35
36
37
# File 'lib/kinetic_sdk/core/lib/form_types.rb', line 33

def delete_form_types_on_kapp(kapp_slug, headers=default_headers)
  (find_form_types_on_kapp(kapp_slug, {}, headers).content["formTypes"] || []).each do |form_type|
    delete_form_type(kapp_slug, form_type['name'], headers)
  end
end

#delete_kapp(kapp_slug, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a Kapp

Parameters:

  • kapp_slug (String)

    slug of the Kapp

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



34
35
36
37
# File 'lib/kinetic_sdk/core/lib/kapp.rb', line 34

def delete_kapp(kapp_slug, headers=default_headers)
  @logger.info("Deleting the \"#{kapp_slug}\" Kapp.")
  delete("#{@api_url}/kapps/#{kapp_slug}", headers)
end

#delete_kapp_attribute_definition(kapp_slug, name, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a kapp attribute definition

Parameters:

  • kapp_slug (String)

    slug of the kapp

  • name (String)

    name of the attribute definition

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



459
460
461
462
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 459

def delete_kapp_attribute_definition(kapp_slug, name, headers=default_headers)
  @logger.info("Deleting the \"#{name}\" Kapp attribute definition from the \"#{kapp_slug}\" kapp.")
  delete("#{@api_url}/kapps/#{kapp_slug}/kappAttributeDefinitions/#{encode(name)}", headers)
end

#delete_security_policy_definition(kapp_slug, name, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a Kapp security policy definition

Parameters:

  • kapp_slug (String)

    slug of the kapp

  • name (String)

    name of the security policy definition

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



100
101
102
103
104
# File 'lib/kinetic_sdk/core/lib/security_policy_definitions.rb', line 100

def delete_security_policy_definition(kapp_slug, name, headers=default_headers)
  @logger.info("Deleting Security Policy Definition \"#{name}\" from the \"#{kapp_slug}\" kapp.")
  # Delete the kapp security policy definition
  delete("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions/#{encode(name)}", headers)
end

#delete_security_policy_definitions(kapp_slug, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete all Kapp security policy definitions

Parameters:

  • kapp_slug (String)

    slug of the kapp

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



111
112
113
114
115
# File 'lib/kinetic_sdk/core/lib/security_policy_definitions.rb', line 111

def delete_security_policy_definitions(kapp_slug, headers=default_headers)
  (find_security_policy_definitions(kapp_slug, {}, headers).content["securityPolicyDefinitions"] || []).each do |s|
    delete_security_policy_definition(kapp_slug, s['name'], headers)
  end
end

#delete_space(slug, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a Space

Parameters:

  • slug (String)

    slug of the space

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



22
23
24
25
# File 'lib/kinetic_sdk/core/lib/system_api.rb', line 22

def delete_space(slug, headers=default_headers)
  @logger.info("Deleting Space \"#{slug}\"")
  delete("#{@api_url}/spaces/#{slug}", headers)
end

#delete_space_attribute_definition(name, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a space attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



87
88
89
90
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 87

def delete_space_attribute_definition(name, headers=default_headers)
  @logger.info("Deleting the \"#{name}\" Space Attribute Definition")
  delete("#{@api_url}/spaceAttributeDefinitions/#{encode(name)}", headers)
end

#delete_space_security_policy_definition(name, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a Space security policy definition

Parameters:

  • name (String)

    name of the security policy definition

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



24
25
26
27
28
# File 'lib/kinetic_sdk/core/lib/security_policy_definitions.rb', line 24

def delete_space_security_policy_definition(name, headers=default_headers)
  @logger.info("Deleting Space Security Policy Definition \"#{name}\".")
  # Delete the space security policy definition
  delete("#{@api_url}/securityPolicyDefinitions/#{encode(name)}", headers)
end

#delete_space_security_policy_definitions(headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete all Space security policy definitions

Parameters:

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



34
35
36
37
38
# File 'lib/kinetic_sdk/core/lib/security_policy_definitions.rb', line 34

def delete_space_security_policy_definitions(headers=default_headers)
  (find_space_security_policy_definitions({}, headers).content["securityPolicyDefinitions"] || []).each do |s|
    delete_space_security_policy_definition(s['name'], headers)
  end
end

#delete_team_attribute_definition(name, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a team attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



147
148
149
150
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 147

def delete_team_attribute_definition(name, headers=default_headers)
  @logger.info("Deleting the \"#{name}\" Team Attribute Definition")
  delete("#{@api_url}/teamAttributeDefinitions/#{encode(name)}", headers)
end

#delete_user(user, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a user in a space.

If the SDK was initialized as a System user, the space_slug property must be provided in the user hash.

If the SDK was initialized as a Space user, the space_slug property is ignored.

Example

delete_user({
  "username" => "user1"
})

Example

delete_user({
  "space_slug" => "foo",
  "username" => "user1"
})

Parameters:

  • user (Hash)

    properties of the user

    • +space_slug+ - only used when initialized as a System user
    • +username+ - username of the user
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/kinetic_sdk/core/lib/users.rb', line 69

def delete_user(user, headers=default_headers)
  if !@space_slug.nil?
    @logger.info("Deleting user \"#{user['username']}\" for Space \"#{@space_slug}\" as system user.")
    delete("#{@api_url}/users/#{encode(user['username'])}", headers)
  elsif !user['space_slug'].nil?
    space_slug = user.delete('space_slug')
    @logger.info("Deleting user \"#{user['username']}\" for Space \"#{space_slug}\".")
    delete("#{@api_url}/spaces/#{space_slug}/users/#{encode(user['username'])}", headers)
  else
    raise StandardError.new "The space slug must be supplied to add the user."
  end
end

#delete_user_attribute_definition(name, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a user attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



207
208
209
210
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 207

def delete_user_attribute_definition(name, headers=default_headers)
  @logger.info("Deleting the \"#{name}\" User Attribute Definition")
  delete("#{@api_url}/userAttributeDefinitions/#{encode(name)}", headers)
end

#delete_user_profile_attribute_definition(name, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Delete a user profile attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



267
268
269
270
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 267

def (name, headers=default_headers)
  @logger.info("Deleting the \"#{name}\" User Profile Attribute Definition")
  delete("#{@api_url}/userProfileAttributeDefinitions/#{encode(name)}", headers)
end

#export_datastore_form(form_slug, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Export a Datastore Form

Parameters:

  • form_slug (String)

    slug of the form

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



42
43
44
45
# File 'lib/kinetic_sdk/core/lib/datastore_form.rb', line 42

def export_datastore_form(form_slug, headers=default_headers)
  @logger.info("Exporting the \"#{form_slug}\" Datastore Form.")
  get("#{@api_url}/datastore/forms/#{form_slug}", { 'export' => true }, headers)
end

#export_form(kapp_slug, form_slug, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Export a Form

Parameters:

  • kapp_slug (String)

    slug of the Kapp the form belongs to

  • form_slug (String)

    slug of the form

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



45
46
47
48
# File 'lib/kinetic_sdk/core/lib/form.rb', line 45

def export_form(kapp_slug, form_slug, headers=default_headers)
  @logger.info("Exporting the \"#{form_slug}\" Form in the \"#{kapp_slug}\" Kapp.")
  get("#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}", { 'export' => true }, headers)
end

#export_kapp(kapp_slug, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Exports a Kapp

Parameters:

  • kapp_slug (String)

    slug of the Kapp

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



44
45
46
47
# File 'lib/kinetic_sdk/core/lib/kapp.rb', line 44

def export_kapp(kapp_slug, headers=default_headers)
  @logger.info("Exporting the \"#{kapp_slug}\" Kapp.")
  get("#{@api_url}/kapps/#{kapp_slug}", { 'export' => true }, headers)
end

#export_space(headers = default_headers) ⇒ Object

Export a space to the export_directory

Parameters:

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:

  • nil



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/kinetic_sdk/core/lib/space.rb', line 61

def export_space(headers=default_headers)
  raise StandardError.new "An export directory must be defined to export space." if @options[:export_directory].nil?
  @logger.info("Exporting space definition to #{@options[:export_directory]}.")
  # Build up the tree of how files should be written
  export_shape = prepare_shape(
    "space.bridges.{name}",
    "space.datastore.forms.{slug}",
    "space.kapps.{slug}.categories",
    "space.kapps.{slug}.categoryAttributeDefinitions",
    "space.kapps.{slug}.forms.{slug}",
    "space.kapps.{slug}.formAttributeDefinitions",
    "space.kapps.{slug}.formsTypes",
    "space.kapps.{slug}.kappAttributeDefinitions",
    "space.kapps.{slug}.securityPolicyDefinitions",
    "space.kapps.{slug}.webhooks.{name}",
    "space.models.{name}",
    "space.teams.{name}",
    "space.datastoreFormAttributeDefinitions",
    "space.securityPolicyDefinitions",
    "space.spaceAttributeDefinitions",
    "space.teamAttributeDefinitions",
    "space.userAttributeDefinitions",
    "space.userProfileAttributeDefinitions",
    "space.webhooks.{name}",
  )
  core_data = get("#{@api_url}/space", { 'export' => true}, headers).content
  process_export(@options[:export_directory], export_shape, core_data)
  @logger.info("Finished exporting space definition to #{@options[:export_directory]}.")
end

#export_team(team_name, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Export a team

Parameters:

  • team_name (String)

    the team name

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



92
93
94
95
96
# File 'lib/kinetic_sdk/core/lib/teams.rb', line 92

def export_team(team_name, headers=default_headers)
  team_slug = Digest::MD5.hexdigest(team_name)
  @logger.info("Exporting the \"#{team_name}\" (#{team_slug}) Team.")
  get("#{@api_url}/teams/#{team_slug}", { 'export' => true}, headers)
end

#find_agent_component(agent_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find Agent Component

Parameters:

  • agent_slug (String)

    the slug of the agent to retrieve

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



35
36
37
38
# File 'lib/kinetic_sdk/core/lib/platform_components.rb', line 35

def find_agent_component(agent_slug, params = {}, headers = default_headers)
  @logger.info("Finding Agent Component with slug: \"#{agent_slug}\".")
  get("#{@api_url}/platformComponents/agents/#{agent_slug}", params, headers)
end

#find_agent_components(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find Agent Components

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



45
46
47
48
# File 'lib/kinetic_sdk/core/lib/platform_components.rb', line 45

def find_agent_components(params = {}, headers = default_headers)
  @logger.info("Finding Agent Components.")
  get("#{@api_url}/platformComponents/agents", params, headers)
end

#find_all_form_datastore_submissions(form_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all Submissions for a Datastore Form.

This method will process pages of form submissions and internally concatenate the results into a single array.

Warning - using this method can cause out of memory errors on large result sets.

Parameters:

  • form_slug (String)

    slug of the Form

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/kinetic_sdk/core/lib/datastore_submissions.rb', line 82

def find_all_form_datastore_submissions(form_slug, params={}, headers=default_headers)
  @logger.info("Finding submissions for the \"#{form_slug}\" Datastore Form.")
  # Make the initial request of pages submissions
  response = find_form_datastore_submissions(form_slug, params, headers)
  # Build the Messages Array
  messages = response.content["messages"]
  # Build Submissions Array
  submissions = response.content["submissions"]
  # if a next page token exists, keep retrieving submissions and add them to the results
  while (!response.content["nextPageToken"].nil?)
    params['pageToken'] = response.content["nextPageToken"]
    response = find_form_datastore_submissions(form_slug, params, headers)
    # concat the messages
    messages.concat(response.content["messages"] || [])
    # concat the submissions
    submissions.concat(response.content["submissions"] || [])
  end
  final_content = { "messages" => messages, "submissions" => submissions, "nextPageToken" => nil }
  # Return the results
  response.content=final_content
  response.content_string=final_content.to_json
  response
end

#find_all_form_submissions(kapp_slug, form_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all Submissions for a form.

This method will process pages of form submissions and internally concatenate the results into a single array.

Warning - using this method can cause out of memory errors on large result sets.

Parameters:

  • kapp_slug (String)

    slug of the Kapp

  • form_slug (String)

    slug of the Form

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/kinetic_sdk/core/lib/submissions.rb', line 124

def find_all_form_submissions(kapp_slug, form_slug, params={}, headers=default_headers)
  @logger.info("Finding submissions for the \"#{form_slug}\" Form.")
  # Make the initial request of pages submissions
  response = find_form_submissions(kapp_slug, form_slug, params, headers)
  # Build the Messages Array
  messages = response.content["messages"]
  # Build Submissions Array
  submissions = response.content["submissions"]
  # if a next page token exists, keep retrieving submissions and add them to the results
  while (!response.content["nextPageToken"].nil?)
    params['pageToken'] = response.content["nextPageToken"]
    response = find_form_submissions(kapp_slug, form_slug, params, headers)
    # concat the messages
    messages.concat(response.content["messages"] || [])
    # concat the submissions
    submissions.concat(response.content["submissions"] || [])
  end
  final_content = { "messages" => messages, "submissions" => submissions, "nextPageToken" => nil }
  # Return the results
  response.content=final_content
  response.content_string=final_content.to_json
  response
end

#find_all_kapp_webhook_jobs(kapp_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all Webhook Jobs for a kapp.

This method will process pages of jobs and internally concatenate the results into a single array.

Warning - using this method can cause out of memory errors on large result sets.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +status+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/kinetic_sdk/core/lib/webhook_jobs.rb', line 68

def find_all_kapp_webhook_jobs(kapp_slug, params={}, headers=default_headers)
  # Make the initial request of pages jobs
  response = find_kapp_webhook_jobs(kapp_slug, params, headers)
  # Build Submissions Array
  jobs = response.content["webhookJobs"]
  # if a next page token exists, keep retrieving jobs and add them to the results
  while (!response.content["nextPageToken"].nil?)
    params['pageToken'] = response.content["nextPageToken"]
    response = find_kapp_webhook_jobs(kapp_slug, params, headers)
    # concat the jobs
    jobs.concat(response.content["webhookJobs"] || [])
  end
  final_content = {"webhookJobs" => jobs, "nextPageToken" => nil }
  # Return the results
  response.content=final_content
  response.content_string=final_content.to_json
  response
end

#find_all_space_webhook_jobs(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all Webhook Jobs for a space.

This method will process pages of jobs and internally concatenate the results into a single array.

Warning - using this method can cause out of memory errors on large result sets.

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +status+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/kinetic_sdk/core/lib/webhook_jobs.rb', line 26

def find_all_space_webhook_jobs(params={}, headers=default_headers)
  # Make the initial request of pages jobs
  response = find_space_webhook_jobs(params, headers)
  # Build Submissions Array
  jobs = response.content["webhookJobs"]
  # if a next page token exists, keep retrieving jobs and add them to the results
  while (!response.content["nextPageToken"].nil?)
    params['pageToken'] = response.content["nextPageToken"]
    response = find_space_webhook_jobs(params, headers)
    # concat the jobs
    jobs.concat(response.content["webhookJobs"] || [])
  end
  final_content = {"webhookJobs" => jobs, "nextPageToken" => nil }
  # Return the results
  response.content=final_content
  response.content_string=final_content.to_json
  response
end

#find_bridge(slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a bridge

Parameters:

  • slug (String)

    slug of the bridge

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



44
45
46
47
# File 'lib/kinetic_sdk/core/lib/bridges.rb', line 44

def find_bridge(slug, params={}, headers=default_headers)
  @logger.info("Finding the \"#{slug}\" bridge through proxy to the agent platform component.")
  get("#{@proxy_url}/agent/app/api/v1/bridges/#{slug}", params, headers)
end

#find_bridge_model(name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a bridge model

Parameters:

  • name (String)

    name of the bridge model

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



102
103
104
105
# File 'lib/kinetic_sdk/core/lib/bridges.rb', line 102

def find_bridge_model(name, params={}, headers=default_headers)
  @logger.info("Finding the \"#{name}\" Bridge Model.")
  get("#{@api_url}/models/#{encode(name)}", params, headers)
end

#find_bridge_models(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a list of bridge models

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



91
92
93
94
# File 'lib/kinetic_sdk/core/lib/bridges.rb', line 91

def find_bridge_models(params={}, headers=default_headers)
  @logger.info("Find Bridge models.")
  get("#{@api_url}/models", params, headers)
end

#find_bridges(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a list of bridges

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



33
34
35
36
# File 'lib/kinetic_sdk/core/lib/bridges.rb', line 33

def find_bridges(params={}, headers=default_headers)
  @logger.info("Find bridges through proxy to the agent platform component.")
  get("#{@proxy_url}/agent/app/api/v1/bridges", params, headers)
end

#find_category_attribute_definition(kapp_slug, name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a category attribute definition

Parameters:

  • kapp_slug (String)

    slug of the kapp where the category exists

  • name (String)

    name of the attribute definition

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



341
342
343
344
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 341

def find_category_attribute_definition(kapp_slug, name, params={}, headers=default_headers)
  @logger.info("Finding the \"#{name}\" Category attribute definition in the \"#{kapp_slug}\" kapp.")
  get("#{@api_url}/kapps/#{kapp_slug}/categoryAttributeDefinitions/#{encode(name)}", params, headers)
end

#find_category_attribute_definitions(kapp_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all category attribute definition

Parameters:

  • kapp_slug (String)

    slug of the kapp where the categories exist

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



352
353
354
355
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 352

def find_category_attribute_definitions(kapp_slug, params={}, headers=default_headers)
  @logger.info("Finding Category attribute definitions in the \"#{kapp_slug}\" kapp.")
  get("#{@api_url}/kapps/#{kapp_slug}/categoryAttributeDefinitions", params, headers)
end

#find_datastore_form(form_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a Datastore Form

Parameters:

  • form_slug (String)

    slug of the form

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



63
64
65
66
# File 'lib/kinetic_sdk/core/lib/datastore_form.rb', line 63

def find_datastore_form(form_slug, params={}, headers=default_headers)
  @logger.info("Finding the \"#{form_slug}\" Datastore Form")
  get("#{@api_url}/datastore/forms/#{form_slug}", params, headers)
end

#find_datastore_form_attribute_definition(name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a datastore form attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



38
39
40
41
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 38

def find_datastore_form_attribute_definition(name, params={}, headers=default_headers)
  @logger.info("Finding the \"#{name}\" Datastore Form Attribute Definition")
  get("#{@api_url}/datastoreFormAttributeDefinitions/#{encode(name)}", params, headers)
end

#find_datastore_form_attribute_definitions(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all datastore form attribute definitions

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



48
49
50
51
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 48

def find_datastore_form_attribute_definitions(params={}, headers=default_headers)
  @logger.info("Finding Datastore Form Attribute Definitions")
  get("#{@api_url}/datastoreFormAttributeDefinitions", params, headers)
end

#find_datastore_forms(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find Datastore Forms

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



52
53
54
55
# File 'lib/kinetic_sdk/core/lib/datastore_form.rb', line 52

def find_datastore_forms(params={}, headers=default_headers)
  @logger.info("Finding Forms.")
  get("#{@api_url}/datastore/forms", params, headers)
end

#find_datastore_submission(submission_id, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a Datastore submission

Parameters:

  • submission_id (String)

    String value of the Submission Id (UUID)

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



139
140
141
142
# File 'lib/kinetic_sdk/core/lib/datastore_submissions.rb', line 139

def find_datastore_submission(submission_id, params={}, headers=default_headers)
  @logger.info("Finding Datastore Submission \"#{submission_id}\"")
  get("#{@api_url}/datastore/submissions/#{encode(submission_id)}", params, headers)
end

#find_form(kapp_slug, form_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a Form

Parameters:

  • kapp_slug (String)

    slug of the Kapp the form belongs to

  • form_slug (String)

    slug of the form

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



68
69
70
71
# File 'lib/kinetic_sdk/core/lib/form.rb', line 68

def find_form(kapp_slug, form_slug, params={}, headers=default_headers)
  @logger.info("Finding the \"#{form_slug}\" Form in the \"#{kapp_slug}\" Kapp.")
  get("#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}", params, headers)
end

#find_form_attribute_definition(kapp_slug, name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a form attribute definition

Parameters:

  • kapp_slug (String)

    slug of the kapp where the form exists

  • name (String)

    name of the attribute definition

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



406
407
408
409
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 406

def find_form_attribute_definition(kapp_slug, name, params={}, headers=default_headers)
  @logger.info("Finding the \"#{name}\" Form attribute definition in the \"#{kapp_slug}\" kapp.")
  get("#{@api_url}/kapps/#{kapp_slug}/formAttributeDefinitions/#{encode(name)}", params, headers)
end

#find_form_attribute_definitions(kapp_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all form attribute definition

Parameters:

  • kapp_slug (String)

    slug of the kapp where the forms exist

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



417
418
419
420
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 417

def find_form_attribute_definitions(kapp_slug, params={}, headers=default_headers)
  @logger.info("Finding Form attribute definitions in the \"#{kapp_slug}\" kapp.")
  get("#{@api_url}/kapps/#{kapp_slug}/formAttributeDefinitions", params, headers)
end

#find_form_datastore_submissions(form_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a page of Submissions for a Datastore form.

The page offset can be defined by passing in the "pageToken" parameter, indicating the value of the token that will represent the first submission in the result set. If not provided, the first page of submissions will be retrieved.

Parameters:

  • form_slug (String)

    slug of the Form

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

    • +pageToken+ - used for paginated results
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/kinetic_sdk/core/lib/datastore_submissions.rb', line 118

def find_form_datastore_submissions(form_slug, params={}, headers=default_headers)
  # Get next page token
  token = params["pageToken"]
  if token.nil?
    @logger.info("Finding first page of submissions for the \"#{form_slug}\" Datastore.")
  else
    @logger.info("Finding page of submissions starting with token \"#{token}\" for the \"#{form_slug}\" Form.")
  end

  # Build Submission URL
  url = "#{@api_url}/datastore/forms/#{form_slug}/submissions"
  # Return the response
  get(url, params, headers)
end

#find_form_submissions(kapp_slug, form_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a page of Submissions for a form.

The page offset can be defined by passing in the "pageToken" parameter, indicating the value of the token that will represent the first submission in the result set. If not provided, the first page of submissions will be retrieved.

Parameters:

  • kapp_slug (String)

    slug of the Kapp

  • form_slug (String)

    slug of the Form

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

    • +pageToken+ - used for paginated results
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/kinetic_sdk/core/lib/submissions.rb', line 161

def find_form_submissions(kapp_slug, form_slug, params={}, headers=default_headers)
  # Get next page token
  token = params["pageToken"]
  if token.nil?
    @logger.info("Finding first page of submissions for the \"#{form_slug}\" Form.")
  else
    @logger.info("Finding page of submissions starting with token \"#{token}\" for the \"#{form_slug}\" Form.")
  end

  # Build Submission URL
  url = "#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}/submissions"
  # Return the response
  get(url, params, headers)
end

#find_form_types_on_kapp(kapp_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Retrieve a list of all form types for a Kapp

Parameters:

  • kapp_slug (String)

    slug of the Kapp the form types belongs to

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



45
46
47
48
# File 'lib/kinetic_sdk/core/lib/form_types.rb', line 45

def find_form_types_on_kapp(kapp_slug, params={}, headers=default_headers)
  @logger.info("Finding Form Types for \"#{kapp_slug}\" kapp")
  get("#{@api_url}/kapps/#{kapp_slug}/formTypes", params, headers)
end

#find_forms(kapp_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find Forms

Parameters:

  • kapp_slug (String)

    slug of the Kapp the forms belongs to

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



56
57
58
59
# File 'lib/kinetic_sdk/core/lib/form.rb', line 56

def find_forms(kapp_slug, params={}, headers=default_headers)
  @logger.info("Finding Forms.")
  get("#{@api_url}/kapps/#{kapp_slug}/forms", params, headers)
end

#find_kapp(kapp_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a Kapp

Parameters:

  • kapp_slug (String)

    slug of the Kapp

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



65
66
67
68
# File 'lib/kinetic_sdk/core/lib/kapp.rb', line 65

def find_kapp(kapp_slug, params={}, headers=default_headers)
  @logger.info("Finding Kapp \"#{kapp_slug}\"")
  get("#{@api_url}/kapps/#{kapp_slug}", params, headers)
end

#find_kapp_attribute_definition(kapp_slug, name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a kapp attribute definition

Parameters:

  • kapp_slug (String)

    slug of the kapp

  • name (String)

    name of the attribute definition

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



471
472
473
474
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 471

def find_kapp_attribute_definition(kapp_slug, name, params={}, headers=default_headers)
  @logger.info("Finding the \"#{name}\" Kapp attribute definition in the \"#{kapp_slug}\" kapp.")
  get("#{@api_url}/kapps/#{kapp_slug}/kappAttributeDefinitions/#{encode(name)}", params, headers)
end

#find_kapp_attribute_definitions(kapp_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all kapp attribute definition

Parameters:

  • kapp_slug (String)

    slug of the kapp

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



482
483
484
485
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 482

def find_kapp_attribute_definitions(kapp_slug, params={}, headers=default_headers)
  @logger.info("Finding Kapp attribute definitions in the \"#{kapp_slug}\" kapp.")
  get("#{@api_url}/kapps/#{kapp_slug}/kappAttributeDefinitions", params, headers)
end

#find_kapp_submissions(kapp_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a page of Submissions for a kapp.

The page offset can be defined by passing in the "pageToken" parameter, indicating the value of the token that will represent the first submission in the result set. If not provided, the first page of submissions will be retrieved.

Parameters:

  • kapp_slug (String)

    slug of the Kapp

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

    • +pageToken+ - used for paginated results
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/kinetic_sdk/core/lib/submissions.rb', line 188

def find_kapp_submissions(kapp_slug, params={}, headers=default_headers)
  # Get next page token
  token = params["pageToken"]
  if token.nil?
    @logger.info("Finding first page of submissions for the \"#{kapp_slug}\" Kapp.")
  else
    @logger.info("Finding page of submissions starting with token \"#{token}\" for the \"#{kapp_slug}\" Kapp.")
  end

  # Build Submission URL
  url = "#{@api_url}/kapps/#{kapp_slug}/submissions"
  # Return the response
  get(url, params, headers)
end

#find_kapp_webhook_jobs(kapp_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find kapp webhook jobs

Parameters:

  • kapp_slug (String)

    the Kapp slug

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +status+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



51
52
53
54
# File 'lib/kinetic_sdk/core/lib/webhook_jobs.rb', line 51

def find_kapp_webhook_jobs(kapp_slug, params={}, headers=default_headers)
  @logger.info("Finding webhook jobs in the \"#{kapp_slug}\" Kapp")
  get("#{@api_url}/kapps/#{kapp_slug}/webhookJobs", params, headers)
end

#find_kapps(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find Kapps

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



54
55
56
57
# File 'lib/kinetic_sdk/core/lib/kapp.rb', line 54

def find_kapps(params={}, headers=default_headers)
  @logger.info("Finding Kapps.")
  get("#{@api_url}/kapps", params, headers)
end

#find_oauth_client(client_id, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find OAuth client

Parameters:

  • client_id (String)
    • oauth client identifier
  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



20
21
22
23
# File 'lib/kinetic_sdk/core/lib/oauth.rb', line 20

def find_oauth_client(client_id, params={}, headers=default_headers)
  @logger.info("Finding OAuth Client \"#{client_id}\"")
  get("#{@api_url}/oauthClients/#{encode(client_id)}", params, headers)
end

#find_security_policy_definition(kapp_slug, name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a single Kapp security policy definition

Parameters:

  • kapp_slug (String)

    slug of the kapp

  • name (String)

    name of the security policy definition

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



135
136
137
138
# File 'lib/kinetic_sdk/core/lib/security_policy_definitions.rb', line 135

def find_security_policy_definition(kapp_slug, name, params={}, headers=default_headers)
  @logger.info("Finding Security Policy Definition \"#{name}\" on the \"#{kapp_slug}\" kapp.")
  get("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions/#{encode(name)}", params, headers)
end

#find_security_policy_definitions(kapp_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all Kapp security policy definitions

Parameters:

  • kapp_slug (String)

    slug of the kapp

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



123
124
125
126
# File 'lib/kinetic_sdk/core/lib/security_policy_definitions.rb', line 123

def find_security_policy_definitions(kapp_slug, params={}, headers=default_headers)
  @logger.info("Listing Security Policy Definitions on the \"#{kapp_slug}\" kapp.")
  get("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions", params, headers)
end

#find_space(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find the space

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



96
97
98
99
# File 'lib/kinetic_sdk/core/lib/space.rb', line 96

def find_space(params={}, headers=default_headers)
  @logger.info("Finding Space \"#{@space_slug}\"")
  get("#{@api_url}/space", params, headers)
end

#find_space_attribute_definition(name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a space attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



98
99
100
101
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 98

def find_space_attribute_definition(name, params={}, headers=default_headers)
  @logger.info("Finding the \"#{name}\" Space Attribute Definition")
  get("#{@api_url}/spaceAttributeDefinitions/#{encode(name)}", params, headers)
end

#find_space_attribute_definitions(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all space attribute definitions

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



108
109
110
111
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 108

def find_space_attribute_definitions(params={}, headers=default_headers)
  @logger.info("Finding Space Attribute Definitions")
  get("#{@api_url}/spaceAttributeDefinitions", params, headers)
end

#find_space_in_system(slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find the space (System API)

Parameters:

  • slug (String)

    slug of the space

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



43
44
45
46
# File 'lib/kinetic_sdk/core/lib/system_api.rb', line 43

def find_space_in_system(slug, params={}, headers=default_headers)
  @logger.info("Retrieving Space \"#{slug}\"")
  get("#{@api_url}/spaces/#{slug}", params, headers)
end

#find_space_security_policy_definition(name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a single Space security policy definition

Parameters:

  • name (String)

    name of the security policy definition

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



56
57
58
59
# File 'lib/kinetic_sdk/core/lib/security_policy_definitions.rb', line 56

def find_space_security_policy_definition(name, params={}, headers=default_headers)
  @logger.info("Finding Space Security Policy Definition \"#{name}\"")
  get("#{@api_url}/securityPolicyDefinitions/#{encode(name)}", params, headers)
end

#find_space_security_policy_definitions(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all Space security policy definitions

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



45
46
47
48
# File 'lib/kinetic_sdk/core/lib/security_policy_definitions.rb', line 45

def find_space_security_policy_definitions(params={}, headers=default_headers)
  @logger.info("Finding Space Security Policy Definitions.")
  get("#{@api_url}/securityPolicyDefinitions", params, headers)
end

#find_space_webhook_jobs(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find space webhook jobs

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +status+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



9
10
11
12
# File 'lib/kinetic_sdk/core/lib/webhook_jobs.rb', line 9

def find_space_webhook_jobs(params={}, headers=default_headers)
  @logger.info("Finding webhook jobs in the Space")
  get("#{@api_url}/webhookJobs", params, headers)
end

#find_spaces(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all spaces

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



32
33
34
35
# File 'lib/kinetic_sdk/core/lib/system_api.rb', line 32

def find_spaces(params={}, headers=default_headers)
  @logger.info("Finding Spaces")
  get("#{@api_url}/spaces", params, headers)
end

#find_task_component(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find Task Component

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



11
12
13
14
# File 'lib/kinetic_sdk/core/lib/platform_components.rb', line 11

def find_task_component(params = {}, headers = default_headers)
  @logger.info("Finding Task Component.")
  get("#{@api_url}/platformComponents/task", params, headers)
end

#find_team(team_name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find the team

Attributes

Parameters:

  • team_name (String)

    the team name

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



106
107
108
109
110
# File 'lib/kinetic_sdk/core/lib/teams.rb', line 106

def find_team(team_name, params={}, headers=default_headers)
  team_slug = Digest::MD5.hexdigest(team_name)
  @logger.info("Finding the \"#{team_name}\" (#{team_slug}) Team.")
  get("#{@api_url}/teams/#{team_slug}", params, headers)
end

#find_team_attribute_definition(name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a team attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



158
159
160
161
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 158

def find_team_attribute_definition(name, params={}, headers=default_headers)
  @logger.info("Finding the \"#{name}\" Team Attribute Definition")
  get("#{@api_url}/teamAttributeDefinitions/#{encode(name)}", params, headers)
end

#find_team_attribute_definitions(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all team attribute definitions

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



168
169
170
171
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 168

def find_team_attribute_definitions(params={}, headers=default_headers)
  @logger.info("Finding Team Attribute Definitions")
  get("#{@api_url}/teamAttributeDefinitions", params, headers)
end

#find_teams(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find teams

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



82
83
84
85
# File 'lib/kinetic_sdk/core/lib/teams.rb', line 82

def find_teams(params={}, headers=default_headers)
  @logger.info("Finding Teams")
  get("#{@api_url}/teams", params, headers)
end

#find_user(username, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find the user

Parameters:

  • username (String)

    username of the user

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



179
180
181
182
# File 'lib/kinetic_sdk/core/lib/users.rb', line 179

def find_user(username, params={}, headers=default_headers)
  @logger.info("Finding User \"#{username}\"")
  get("#{@api_url}/users/#{encode(username)}", params, headers)
end

#find_user_attribute_definition(name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a user attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



218
219
220
221
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 218

def find_user_attribute_definition(name, params={}, headers=default_headers)
  @logger.info("Finding the \"#{name}\" User Attribute Definition")
  get("#{@api_url}/userAttributeDefinitions/#{encode(name)}", params, headers)
end

#find_user_attribute_definitions(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all user attribute definitions

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



228
229
230
231
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 228

def find_user_attribute_definitions(params={}, headers=default_headers)
  @logger.info("Finding User Attribute Definitions")
  get("#{@api_url}/userAttributeDefinitions", params, headers)
end

#find_user_in_system(space_slug, username, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a user in a space (System API)

Parameters:

  • space_slug (String)

    slug of the space

  • username (String)

    the username to find

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and JSON content type

Returns:



75
76
77
78
# File 'lib/kinetic_sdk/core/lib/system_api.rb', line 75

def find_user_in_system(space_slug, username, params={}, headers=default_headers)
  @logger.info("Finding User #{username} in Space #{space_slug}")
  get("#{@api_url}/spaces/#{space_slug}/users/#{encode(username)}", params, headers)
end

#find_user_profile_attribute_definition(name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a user profile attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



278
279
280
281
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 278

def (name, params={}, headers=default_headers)
  @logger.info("Finding the \"#{name}\" User Profile Attribute Definition")
  get("#{@api_url}/userProfileAttributeDefinitions/#{encode(name)}", params, headers)
end

#find_user_profile_attribute_definitions(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find user profile attribute definitions

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



288
289
290
291
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 288

def (params={}, headers=default_headers)
  @logger.info("Finding User Profile Attribute Definitions")
  get("#{@api_url}/userProfileAttributeDefinitions", params, headers)
end

#find_users(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all users

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



168
169
170
171
# File 'lib/kinetic_sdk/core/lib/users.rb', line 168

def find_users(params={}, headers=default_headers)
  @logger.info("Finding Users \"#{username}\"")
  get("#{@api_url}/users", params, headers)
end

#find_webhook_on_kapp(kapp_slug, name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a webhook defined in a Kapp

Parameters:

  • kapp_slug (String)

    the Kapp slug

  • name (String)

    the webhook name

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



133
134
135
136
# File 'lib/kinetic_sdk/core/lib/webhooks.rb', line 133

def find_webhook_on_kapp(kapp_slug, name, params={}, headers=default_headers)
  @logger.info("Finding the \"#{name}\" webhook on the \"#{kapp_slug}\" Kapp")
  get("#{@api_url}/kapps/#{kapp_slug}/webhooks/#{encode(name)}", params, headers)
end

#find_webhooks_on_kapp(kapp_slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all webhooks for a Kapp

Parameters:

  • kapp_slug (String)

    the Kapp slug

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



111
112
113
114
# File 'lib/kinetic_sdk/core/lib/webhooks.rb', line 111

def find_webhooks_on_kapp(kapp_slug, params={}, headers=default_headers)
  @logger.info("Finding all webhooks on the \"#{kapp_slug}\" Kapp")
  get("#{@api_url}/kapps/#{kapp_slug}/webhooks", params, headers)
end

#find_webhooks_on_space(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find all webhooks for a Space

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



121
122
123
124
# File 'lib/kinetic_sdk/core/lib/webhooks.rb', line 121

def find_webhooks_on_space(params={}, headers=default_headers)
  @logger.info("Finding all webhooks on the Space")
  get("#{@api_url}/webhooks", params, headers)
end

#finding_webhook_on_space(name, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find a webhook defined in a Space

Parameters:

  • name (String)

    the webhook name

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



144
145
146
147
# File 'lib/kinetic_sdk/core/lib/webhooks.rb', line 144

def finding_webhook_on_space(name, params={}, headers=default_headers)
  @logger.info("Finding the \"#{name}\" webhook on the Space")
  get("#{@api_url}/webhooks/#{encode(name)}", params, headers)
end

#generate_password_token(username, body = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Generate Password Reset Token.

Parameters:

  • username (String)

    username of the user

  • body (Hash) (defaults to: {})

    properties

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



229
230
231
232
# File 'lib/kinetic_sdk/core/lib/users.rb', line 229

def generate_password_token(username, body={}, headers=default_headers)
  @logger.info("Generating PW Token for \"#{username}\"")
  post("#{@api_url}/users/#{encode(username)}/passwordResetToken", body, headers)
end

#import_space(slug, headers = default_headers) ⇒ Object

Imports a full space definition from the export_directory

Parameters:

  • slug (String)

    the slug of the space that is being imported

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:

  • nil



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/kinetic_sdk/core/lib/space.rb', line 106

def import_space(slug, headers=default_headers)
  raise StandardError.new "An export directory must be defined to import space." if @options[:export_directory].nil?
  @logger.info("Importing space definition from #{@options[:export_directory]}.")

  # Loop over all provided files sorting files before folders
  Dir["#{@options[:export_directory]}/**/*.json"].map { |file| [file.count("/"), file] }.sort.map { |file| file[1] }.each do |file|
    rel_path = file.gsub("#{@options[:export_directory]}/", '')
    body = JSON.parse(File.read(file))
    if rel_path == "space.json"
      api_path = "/space"
      @logger.info("Importing #{rel_path} to #{api_path}.")
      body['slug'] = slug
      resp = put("#{@api_url}#{api_path}", body, headers)
    elsif body.is_a?(Array)
      api_path = "/#{rel_path.sub(/^space\//,'').sub(/\.json$/,'')}"
      body.each do |part|
        @logger.info("Importing #{rel_path} to #{api_path}.")
        resp = post("#{@api_url}#{api_path}", part, headers)
      end
    else
      api_path = "/#{rel_path.sub(/^space\//,'').sub(/\/[^\/]+$/,'')}"
      # TODO: Remove this block when core API is updated to not export Key
      if api_path == "/bridges" && body.has_key?("key")
        body.delete("key")
      end
      @logger.info("Importing #{rel_path} to #{api_path}.")
      resp = post("#{@api_url}#{api_path}", body, headers)
      # TODO: Remove this block when core API is updated to not pre-create SPDs
      if api_path == "/kapps"
        kapp_slug = resp.content["kapp"]["slug"]
        delete_security_policy_definitions(kapp_slug)
      end
    end
  end
  @logger.info("Finished importing space definition to #{@options[:export_directory]}.")
end

#jwt_code(client_id, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Gets an authentication code.

This method should really never need to be called externally.

Parameters:

  • client_id (String)
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/kinetic_sdk/core/lib/jwt.rb', line 35

def jwt_code(client_id, headers = default_headers)
  @logger.info("Retrieving JWT authorization code")
  url = "#{@server}/app/oauth/authorize?grant_type=authorization_code&response_type=code&client_id=#{client_id}"
  response = post(url, {}, headers, { :max_redirects => -1 })

  if response.status == 401
    raise StandardError.new "#{response.message}: #{response.content["error"]}"
  elsif response.status == 302
    location = response.headers["location"]
    if location.nil?
      raise StandardError.new "Unable to retrieve code: #{response.inspect}"
    else
      location.split("?code=").last.split("#/").first
    end
  else
    raise StandardError.new "Unable to retrieve code #{response.inspect}"
  end
end

#jwt_token(client_id, client_secret, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Gets an authentication token

Parameters:

  • client_id (String)

    the oauth client id

  • client_secret (String)

    the oauth client secret

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kinetic_sdk/core/lib/jwt.rb', line 10

def jwt_token(client_id, client_secret, headers = default_headers)
  # retrieve the jwt code
  jwt_code = jwt_code(client_id, headers)
  # retrieve the jwt token
  @logger.info("Retrieving JWT authorization token")
  url = "#{@server}/app/oauth/token?grant_type=authorization_code&response_type=token&client_id=#{client_id}&code=#{jwt_code}"
  token_headers = header_accept_json.merge(header_basic_auth(client_id, client_secret))
  response = post(url, {}, token_headers, { :max_redirects => 0 })

  if response.status == 401
    raise StandardError.new "#{response.message}, the oauth client id and secret are invalid."
  elsif response.status == 200
    response
  else
    raise StandardError.new "Unable to retrieve token: #{response}"
  end
end

#me(params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Find the current user

Parameters:

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



239
240
241
242
# File 'lib/kinetic_sdk/core/lib/users.rb', line 239

def me(params={}, headers=default_headers)
  @logger.info("Finding Me")
  get("#{@api_url}/me", params, headers)
end

#patch_datastore_submission(form_slug, payload = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Patch a new Datastore Submission

Parameters:

  • form_slug (String)

    slug of the Form

  • payload (Hash) (defaults to: {})

    payload of the submission

    • +origin+ - Origin ID of the submission to be patched
    • +parent+ - Parent ID of the submission to be patched
    • +values+ - hash of field values for the submission
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/kinetic_sdk/core/lib/datastore_submissions.rb', line 56

def patch_datastore_submission(form_slug, payload={}, headers=default_headers)
  # set the currentPage hash if currentPage was passed as a string
  payload["currentPage"] = { "name" => payload["currentPage"] } if payload["currentPage"].is_a? String
  # initialize "values" if nil
  payload["values"] = {} if payload["values"].nil?
  # set origin hash if origin was passed as a string
  payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
  # set parent hash if parent was passed as a string
  payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
  # Create the submission
  @logger.info("Patching a submission in the \"#{form_slug}\" Form.")
  patch("#{@api_url}/datastore/forms/#{form_slug}/submissions", payload, headers)
end

#patch_existing_submission(submission_id, payload = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Patch an existing Submission

Parameters:

  • submission_id (String)

    id of the Submission

  • payload (Hash) (defaults to: {})

    payload of the submission

    • +origin+ - Origin ID of the submission to be patched
    • +parent+ - Parent ID of the submission to be patched
    • +values+ - hash of field values for the submission
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/kinetic_sdk/core/lib/submissions.rb', line 97

def patch_existing_submission(submission_id, payload={}, headers=default_headers)
  # set the currentPage hash if currentPage was passed as a string
  payload["currentPage"] = { "name" => payload["currentPage"] } if payload["currentPage"].is_a? String
  # initialize "values" if nil
  payload["values"] = {} if payload["values"].nil?
  # set origin hash if origin was passed as a string
  payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
  # set parent hash if parent was passed as a string
  payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
  # Create the submission
  @logger.info("Patching a submission with id \"#{submission_id}\"")
  patch("#{@api_url}/submissions/#{submission_id}", payload, headers)
end

#patch_new_submission(kapp_slug, form_slug, payload = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Patch a new Submission

Parameters:

  • kapp_slug (String)

    slug of the Kapp

  • form_slug (String)

    slug of the Form

  • payload (Hash) (defaults to: {})

    payload of the submission

    • +origin+ - Origin ID of the submission to be patched
    • +parent+ - Parent ID of the submission to be patched
    • +values+ - hash of field values for the submission
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/kinetic_sdk/core/lib/submissions.rb', line 74

def patch_new_submission(kapp_slug, form_slug, payload={}, headers=default_headers)
  # set the currentPage hash if currentPage was passed as a string
  payload["currentPage"] = { "name" => payload["currentPage"] } if payload["currentPage"].is_a? String
  # initialize "values" if nil
  payload["values"] = {} if payload["values"].nil?
  # set origin hash if origin was passed as a string
  payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
  # set parent hash if parent was passed as a string
  payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
  # Create the submission
  @logger.info("Patching a submission in the \"#{form_slug}\" Form.")
  patch("#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}/submissions", payload, headers)
end

#reset_license_count(headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Reset the license count (System API)

Parameters:

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



63
64
65
66
# File 'lib/kinetic_sdk/core/lib/system_api.rb', line 63

def reset_license_count(headers=default_headers)
  @logger.info("Resetting License Count")
  put("#{@api_url}/license/reset", {}, headers)
end

#space_exists?(slug, params = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Checks if the space exists

Parameters:

  • slug (String)

    slug of the space

  • params (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +include+

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



149
150
151
152
153
# File 'lib/kinetic_sdk/core/lib/space.rb', line 149

def space_exists?(slug, params={}, headers=default_headers)
  @logger.info("Checking if the \"#{slug}\" space exists")
  response = get("#{@api_url}/spaces/#{slug}", params, headers)
  response.status == 200
end

#update_agent_component(agent_slug, component_properties, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update Agent Component

Parameters:

  • agent_slug (String)

    the slug of the agent to update

  • component_properties (Hash)

    the property values for the team

    • +slug+ - Slug of the agent to be added
    • +url+ - URL for the agent being added
    • +secret+ - Secret for the agent being added
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



73
74
75
76
77
# File 'lib/kinetic_sdk/core/lib/platform_components.rb', line 73

def update_agent_component(agent_slug, component_properties, headers = default_headers)
  raise StandardError.new "Agent Component properties is not valid, must be a Hash." unless component_properties.is_a? Hash
  @logger.info("Updating Agent Component \"#{agent_slug}\".")
  put("#{@api_url}/platformComponents/agents/#{agent_slug}", component_properties, headers)
end

#update_bridge(slug, body = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a bridge

Parameters:

  • slug (String)

    slug of the bridge

  • body (Hash) (defaults to: {})

    properties of the bridge to update

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



55
56
57
58
# File 'lib/kinetic_sdk/core/lib/bridges.rb', line 55

def update_bridge(slug, body={}, headers=default_headers)
  @logger.info("Updating the \"#{slug}\" bridge through proxy to the agent platform component.")
  put("#{@proxy_url}/agent/app/api/v1/bridges/#{slug}", body, headers)
end

#update_bridge_model(name, body = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a Bridge Model

Parameters:

  • name (String)

    name of the bridge model

  • body (Hash) (defaults to: {})

    optional properties associated to the Bridge Model

    • +name+
    • +status+
    • +activeMappingName+
    • +attributes+
    • +mappings+
    • +qualifications+
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



119
120
121
122
# File 'lib/kinetic_sdk/core/lib/bridges.rb', line 119

def update_bridge_model(name, body={}, headers=default_headers)
  @logger.info("Updating the \"#{name}\" Bridge Model.")
  put("#{@api_url}/models/#{encode(name)}", body, headers)
end

#update_bridge_model_mapping(model_name, mapping_name, body = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a Bridge Model Mapping

Parameters:

  • model_name (String)

    name of the bridge model

  • mapping_name (String)

    name of the bridge model mapping

  • body (Hash) (defaults to: {})

    optional properties associated to the Bridge Model Mapping

    • +name+
    • +bridgeSlug+
    • +structure+
    • +attributes+
    • +qualifications+
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



136
137
138
139
# File 'lib/kinetic_sdk/core/lib/bridges.rb', line 136

def update_bridge_model_mapping(model_name, mapping_name, body={}, headers=default_headers)
  @logger.info("Updating the \"#{model_name} - #{mapping_name}\" Bridge Model Mapping.")
  put("#{@api_url}/models/#{encode(model_name)}/mappings/#{encode(mapping_name)}", body, headers)
end

#update_category_attribute_definition(kapp_slug, name, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a category attribute definition

Parameters:

  • kapp_slug (String)

    slug of the kapp where the category exists

  • name (String)

    name of the attribute definition

  • body (Hash)

    properties of the attribute definition to update

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



364
365
366
367
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 364

def update_category_attribute_definition(kapp_slug, name, body, headers=default_headers)
  @logger.info("Updating the \"#{name}\" Category attribute definition in the \"#{kapp_slug}\" kapp.")
  put("#{@api_url}/kapps/#{kapp_slug}/categoryAttributeDefinitions/#{encode(name)}",body, headers)
end

#update_datastore_form(form_slug, properties = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a Datastore Form

Parameters:

  • form_slug (String)

    slug of the form

  • properties (Hash) (defaults to: {})

    form properties to update

    • +customHeadContent+
    • +description+
    • +name+
    • +notes+
    • +slug+
    • +status+
    • +submissionLabelExpression+
    • +attributes+
    • +attributesMap+
    • +bridgedResources+
    • +pages+
    • +securityPolicies+
    • +indexDefinitions+
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



87
88
89
90
# File 'lib/kinetic_sdk/core/lib/datastore_form.rb', line 87

def update_datastore_form(form_slug, properties={}, headers=default_headers)
  @logger.info("Updating the \"#{form_slug}\" Datastore Form.")
  put("#{@api_url}/datastore/forms/#{form_slug}", properties, headers)
end

#update_datastore_form_attribute_definition(name, body = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a datastore form attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • body (Hash) (defaults to: {})

    properties of the attribute definition to update

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



59
60
61
62
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 59

def update_datastore_form_attribute_definition(name, body={}, headers=default_headers)
  @logger.info("Updating the \"#{name}\" Datastore Form Attribute Definition.")
  put("#{@api_url}/datastoreFormAttributeDefinitions/#{encode(name)}",body, headers)
end

#update_datastore_submission(submission_id, body = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a Datastore submission

Parameters:

  • submission_id (String)

    String value of the Submission Id (UUID)

  • body (Hash) (defaults to: {})

    submission properties to update

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



151
152
153
154
# File 'lib/kinetic_sdk/core/lib/datastore_submissions.rb', line 151

def update_datastore_submission(submission_id, body={}, headers=default_headers)
  @logger.info("Updating Datastore Submission \"#{submission_id}\"")
  put("#{@api_url}/datastore/submissions/#{encode(submission_id)}", body, headers)
end

#update_form(kapp_slug, form_slug, properties = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a Form

Parameters:

  • kapp_slug (String)

    slug of the Kapp the form belongs to

  • form_slug (String)

    slug of the form

  • properties (Hash) (defaults to: {})

    form properties to update

    • +anonymous+
    • +customHeadContent+
    • +description+
    • +name+
    • +notes+
    • +slug+
    • +status+
    • +submissionLabelExpression+
    • +type+
    • +attributes+
    • +bridgedResources+
    • +pages+
    • +securityPolicies+
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



93
94
95
96
# File 'lib/kinetic_sdk/core/lib/form.rb', line 93

def update_form(kapp_slug, form_slug, properties={}, headers=default_headers)
  @logger.info("Updating the \"#{form_slug}\" Form in the \"#{kapp_slug}\" Kapp.")
  put("#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}", properties, headers)
end

#update_form_attribute_definition(kapp_slug, name, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a form attribute definition

Parameters:

  • kapp_slug (String)

    slug of the kapp where the form exists

  • name (String)

    name of the attribute definition

  • body (Hash)

    properties of the attribute definition to update

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



429
430
431
432
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 429

def update_form_attribute_definition(kapp_slug, name, body, headers=default_headers)
  @logger.info("Updating the \"#{name}\" Form attribute definition in the \"#{kapp_slug}\" kapp.")
  put("#{@api_url}/kapps/#{kapp_slug}/formAttributeDefinitions/#{encode(name)}",body, headers)
end

#update_kapp(kapp_slug, properties = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a Kapp

Parameters:

  • kapp_slug (String)

    slug of the Kapp

  • properties (Hash) (defaults to: {})

    optional properties associated to the Kapp

    • +afterLogoutPath+
    • +bundlePath+
    • +defaultFormDisplayPage+
    • +defaultFormConfirmationPage+
    • +defaultSubmissionLabelExpression+
    • +displayType+
    • +displayValue+
    • +loginPage+
    • +name+
    • +resetPasswordPage+
    • +slug+
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



87
88
89
90
# File 'lib/kinetic_sdk/core/lib/kapp.rb', line 87

def update_kapp(kapp_slug, properties={}, headers=default_headers)
  @logger.info("Updating the \"#{kapp_slug}\" Kapp.")
  put("#{@api_url}/kapps/#{kapp_slug}", properties, headers)
end

#update_kapp_attribute_definition(kapp_slug, name, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a kapp attribute definition

Parameters:

  • kapp_slug (String)

    slug of the kapp

  • name (String)

    name of the attribute definition

  • body (Hash)

    properties of the attribute definition to update

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



494
495
496
497
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 494

def update_kapp_attribute_definition(kapp_slug, name, body, headers=default_headers)
  @logger.info("Updating the \"#{name}\" Kapp attribute definition in the \"#{kapp_slug}\" kapp.")
  put("#{@api_url}/kapps/#{kapp_slug}/kappAttributeDefinitions/#{encode(name)}",body, headers)
end

#update_kapp_webhook_job(kapp_slug, job_id, job_properties = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update kapp webhook job

Parameters:

  • kapp_slug (String)

    the Kapp slug

  • job_id (String)

    id of the Job

  • job_properties (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +status+

    • +event+ - "Complete",
    • +id+ - "00000000-0000-1000-8000-000000000000",
    • +name+ - "Foo",
    • +parentId+ - "00000000-0000-1000-8000-000000000000",
    • +requestContent+ - null,
    • +responseContent+ - null,
    • +retryCount+ - 0,
    • +scheduledAt+ - "2016-04-20T12:00:00Z",
    • +scopeId+ - "00000000-0000-1000-8000-000000000000",
    • +scopeType+ - "Kapp",
    • +status+ - "Queued",
    • +summary+ - null,
    • +type+ - "Submission",
    • +url+ - "http://my.server.com/api",
    • +webhookId+ - "00000000-0000-1000-8000-000000000000"
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



136
137
138
139
# File 'lib/kinetic_sdk/core/lib/webhook_jobs.rb', line 136

def update_kapp_webhook_job(kapp_slug, job_id, job_properties={}, headers=default_headers)
  @logger.info("Updating the webhook job #{job_id} in the \"#{kapp_slug}\" Kapp")
  put("#{@api_url}/kapps/#{kapp_slug}/webhookJobs/#{job_id}", job_properties, headers)
end

#update_oauth_client(client_id, options, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update an OAuth client

Parameters:

  • client_id (String)
    • oauth client identifier
  • options (Hash)

    oauth client properties

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



31
32
33
34
# File 'lib/kinetic_sdk/core/lib/oauth.rb', line 31

def update_oauth_client(client_id, options, headers=default_headers)
  @logger.info("Updating the \"#{client_id}\" OAuth client")
  put("#{@api_url}/oauthClients/#{encode(client_id)}", options, headers)
end

#update_security_policy_definition(kapp_slug, name, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a Kapp security policy definition

Parameters:

  • kapp_slug (String)

    slug of the kapp

  • name (String)

    name of the security policy definition

  • body (Hash)

    properties of the security policy definition

    • +name+ - name of the security policy definition
    • +message+ - message for the security policy definition
    • +rule+ - rule for the security policy definition
    • +type+ - type of the security policy definition
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



151
152
153
154
# File 'lib/kinetic_sdk/core/lib/security_policy_definitions.rb', line 151

def update_security_policy_definition(kapp_slug, name, body, headers=default_headers)
  @logger.info("Updating Security Policy Definition \"#{name}\" on the \"#{kapp_slug}\" kapp.")
  put("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions/#{encode(name)}", body, headers)
end

#update_space(body = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a space

Parameters:

  • body (Hash) (defaults to: {})

    properties for the Space

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



52
53
54
55
# File 'lib/kinetic_sdk/core/lib/space.rb', line 52

def update_space(body={}, headers=default_headers)
  @logger.info("Updating Space \"#{@space_slug}\"")
  put("#{@api_url}/space", body, headers)
end

#update_space_attribute_definition(name, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a space attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • body (Hash)

    properties of the attribute definition to update

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



119
120
121
122
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 119

def update_space_attribute_definition(name, body, headers=default_headers)
  @logger.info("Updating the \"#{name}\" Space Attribute Definition.")
  put("#{@api_url}/spaceAttributeDefinitions/#{encode(name)}",body, headers)
end

#update_space_in_system(slug, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update the space (System API)

Parameters:

  • slug (String)

    slug of the space

  • body (Hash)

    updated properties of the space

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



54
55
56
57
# File 'lib/kinetic_sdk/core/lib/system_api.rb', line 54

def update_space_in_system(slug, body, headers=default_headers)
  @logger.info("Updating Space \"#{slug}\"")
  put("#{@api_url}/spaces/#{slug}", body, headers)
end

#update_space_security_policy_definition(name, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a Space security policy definition

Parameters:

  • name (String)

    name of the security policy definition

  • body (Hash)

    properties of the security policy definition

    • +name+ - name of the security policy definition
    • +message+ - message for the security policy definition
    • +rule+ - rule for the security policy definition
    • +type+ - type of the security policy definition
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



71
72
73
74
# File 'lib/kinetic_sdk/core/lib/security_policy_definitions.rb', line 71

def update_space_security_policy_definition(name, body, headers=default_headers)
  @logger.info("Updating Space Security Policy Definition \"#{name}\"")
  put("#{@api_url}/securityPolicyDefinitions/#{encode(name)}", body, headers)
end

#update_space_webhook_job(job_id, job_properties = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update space webhook job

Parameters:

  • job_id (String)

    id of the Job

  • job_properties (Hash) (defaults to: {})

    Query parameters that are added to the URL, such as +status+

    • +event+ - "Complete",
    • +id+ - "00000000-0000-1000-8000-000000000000",
    • +name+ - "Foo",
    • +parentId+ - "00000000-0000-1000-8000-000000000000",
    • +requestContent+ - null,
    • +responseContent+ - null,
    • +retryCount+ - 0,
    • +scheduledAt+ - "2016-04-20T12:00:00Z",
    • +scopeId+ - "00000000-0000-1000-8000-000000000000",
    • +scopeType+ - "Kapp",
    • +status+ - "Queued",
    • +summary+ - null,
    • +type+ - "Submission",
    • +url+ - "http://my.server.com/api",
    • +webhookId+ - "00000000-0000-1000-8000-000000000000"
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



108
109
110
111
# File 'lib/kinetic_sdk/core/lib/webhook_jobs.rb', line 108

def update_space_webhook_job(job_id, job_properties={}, headers=default_headers)
  @logger.info("Updating the webhook job #{job_id} in Space")
  put("#{@api_url}/webhookJobs/#{job_id}", job_properties, headers)
end

#update_submission(submission_id, body = {}, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a submission

Parameters:

  • submission_id (String)

    String value of the Submission Id (UUID)

  • body (Hash) (defaults to: {})

    submission properties to update

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



209
210
211
212
# File 'lib/kinetic_sdk/core/lib/submissions.rb', line 209

def update_submission(submission_id, body={}, headers=default_headers)
  @logger.info("Updating Submission \"#{submission_id}\"")
  put("#{@api_url}/submissions/#{encode(submission_id)}", body, headers)
end

#update_task_component(component_properties, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update Task Component

Parameters:

  • component_properties (Hash)

    the property values for the platform component

    • +url+ - Url to the task component
    • +secret+ - Shared secret used to encrypt traffic between core component and task component
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



23
24
25
26
27
# File 'lib/kinetic_sdk/core/lib/platform_components.rb', line 23

def update_task_component(component_properties, headers = default_headers)
  raise StandardError.new "Task Component properties is not valid, must be a Hash." unless component_properties.is_a? Hash
  @logger.info("Updating Task Platform Component")
  put("#{@api_url}/platformComponents/task", component_properties, headers)
end

#update_team_attribute_definition(name, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a team attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • body (Hash)

    properties of the attribute definition to update

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



179
180
181
182
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 179

def update_team_attribute_definition(name, body, headers=default_headers)
  @logger.info("Updating the \"#{name}\" Team Attribute Definition.")
  put("#{@api_url}/teamAttributeDefinitions/#{encode(name)}",body, headers)
end

#update_user(username, user, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a user in a space.

If the SDK was initialized as a System user, the space_slug property must be provided in the user hash.

If the SDK was initialized as a Space user, the space_slug property is ignored.

Example

update_user("xyz", {
  "space_slug" => "bar",
  "username" => "foo",
  "password" => "bar",
  "displayName" => "Foo",
  "email" => "[email protected]",
  "enabled" => true,
  "preferredLocale" => "en_US",
  "spaceAdmin" => false
})

Parameters:

  • username (String)

    username of the user to update

  • user (Hash)

    user properties to update

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/kinetic_sdk/core/lib/users.rb', line 210

def update_user(username, user, headers=default_headers)
  if !@space_slug.nil?
    @logger.info("Updating user \"#{username}\" for Space \"#{@space_slug}\" as system user.")
    put("#{@api_url}/users/#{encode(username)}", user, headers)
  elsif !user['space_slug'].nil?
    space_slug = user.delete('space_slug')
    @logger.info("Updating user \"#{username}\" for Space \"#{space_slug}\".")
    put("#{@api_url}/spaces/#{space_slug}/users/#{encode(username)}", user, headers)
  else
    raise StandardError.new "The space slug must be supplied to update the user."
  end
end

#update_user_attribute_definition(name, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a user attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • body (Hash)

    properties of the attribute definition to update

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



239
240
241
242
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 239

def update_user_attribute_definition(name, body, headers=default_headers)
  @logger.info("Updating the \"#{name}\" User Attribute Definition.")
  put("#{@api_url}/userAttributeDefinitions/#{encode(name)}",body, headers)
end

#update_user_profile_attribute_definition(name, body, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a user profile attribute definition

Parameters:

  • name (String)

    name of the attribute definition

  • body (Hash)

    properties of the attribute definition to update

  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



299
300
301
302
# File 'lib/kinetic_sdk/core/lib/attribute_definitions.rb', line 299

def (name, body, headers=default_headers)
  @logger.info("Updating the \"#{name}\" User Profile Attribute Definition.")
  put("#{@api_url}/userProfileAttributeDefinitions/#{encode(name)}",body, headers)
end

#update_webhook_on_kapp(kapp_slug, name, webhook_properties, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a webhook on a Kapp (either a Form or Submission webhook)

All of the webhook properties are optional. Only the properties provided in the Hash will be updated, the other properties will retain their current values.

Parameters:

  • kapp_slug (String)

    the Kapp slug

  • name (String)

    the webhook name

  • webhook_properties (Hash)

    hash of webhook properties

    • +event+ - depends on +type+
    • +name+ - A descriptive name for the webhook
    • +filter+ - A javascript expression to determine when the webhook should fire
    • +url+ - URL to post the bindings when the event is triggered
    • +type+ - The type of model the webhook is bound to: Form | Submission
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



165
166
167
168
# File 'lib/kinetic_sdk/core/lib/webhooks.rb', line 165

def update_webhook_on_kapp(kapp_slug, name, webhook_properties, headers=default_headers)
  @logger.info("Updating the \"#{name}\" webhook on the \"#{kapp_slug}\" Kapp")
  put("#{@api_url}/kapps/#{kapp_slug}/webhooks/#{encode(name)}", webhook_properties, headers)
end

#update_webhook_on_space(name, webhook_properties, headers = default_headers) ⇒ KineticSdk::Utils::KineticHttpResponse

Update a webhook on a Space (either a Space or User webhook)

All of the webhook properties are optional. Only the properties provided in the Hash will be updated, the other properties will retain their current values.

Parameters:

  • name (String)

    the webhook name

  • webhook_properties (Hash)

    hash of webhook properties

    • +event+ - depends on +type+
    • +name+ - A descriptive name for the webhook
    • +filter+ - A javascript expression to determine when the webhook should fire
    • +url+ - URL to post the bindings when the event is triggered
    • +type+ - The type of model the webhook is bound to: Space | User
  • headers (Hash) (defaults to: default_headers)

    hash of headers to send, default is basic authentication and accept JSON content type

Returns:



186
187
188
189
# File 'lib/kinetic_sdk/core/lib/webhooks.rb', line 186

def update_webhook_on_space(name, webhook_properties, headers=default_headers)
  @logger.info("Updating the \"#{name}\" webhook on the Space")
  put("#{@api_url}/webhooks/#{encode(name)}", webhook_properties, headers)
end