Class: AutotaskApi::Expression

Inherits:
Object
  • Object
show all
Defined in:
lib/autotask_api/query.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, operator, value) ⇒ Expression

Returns a new instance of Expression.



77
78
79
80
81
# File 'lib/autotask_api/query.rb', line 77

def initialize(field, operator, value)
  @field = field
  @operator = operator
  @value = value
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



75
76
77
# File 'lib/autotask_api/query.rb', line 75

def field
  @field
end

#operatorObject (readonly)

Returns the value of attribute operator.



75
76
77
# File 'lib/autotask_api/query.rb', line 75

def operator
  @operator
end

#valueObject (readonly)

Returns the value of attribute value.



75
76
77
# File 'lib/autotask_api/query.rb', line 75

def value
  @value
end

Class Method Details

.from_hash(expression = {}) ⇒ Object



89
90
91
# File 'lib/autotask_api/query.rb', line 89

def self.from_hash(expression = {})
  new(expression[:field], expression[:operator], expression[:value])
end

Instance Method Details

#to_xml(xml) ⇒ Object



83
84
85
86
87
# File 'lib/autotask_api/query.rb', line 83

def to_xml(xml)
  xml.field field do
    xml.expression value, op: operator
  end
end