Class: SoftLayer::ObjectFilterOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/softlayer/ObjectFilter.rb

Overview

A class whose instances represent an Object Filter operation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operator, value) ⇒ ObjectFilterOperation

Returns a new instance of ObjectFilterOperation.

Raises:

  • (ArgumentException)


43
44
45
46
47
48
49
# File 'lib/softlayer/ObjectFilter.rb', line 43

def initialize(operator, value)
  raise ArgumentException, "An unknown operator was given" if !OBJECT_FILTER_OPERATORS.include?(operator.strip)
  raise ArgumentException, "Expected a value" if value.nil? || (value.respond_to?(:empty?) && value.empty?)

  @operator = operator.strip
  @value = value.strip
end

Instance Attribute Details

#operatorObject (readonly)

Returns the value of attribute operator.



40
41
42
# File 'lib/softlayer/ObjectFilter.rb', line 40

def operator
  @operator
end

#valueObject (readonly)

Returns the value of attribute value.



41
42
43
# File 'lib/softlayer/ObjectFilter.rb', line 41

def value
  @value
end

Instance Method Details

#to_hObject



51
52
53
# File 'lib/softlayer/ObjectFilter.rb', line 51

def to_h
  { 'operation' => "#{operator} #{value}"}
end