Sha256: 936a8ba9f805395cec494bbecfb1835791eb42e7daa5fb7764a98dea4c6142ff

Contents?: true

Size: 1.8 KB

Versions: 12

Compression:

Stored size: 1.8 KB

Contents

module KineticSdk
  class Core

    # Add a category on a Kapp
    #
    # @param kapp_slug [String] slug of the Kapp the category belongs to
    # @param body [Hash] category properties
    #   - +name+ - A descriptive name for the category
    # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
    # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
    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 a categorization on a form
    #
    # @param kapp_slug [String] slug of the Kapp the category belongs to
    # @param 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
    # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
    # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
    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

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
kinetic_sdk-5.0.4 lib/kinetic_sdk/core/lib/categories.rb
kinetic_sdk-5.0.3 lib/kinetic_sdk/core/lib/categories.rb
kinetic_sdk-5.0.2 lib/kinetic_sdk/core/lib/categories.rb
kinetic_sdk-5.0.2.beta.4 lib/kinetic_sdk/core/lib/categories.rb
kinetic_sdk-5.0.2.beta.3 lib/kinetic_sdk/core/lib/categories.rb
kinetic_sdk-5.0.2.beta.2 lib/kinetic_sdk/core/lib/categories.rb
kinetic_sdk-5.0.2.beta.1 lib/kinetic_sdk/core/lib/categories.rb
kinetic_sdk-5.0.1 lib/kinetic_sdk/core/lib/categories.rb
kinetic_sdk-5.0.0 lib/kinetic_sdk/core/lib/categories.rb
kinetic_sdk-1.0.2 lib/kinetic_sdk/core/lib/categories.rb
kinetic_sdk-1.0.1 lib/kinetic_sdk/core/lib/categories.rb
kinetic_sdk-1.0.0 lib/kinetic_sdk/core/lib/categories.rb