Sha256: 57815913acc2768dd51eede548c77e6514510c9715cad3ade4c8dd62e41ef997

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

module RockRMS
  class Client
    module LavaShortcode
      def list_lava_shortcodes(options = {})
        res = get(lava_shortcodes_path, options)
        Response::LavaShortcode.format(res)
      end

      def find_lava_shortcode(id)
        res = get(lava_shortcodes_path(id))
        Response::LavaShortcode.format(res)
      end

      def create_lava_shortcode(
        name:,
        description:,
        documentation:,
        active:,
        is_system:,
        markup:,
        parameters:
      )
        options = {
          'Name' => name,
          'Description' => description,
          'Documentation' => documentation,
          'IsActive' => active,
          'IsSystem' => is_system,
          'Markup' => markup,
          'Parameters' => parameters
        }

        post(lava_shortcodes_path, options)
      end

      def update_lava_shortcode(
        id,
        name: nil,
        description: nil,
        documentation: nil,
        active: nil,
        is_system: nil,
        markup: nil,
        parameters: nil
      )

        options = {}

        options['Name']          = name if name
        options['Description']   = description if description
        options['Documentation'] = documentation if documentation
        options['IsActive']      = active if active
        options['IsSystem']      = is_system if is_system
        options['Markup']        = markup if markup
        options['Parameters']    = parameters if parameters

        patch(lava_shortcodes_path(id), options)
      end

      private

      def lava_shortcodes_path(id = nil)
        id ? "LavaShortcodes/#{id}" : 'LavaShortcodes'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rock_rms-8.14.0 lib/rock_rms/resources/lava_shortcodes.rb