Module: OSCRuby::QueryModule

Extended by:
NormalizeModule, ValidationsModule
Included in:
QueryResults
Defined in:
lib/osc_ruby/modules/query_module.rb

Class Method Summary collapse

Methods included from ValidationsModule

attr_hash_exists_and_is_type_of, check_attributes, check_attributes_request, check_client, check_for_id, check_for_names, check_for_parents, check_interfaces, check_obj_for_errors, check_object_for_id, check_query, extract_attributes

Methods included from NormalizeModule

nested_normalize, normalize, query_injection, remove_new_lines

Class Method Details

.create(rn_client, resource, json_content) ⇒ Object



48
49
50
51
52
# File 'lib/osc_ruby/modules/query_module.rb', line 48

def create(rn_client,resource,json_content)

  OSCRuby::Connect.post_or_patch(rn_client,resource,json_content)

end

.destroy(rn_client, resource) ⇒ Object



60
61
62
63
64
# File 'lib/osc_ruby/modules/query_module.rb', line 60

def destroy(rn_client,resource)

  OSCRuby::Connect.delete(rn_client,resource)
  
end

.find(rn_client, resource) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/osc_ruby/modules/query_module.rb', line 14

def find(rn_client,resource)

  obj_to_find = OSCRuby::Connect.get(rn_client,resource)

  if obj_to_find.code.to_i == 200 || obj_to_find.code.to_i == 201

    ValidationsModule::check_obj_for_errors(obj_to_find)

    NormalizeModule::normalize(obj_to_find,resource)
  else

    obj_to_find.body

  end

end

.nested_find(rn_client, resource) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/osc_ruby/modules/query_module.rb', line 31

def nested_find(rn_client,resource)

  obj_to_find = OSCRuby::Connect.get(rn_client,resource)

  if obj_to_find.code.to_i == 200 || obj_to_find.code.to_i == 201

    ValidationsModule::check_obj_for_errors(obj_to_find)

    NormalizeModule::nested_normalize(obj_to_find,resource)
  else

    obj_to_find.body

  end

end

.update(rn_client, resource, json_content) ⇒ Object



54
55
56
57
58
# File 'lib/osc_ruby/modules/query_module.rb', line 54

def update(rn_client,resource,json_content)

  OSCRuby::Connect.post_or_patch(rn_client,resource,json_content,true)

end