Method: BlackStack::Workmesh::Protocol.descriptor_errors
- Defined in:
- lib/workmesh.rb
.descriptor_errors(h) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/workmesh.rb', line 67 def self.descriptor_errors(h) errors = [] # validate: the key :name exists and is a string errors << "The key :name is missing" if h[:name].nil? errors << "The key :name must be an String" unless h[:name].is_a?(String) # validate: the key :entity_table exists and is an symbol errors << "The key :entity_table is missing" if h[:entity_table].nil? errors << "The key :entity_table must be an Symbol" unless h[:entity_table].is_a?(Symbol) # validate: the key :entity_field_id exists and is an symbol errors << "The key :entity_field_id is missing" if h[:entity_field_id].nil? errors << "The key :entity_field_id must be an Symbol" unless h[:entity_field_id].is_a?(Symbol) # validate: the key :entity_field_sort exists and is an symbol errors << "The key :entity_field_sort is missing" if h[:entity_field_sort].nil? errors << "The key :entity_field_sort must be an Symbol" unless h[:entity_field_sort].is_a?(Symbol) # validate: the key :push_function is null or it is a procedure #errors << "The key :push_function must be an Symbol" unless h[:push_function].nil? || h[:push_function].is_a?() # validate: if :push_function exists, the key :entity_field_push_time exists and it is a symbol errors << "The key :entity_field_push_time is missing" if h[:push_function] && h[:entity_field_push_time].nil? # validate: if :push_function exists, the key :entity_field_push_success exists and it is a symbol errors << "The key :entity_field_push_success is missing" if h[:push_function] && h[:entity_field_push_success].nil? # validate: if :push_function exists, the key :entity_field_push_error_description exists and it is a symbol errors << "The key :entity_field_push_error_description is missing" if h[:push_function] && h[:entity_field_push_error_description].nil? # valiudate: if :pull_function exists, the key :pull_status_access_point exists and it is a string #errors << "The key :pull_status_access_point is missing" if h[:pull_function] && h[:pull_status_access_point].nil? #errors << "The key :pull_status_access_point must be an String" unless h[:pull_function].nil? || h[:pull_status_access_point].is_a?(String) # validate: if :pull_function exists, the key :entity_field_pull_time exists and it is a symbol #errors << "The key :entity_field_pull_time is missing" if h[:pull_function] && h[:entity_field_pull_time].nil? # validate: if :pull_function exists, the key :entity_field_pull_success exists and it is a symbol #errors << "The key :entity_field_pull_success is missing" if h[:pull_function] && h[:entity_field_pull_success].nil? # validate: if :pull_function exists, the key :entity_field_pull_error_description exists and it is a symbol #errors << "The key :entity_field_pull_error_description is missing" if h[:pull_function] && h[:entity_field_pull_error_description].nil? # return list of errors errors.uniq end |