Class: WatchList::DSL::Context::Monitor::Keyword

Inherits:
HTTP
  • Object
show all
Defined in:
lib/watch_list/dsl/context/monitor/keyword.rb

Constant Summary

Constants inherited from Type

Type::CHILDREN

Instance Method Summary collapse

Methods inherited from HTTP

#httppassword, #httpusername

Methods inherited from Type

[], inherited, #initialize

Constructor Details

This class inherits a constructor from WatchList::DSL::Context::Monitor::Type

Instance Method Details

#keywordtype(value) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/watch_list/dsl/context/monitor/keyword.rb', line 11

def keywordtype(value)
  if value.kind_of?(Integer)
    type = value
  else
    type = WatchList::Monitor::KeywordType[value.to_s]
  end

  unless WatchList::Monitor::KeywordType.values.include?(type)
    raise %!Monitor `#{@monitor_name}`: "keywordtype" is invalid: #{value.inspect}!
  end

  @result[:KeywordType] = type
end

#keywordvalue(value) ⇒ Object



25
26
27
28
# File 'lib/watch_list/dsl/context/monitor/keyword.rb', line 25

def keywordvalue(value)
  raise %!Monitor `#{@monitor_name}`: "keywordvalue" is invalid: #{value.inspect}! if value.nil?
  @result[:KeywordValue] = value.to_s
end

#resultObject



3
4
5
6
7
8
9
# File 'lib/watch_list/dsl/context/monitor/keyword.rb', line 3

def result
  [:KeywordType, :KeywordValue].each do |key|
    raise %!Monitor `#{@monitor_name}`: "#{key.to_s.downcase}" is required! unless @result[key]
  end

  super
end