Class: NDFD::Client::QueryProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/ndfd/client/query/query_property.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attr, parameters = {}) ⇒ QueryProperty

Returns a new instance of QueryProperty.


6
7
8
9
10
11
12
13
# File 'lib/ndfd/client/query/query_property.rb', line 6

def initialize(attr, parameters = {})
  @name          = attr
  @default       = parameters[:default]
  @options       = parameters[:options]
  @type          = parameters[:type] || String
  @required      = parameters[:required] || false
  @required_keys = parameters[:required_keys] || []
end

Instance Attribute Details

#defaultObject

Returns the value of attribute default


4
5
6
# File 'lib/ndfd/client/query/query_property.rb', line 4

def default
  @default
end

#nameObject

Returns the value of attribute name


4
5
6
# File 'lib/ndfd/client/query/query_property.rb', line 4

def name
  @name
end

#optionsObject

Returns the value of attribute options


4
5
6
# File 'lib/ndfd/client/query/query_property.rb', line 4

def options
  @options
end

#requiredObject

Returns the value of attribute required


4
5
6
# File 'lib/ndfd/client/query/query_property.rb', line 4

def required
  @required
end

#required_keysObject

Returns the value of attribute required_keys


4
5
6
# File 'lib/ndfd/client/query/query_property.rb', line 4

def required_keys
  @required_keys
end

#typeObject

Returns the value of attribute type


4
5
6
# File 'lib/ndfd/client/query/query_property.rb', line 4

def type
  @type
end

Instance Method Details

#valid?(conditions) ⇒ Boolean

Returns:

  • (Boolean)

15
16
17
18
19
20
21
22
# File 'lib/ndfd/client/query/query_property.rb', line 15

def valid?(conditions)
  @conditions = conditions

  validate_required
  validate_type
  validate_required_keys
  validate_options
end