Class: Jat::Plugins::JsonApi::Params::Fields::Validate

Inherits:
Object
  • Object
show all
Defined in:
lib/jat/plugins/json_api/lib/params/fields/validate.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jat, type, full_map) ⇒ Validate

Returns a new instance of Validate.



21
22
23
24
25
# File 'lib/jat/plugins/json_api/lib/params/fields/validate.rb', line 21

def initialize(jat, type, full_map)
  @jat = jat
  @type = type
  @full_map = full_map
end

Instance Attribute Details

#full_mapObject (readonly)

Returns the value of attribute full_map.



19
20
21
# File 'lib/jat/plugins/json_api/lib/params/fields/validate.rb', line 19

def full_map
  @full_map
end

#jatObject (readonly)

Returns the value of attribute jat.



19
20
21
# File 'lib/jat/plugins/json_api/lib/params/fields/validate.rb', line 19

def jat
  @jat
end

#typeObject (readonly)

Returns the value of attribute type.



19
20
21
# File 'lib/jat/plugins/json_api/lib/params/fields/validate.rb', line 19

def type
  @type
end

Class Method Details

.call(jat, fields) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/jat/plugins/json_api/lib/params/fields/validate.rb', line 10

def call(jat, fields)
  full_map = jat.maps.full

  fields.each do |type, attributes_names|
    new(jat, type, full_map).validate(attributes_names)
  end
end

Instance Method Details

#validate(attributes_names) ⇒ Object



27
28
29
30
# File 'lib/jat/plugins/json_api/lib/params/fields/validate.rb', line 27

def validate(attributes_names)
  check_fields_type
  check_attributes_names(attributes_names)
end