Class: MarketoAPI::MObject::Criteria
- Inherits:
-
Object
- Object
- MarketoAPI::MObject::Criteria
- Defined in:
- lib/marketo_api/mobject.rb
Overview
:nodoc:
Constant Summary collapse
- TYPES =
:nodoc:
{ #:nodoc: name: "Name", role: "Role", type: "Type", stage: "Stage", crm_id: "CRM Id", created_at: "Created At", updated_at: "Updated At", tag_type: "Tag Type", tag_value: "Tag Value", workspace_name: "Workspace Name", workspace_id: "Workspace Id", include_archive: "Include Archive" }.freeze
- CMP =
:nodoc:
[ #:nodoc: :EQ, :NE, :LT, :LE, :GT, :GE ]
Instance Attribute Summary collapse
-
#comparison ⇒ Object
readonly
Returns the value of attribute comparison.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, value, comparison) ⇒ Criteria
constructor
A new instance of Criteria.
- #to_h ⇒ Object
Constructor Details
#initialize(name, value, comparison) ⇒ Criteria
Returns a new instance of Criteria.
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/marketo_api/mobject.rb', line 195 def initialize(name, value, comparison) name = if TYPES.has_key?(name.to_sym) TYPES[name.to_sym] elsif TYPES.values.include?(name) TYPES.values[TYPES.values.index(name)] else raise ArgumentError, "Invalid type name [#{name}]" end unless CMP.include?(comparison.to_s.to_sym.upcase) raise ArgumentError, "Invalid comparison [#{comparison}]" end @name, @value, @comparison = name, value, comparison.to_sym.upcase end |
Instance Attribute Details
#comparison ⇒ Object (readonly)
Returns the value of attribute comparison.
193 194 195 |
# File 'lib/marketo_api/mobject.rb', line 193 def comparison @comparison end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
193 194 195 |
# File 'lib/marketo_api/mobject.rb', line 193 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
193 194 195 |
# File 'lib/marketo_api/mobject.rb', line 193 def value @value end |
Instance Method Details
#==(other) ⇒ Object
211 212 213 214 |
# File 'lib/marketo_api/mobject.rb', line 211 def ==(other) name.equal?(other.name) && comparison.equal?(other.comparison) && value == other.value? end |
#to_h ⇒ Object
216 217 218 219 220 221 222 |
# File 'lib/marketo_api/mobject.rb', line 216 def to_h { attrName: name, attrValue: value, comparison: comparison } end |