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

Class Method Details

.create(rn_client, resource, json_content) ⇒ Object



52
53
54
55
56
# File 'lib/osc_ruby/modules/query_module.rb', line 52

def create(rn_client,resource,json_content)

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

end

.destroy(rn_client, resource) ⇒ Object



64
65
66
67
68
# File 'lib/osc_ruby/modules/query_module.rb', line 64

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
30
31
# 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

    puts obj_to_find.body

    obj_to_find.body

  end

end

.nested_find(rn_client, resource) ⇒ Object



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

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

    puts obj_to_find.body

    obj_to_find.body

  end

end

.update(rn_client, resource, json_content) ⇒ Object



58
59
60
61
62
# File 'lib/osc_ruby/modules/query_module.rb', line 58

def update(rn_client,resource,json_content)

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

end