Module: RockRMS::Client::LavaShortcode

Included in:
RockRMS::Client
Defined in:
lib/rock_rms/resources/lava_shortcode.rb

Instance Method Summary collapse

Instance Method Details

#create_lava_shortcode(name:, description:, documentation:, active:, is_system:, markup:, enabled_lava_commands:, parameters:, tag_name:, tag_type:, foreign_key: nil) ⇒ Object



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
# File 'lib/rock_rms/resources/lava_shortcode.rb', line 14

def create_lava_shortcode(
  name:,
  description:,
  documentation:,
  active:,
  is_system:,
  markup:,
  enabled_lava_commands:,
  parameters:,
  tag_name:,
  tag_type:,
  foreign_key: nil
)
  options = {
    'Name' => name,
    'Description' => description,
    'Documentation' => documentation,
    'IsActive' => active,
    'IsSystem' => is_system,
    'Markup' => markup,
    'EnabledLavaCommands' => enabled_lava_commands,
    'Parameters' => parameters,
    'TagName' => tag_name,
    'TagType' => tag_type,
    'ForeignKey' => foreign_key
  }

  post(lava_shortcodes_path, options)
end

#find_lava_shortcode(id) ⇒ Object



9
10
11
12
# File 'lib/rock_rms/resources/lava_shortcode.rb', line 9

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

#list_lava_shortcodes(options = {}) ⇒ Object



4
5
6
7
# File 'lib/rock_rms/resources/lava_shortcode.rb', line 4

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

#update_lava_shortcode(id, name: nil, description: nil, documentation: nil, active: nil, is_system: nil, markup: nil, enabled_lava_commands: nil, parameters: nil, tag_name: nil, tag_type: nil, foreign_key: nil) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/rock_rms/resources/lava_shortcode.rb', line 44

def update_lava_shortcode(
  id,
  name: nil,
  description: nil,
  documentation: nil,
  active: nil,
  is_system: nil,
  markup: nil,
  enabled_lava_commands: nil,
  parameters: nil,
  tag_name: nil,
  tag_type: nil,
  foreign_key: nil
)

  options = {}

  options['Name']          = name          if name
  options['Description']   = description   if description
  options['Documentation'] = documentation if documentation
  options['IsActive']      = active        unless active.nil?
  options['IsSystem']      = is_system     unless is_system.nil?
  options['Markup']        = markup        if markup
  options['Parameters']    = parameters    if parameters
  options['TagName']       = tag_name      if tag_name
  options['TagType']       = tag_type      if tag_type
  options['ForeignKey']    = foreign_key   if foreign_key
  options['EnabledLavaCommands'] = enabled_lava_commands if enabled_lava_commands

  patch(lava_shortcodes_path(id), options)
end