osc_ruby 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/osc_ruby/{answer.rb → classes/answer.rb} +3 -0
- data/lib/osc_ruby/classes/incident.rb +13 -0
- data/lib/osc_ruby/classes/query_results.rb +61 -0
- data/lib/osc_ruby/{service_class.rb → classes/service_class.rb} +4 -4
- data/lib/osc_ruby/{class_factory_module.rb → modules/class_factory_module.rb} +10 -10
- data/lib/osc_ruby/modules/nested_resource_module.rb +10 -0
- data/lib/osc_ruby/{query_module.rb → modules/normalize_module.rb} +32 -47
- data/lib/osc_ruby/modules/query_module.rb +70 -0
- data/lib/osc_ruby/{validations_module.rb → modules/validations_module.rb} +14 -0
- data/lib/osc_ruby/version.rb +1 -1
- data/lib/osc_ruby.rb +7 -7
- data/spec/core/answer_spec.rb +11 -0
- data/spec/core/query_results_spec.rb +54 -0
- metadata +15 -13
- data/lib/osc_ruby/incident.rb +0 -0
- data/lib/osc_ruby/query_results.rb +0 -39
- /data/lib/osc_ruby/{account.rb → classes/account.rb} +0 -0
- /data/lib/osc_ruby/{product_category_shared.rb → classes/product_category_shared.rb} +0 -0
- /data/lib/osc_ruby/{service_category.rb → classes/service_category.rb} +0 -0
- /data/lib/osc_ruby/{service_product.rb → classes/service_product.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcd220980ce2649919596ac53c856ab62f7b99e0
|
4
|
+
data.tar.gz: 311d5a6749cf7e471413b393dda6415fb4826536
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8382c574776ac272cbf0c92d2dff5c128dd7405341433e875df5e9923922acdb30f6b991d7c69612ceeb3ad2a356768e405b7d46c4ca7c694d0f4d9f969f6936
|
7
|
+
data.tar.gz: e27f0bd63323b296b7a974692827a265f4f15395d80c292f115642592e9fa71133d983a3bf25a4e6f551a30971c23f9e8b0931bdc4999313f8d224084115d6b6
|
@@ -1,6 +1,9 @@
|
|
1
|
+
require 'osc_ruby/modules/nested_resource_module'
|
2
|
+
|
1
3
|
module OSCRuby
|
2
4
|
|
3
5
|
class Answer < ServiceClass
|
6
|
+
include NestedResourceModule
|
4
7
|
|
5
8
|
attr_accessor :answerType, :language, :summary, :id, :lookupName, :createdTime, :updatedTime, :accessLevels, :name, :adminLastAccessTime, :expiresDate, :guidedAssistance, :keywords, :lastAccessTime, :lastNotificationTime, :nextNotificationTime, :originalReferenceNumber, :positionInList,
|
6
9
|
:publishOnDate, :question, :solution, :updatedByAccount, :uRL, :categories
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'osc_ruby/connect'
|
2
|
+
require 'osc_ruby/modules/validations_module'
|
3
|
+
require 'osc_ruby/modules/normalize_module'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module OSCRuby
|
7
|
+
|
8
|
+
class QueryResults
|
9
|
+
|
10
|
+
include QueryModule
|
11
|
+
include ValidationsModule
|
12
|
+
|
13
|
+
def initialize; end
|
14
|
+
|
15
|
+
def query(client,query,return_json = false)
|
16
|
+
|
17
|
+
ValidationsModule::check_client(client)
|
18
|
+
|
19
|
+
ValidationsModule::check_query(query,"query")
|
20
|
+
|
21
|
+
@query = URI.escape("queryResults/?query=#{query}")
|
22
|
+
|
23
|
+
response = QueryModule::find(client,@query)
|
24
|
+
|
25
|
+
json_response = JSON.parse(response)
|
26
|
+
|
27
|
+
json_response.unshift("\n")
|
28
|
+
|
29
|
+
if return_json == true
|
30
|
+
json_response_final = NormalizeModule::query_injection(query,json_response)
|
31
|
+
puts json_response_final
|
32
|
+
end
|
33
|
+
|
34
|
+
NormalizeModule::remove_new_lines(json_response)
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def nested_query(client,query,return_json = false)
|
39
|
+
|
40
|
+
ValidationsModule::check_client(client)
|
41
|
+
|
42
|
+
ValidationsModule::check_query(query,"query")
|
43
|
+
|
44
|
+
@query = URI.escape("queryResults/?query=#{query}")
|
45
|
+
|
46
|
+
response = QueryModule::nested_find(client,@query)
|
47
|
+
|
48
|
+
json_response = JSON.parse(response)
|
49
|
+
|
50
|
+
if return_json == true
|
51
|
+
json_response_final = NormalizeModule::query_injection(query,json_response)
|
52
|
+
puts json_response_final
|
53
|
+
end
|
54
|
+
|
55
|
+
NormalizeModule::remove_new_lines(json_response)
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'osc_ruby/client'
|
2
|
-
require 'osc_ruby/query_module'
|
3
|
-
require 'osc_ruby/validations_module'
|
4
|
-
require 'osc_ruby/class_factory_module'
|
2
|
+
require 'osc_ruby/modules/query_module'
|
3
|
+
require 'osc_ruby/modules/validations_module'
|
4
|
+
require 'osc_ruby/modules/class_factory_module'
|
5
5
|
require 'json'
|
6
6
|
require 'uri'
|
7
|
-
require_relative '
|
7
|
+
require_relative '../../ext/string.rb'
|
8
8
|
|
9
9
|
module OSCRuby
|
10
10
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'osc_ruby/connect'
|
2
|
-
require 'osc_ruby/validations_module'
|
2
|
+
require 'osc_ruby/modules/validations_module'
|
3
3
|
require 'json'
|
4
4
|
|
5
5
|
module OSCRuby
|
@@ -8,7 +8,7 @@ module OSCRuby
|
|
8
8
|
|
9
9
|
class << self
|
10
10
|
|
11
|
-
def new_from_fetch(attributes,class_name)
|
11
|
+
def new_from_fetch(attributes,class_name,custom_or_nested = nil)
|
12
12
|
|
13
13
|
ValidationsModule.check_attributes(attributes)
|
14
14
|
|
@@ -40,7 +40,7 @@ module OSCRuby
|
|
40
40
|
|
41
41
|
end
|
42
42
|
|
43
|
-
def find(client,id,obj_query,return_json,class_name)
|
43
|
+
def find(client,id,obj_query,return_json,class_name,custom_or_nested = nil)
|
44
44
|
|
45
45
|
ValidationsModule::check_client(client)
|
46
46
|
|
@@ -60,13 +60,13 @@ module OSCRuby
|
|
60
60
|
|
61
61
|
class_json_final = JSON.parse(class_json)
|
62
62
|
|
63
|
-
ClassFactoryModule::new_from_fetch(class_json_final[0],class_name)
|
63
|
+
ClassFactoryModule::new_from_fetch(class_json_final[0],class_name,custom_or_nested = nil)
|
64
64
|
|
65
65
|
end
|
66
66
|
|
67
67
|
end
|
68
68
|
|
69
|
-
def all(client,obj_query,return_json,class_name)
|
69
|
+
def all(client,obj_query,return_json,class_name,custom_or_nested = nil)
|
70
70
|
|
71
71
|
ValidationsModule::check_client(client)
|
72
72
|
|
@@ -74,11 +74,11 @@ module OSCRuby
|
|
74
74
|
|
75
75
|
object_json = QueryModule::find(client,resource)
|
76
76
|
|
77
|
-
ClassFactoryModule::instantiate_multiple_objects(return_json, object_json, class_name)
|
77
|
+
ClassFactoryModule::instantiate_multiple_objects(return_json, object_json, class_name,custom_or_nested = nil)
|
78
78
|
|
79
79
|
end
|
80
80
|
|
81
|
-
def where(client,query,object_in_query,return_json,class_name)
|
81
|
+
def where(client,query,object_in_query,return_json,class_name,custom_or_nested = nil)
|
82
82
|
|
83
83
|
ValidationsModule::check_client(client)
|
84
84
|
|
@@ -88,7 +88,7 @@ module OSCRuby
|
|
88
88
|
|
89
89
|
object_json = QueryModule::find(client,@query)
|
90
90
|
|
91
|
-
ClassFactoryModule::instantiate_multiple_objects(return_json, object_json, class_name)
|
91
|
+
ClassFactoryModule::instantiate_multiple_objects(return_json, object_json, class_name,custom_or_nested = nil)
|
92
92
|
|
93
93
|
end
|
94
94
|
|
@@ -140,7 +140,7 @@ module OSCRuby
|
|
140
140
|
|
141
141
|
end
|
142
142
|
|
143
|
-
def instantiate_multiple_objects(return_json, object_json, class_name)
|
143
|
+
def instantiate_multiple_objects(return_json, object_json, class_name,custom_or_nested = nil)
|
144
144
|
|
145
145
|
if return_json == true
|
146
146
|
|
@@ -150,7 +150,7 @@ module OSCRuby
|
|
150
150
|
|
151
151
|
object_json_final = JSON.parse(object_json)
|
152
152
|
|
153
|
-
object_json_final.map { |attributes| ClassFactoryModule::new_from_fetch(attributes,class_name) }
|
153
|
+
object_json_final.map { |attributes| ClassFactoryModule::new_from_fetch(attributes,class_name,custom_or_nested = nil) }
|
154
154
|
|
155
155
|
end
|
156
156
|
|
@@ -1,53 +1,52 @@
|
|
1
|
-
require 'osc_ruby/connect'
|
2
|
-
require 'osc_ruby/validations_module'
|
3
|
-
require_relative '../ext/string'
|
4
|
-
|
5
1
|
require 'json'
|
6
2
|
|
7
3
|
module OSCRuby
|
8
4
|
|
9
|
-
module
|
5
|
+
module NormalizeModule
|
10
6
|
|
11
7
|
class << self
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
def find(rn_client,resource)
|
16
|
-
|
17
|
-
obj_to_find = OSCRuby::Connect.get(rn_client,resource)
|
9
|
+
def normalize(input,resource)
|
18
10
|
|
19
|
-
if
|
11
|
+
if input.code.to_i == 404
|
20
12
|
|
21
|
-
|
13
|
+
input.body
|
22
14
|
|
23
|
-
normalize(obj_to_find,resource)
|
24
15
|
else
|
25
16
|
|
26
|
-
|
17
|
+
json_input = JSON.parse(input.body)
|
18
|
+
|
19
|
+
final_hash = []
|
27
20
|
|
28
|
-
|
21
|
+
json_input['items'].each do |item|
|
29
22
|
|
30
|
-
|
23
|
+
item['rows'].each_with_index do |row,row_i|
|
31
24
|
|
32
|
-
|
25
|
+
obj_hash = {}
|
26
|
+
|
27
|
+
item['columnNames'].each_with_index do |column,i|
|
28
|
+
obj_hash[column] = if !row[i].nil? && row[i].is_i? == true then row[i].to_i else row[i] end
|
29
|
+
end
|
33
30
|
|
34
|
-
|
31
|
+
final_hash.push(obj_hash)
|
35
32
|
|
36
|
-
|
33
|
+
if json_input['items'].count > 1 && (item['rows'].count-1 <= row_i)
|
37
34
|
|
38
|
-
|
35
|
+
final_hash.push("\n")
|
39
36
|
|
40
|
-
|
37
|
+
end
|
41
38
|
|
42
|
-
|
39
|
+
end
|
43
40
|
|
44
|
-
|
41
|
+
end
|
42
|
+
|
43
|
+
final_hash.to_json
|
44
|
+
|
45
|
+
end
|
45
46
|
|
46
|
-
OSCRuby::Connect.delete(rn_client,resource)
|
47
|
-
|
48
47
|
end
|
49
48
|
|
50
|
-
def
|
49
|
+
def nested_normalize(input,resource)
|
51
50
|
|
52
51
|
if input.code.to_i == 404
|
53
52
|
|
@@ -61,6 +60,8 @@ module OSCRuby
|
|
61
60
|
|
62
61
|
json_input['items'].each do |item|
|
63
62
|
|
63
|
+
item_array = []
|
64
|
+
|
64
65
|
item['rows'].each_with_index do |row,row_i|
|
65
66
|
|
66
67
|
obj_hash = {}
|
@@ -69,36 +70,22 @@ module OSCRuby
|
|
69
70
|
obj_hash[column] = if !row[i].nil? && row[i].is_i? == true then row[i].to_i else row[i] end
|
70
71
|
end
|
71
72
|
|
72
|
-
|
73
|
-
|
74
|
-
if json_input['items'].count > 1 && (item['rows'].count-1 <= row_i)
|
75
|
-
|
76
|
-
final_hash.push("\n")
|
77
|
-
|
78
|
-
end
|
73
|
+
item_array.push(obj_hash)
|
79
74
|
|
80
75
|
end
|
81
76
|
|
77
|
+
final_hash.push(item_array)
|
78
|
+
|
82
79
|
end
|
83
80
|
|
81
|
+
puts JSON.pretty_generate(final_hash)
|
82
|
+
|
84
83
|
final_hash.to_json
|
85
84
|
|
86
85
|
end
|
87
86
|
|
88
87
|
end
|
89
88
|
|
90
|
-
def check_obj_for_errors(obj_to_check)
|
91
|
-
|
92
|
-
json_obj = JSON.parse(obj_to_check.body)
|
93
|
-
|
94
|
-
if !json_obj.nil? && json_obj['items'][0]['rows'].count == 0
|
95
|
-
|
96
|
-
raise ArgumentError, 'There were no objects matching your query; please try again.'
|
97
|
-
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
101
|
-
|
102
89
|
def query_injection(query,json_response)
|
103
90
|
|
104
91
|
queries = query.split(';')
|
@@ -131,7 +118,5 @@ module OSCRuby
|
|
131
118
|
end
|
132
119
|
|
133
120
|
end
|
134
|
-
|
135
121
|
end
|
136
|
-
|
137
122
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'osc_ruby/connect'
|
2
|
+
require 'osc_ruby/modules/validations_module'
|
3
|
+
require 'osc_ruby/modules/normalize_module'
|
4
|
+
require_relative '../../ext/string.rb'
|
5
|
+
|
6
|
+
module OSCRuby
|
7
|
+
|
8
|
+
module QueryModule
|
9
|
+
|
10
|
+
class << self
|
11
|
+
|
12
|
+
include ValidationsModule, NormalizeModule
|
13
|
+
|
14
|
+
def find(rn_client,resource)
|
15
|
+
|
16
|
+
obj_to_find = OSCRuby::Connect.get(rn_client,resource)
|
17
|
+
|
18
|
+
if obj_to_find.code.to_i == 200 || obj_to_find.code.to_i == 201
|
19
|
+
|
20
|
+
ValidationsModule::check_obj_for_errors(obj_to_find)
|
21
|
+
|
22
|
+
NormalizeModule::normalize(obj_to_find,resource)
|
23
|
+
else
|
24
|
+
|
25
|
+
obj_to_find.body
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
def nested_find(rn_client,resource)
|
32
|
+
|
33
|
+
obj_to_find = OSCRuby::Connect.get(rn_client,resource)
|
34
|
+
|
35
|
+
if obj_to_find.code.to_i == 200 || obj_to_find.code.to_i == 201
|
36
|
+
|
37
|
+
ValidationsModule::check_obj_for_errors(obj_to_find)
|
38
|
+
|
39
|
+
NormalizeModule::nested_normalize(obj_to_find,resource)
|
40
|
+
else
|
41
|
+
|
42
|
+
obj_to_find.body
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def create(rn_client,resource,json_content)
|
49
|
+
|
50
|
+
OSCRuby::Connect.post_or_patch(rn_client,resource,json_content)
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
def update(rn_client,resource,json_content)
|
55
|
+
|
56
|
+
OSCRuby::Connect.post_or_patch(rn_client,resource,json_content,true)
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
def destroy(rn_client,resource)
|
61
|
+
|
62
|
+
OSCRuby::Connect.delete(rn_client,resource)
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -139,6 +139,20 @@ module OSCRuby
|
|
139
139
|
|
140
140
|
end
|
141
141
|
|
142
|
+
def check_obj_for_errors(obj_to_check)
|
143
|
+
|
144
|
+
json_obj = JSON.parse(obj_to_check.body)
|
145
|
+
|
146
|
+
if !json_obj.nil? && json_obj['items'][0]['rows'].count == 0
|
147
|
+
|
148
|
+
puts obj_to_check.body
|
149
|
+
|
150
|
+
raise ArgumentError, 'There were no objects matching your query; please try again.'
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
155
|
+
|
142
156
|
end
|
143
157
|
|
144
158
|
end
|
data/lib/osc_ruby/version.rb
CHANGED
data/lib/osc_ruby.rb
CHANGED
@@ -2,10 +2,10 @@ module OSCRuby; end
|
|
2
2
|
|
3
3
|
require 'osc_ruby/client'
|
4
4
|
require 'osc_ruby/connect'
|
5
|
-
require 'osc_ruby/service_class'
|
6
|
-
require 'osc_ruby/product_category_shared'
|
7
|
-
require 'osc_ruby/service_product'
|
8
|
-
require 'osc_ruby/service_category'
|
9
|
-
require 'osc_ruby/answer'
|
10
|
-
require 'osc_ruby/account'
|
11
|
-
require 'osc_ruby/query_results'
|
5
|
+
require 'osc_ruby/classes/service_class'
|
6
|
+
require 'osc_ruby/classes/product_category_shared'
|
7
|
+
require 'osc_ruby/classes/service_product'
|
8
|
+
require 'osc_ruby/classes/service_category'
|
9
|
+
require 'osc_ruby/classes/answer'
|
10
|
+
require 'osc_ruby/classes/account'
|
11
|
+
require 'osc_ruby/classes/query_results'
|
data/spec/core/answer_spec.rb
CHANGED
@@ -216,6 +216,17 @@ describe OSCRuby::Answer do
|
|
216
216
|
|
217
217
|
end
|
218
218
|
|
219
|
+
# it 'should be able to set the status of an answer', do
|
220
|
+
|
221
|
+
# new_answer.language['id'] = 1
|
222
|
+
# new_answer.answerType['lookupName'] = "HTML"
|
223
|
+
|
224
|
+
# new_answer.create(client)
|
225
|
+
|
226
|
+
# expect(new_answer).to be_a(OSCRuby::Answer)
|
227
|
+
|
228
|
+
# end
|
229
|
+
|
219
230
|
|
220
231
|
it 'should return the body object if the json_response param is set to true', :vcr do
|
221
232
|
|
@@ -21,6 +21,38 @@ describe OSCRuby::QueryResults do
|
|
21
21
|
OSCRuby::QueryResults.new
|
22
22
|
}
|
23
23
|
|
24
|
+
|
25
|
+
|
26
|
+
let(:table){ "answers" }
|
27
|
+
let(:nested_attributes){
|
28
|
+
[ "*",
|
29
|
+
"accessLevels.namedIDList.*",
|
30
|
+
"answerType.*",
|
31
|
+
"assignedTo.account.*",
|
32
|
+
"assignedTo.staffGroup.*",
|
33
|
+
"banner.*",
|
34
|
+
"banner.importanceFlag.*",
|
35
|
+
"banner.updatedByAccount.*",
|
36
|
+
"categories.categoriesList.*",
|
37
|
+
"commonAttachments.fileAttachmentList.*",
|
38
|
+
"commonAttachments.fileAttachmentList.names.labelList.labelText",
|
39
|
+
"commonAttachments.fileAttachmentList.names.labelList.language.*",
|
40
|
+
"fileAttachments.fileAttachmentList.*",
|
41
|
+
"guidedAssistance.*",
|
42
|
+
"language.*",
|
43
|
+
"notes.noteList.*",
|
44
|
+
"positionInList.*",
|
45
|
+
"products.productsList.*",
|
46
|
+
"relatedAnswers.answerRelatedAnswerList.*",
|
47
|
+
"relatedAnswers.answerRelatedAnswerList.toAnswer.*",
|
48
|
+
"siblingAnswers.*",
|
49
|
+
"statusWithType.statusType.*",
|
50
|
+
"updatedByAccount.*",
|
51
|
+
"customFields.c.*"
|
52
|
+
]
|
53
|
+
}
|
54
|
+
|
55
|
+
|
24
56
|
context "#query" do
|
25
57
|
|
26
58
|
it 'should expect client is an instance of OSCRuby::Client class and raise an error if does not' do
|
@@ -74,6 +106,28 @@ describe OSCRuby::QueryResults do
|
|
74
106
|
end
|
75
107
|
|
76
108
|
end
|
109
|
+
|
110
|
+
context "#nested_query" do
|
111
|
+
|
112
|
+
it 'should take nested queries and return multiple objects',:vcr do
|
113
|
+
|
114
|
+
query = nested_attributes.map{|q| "select #{table}.#{q} from #{table} where ID = 2222" }.join("; ")
|
115
|
+
|
116
|
+
|
117
|
+
expect do
|
118
|
+
|
119
|
+
results = query_results.nested_query(client,query,true)
|
120
|
+
expect(results.length).to eq(nested_attributes.length)
|
121
|
+
|
122
|
+
puts "Results : #{results.length} | Queries: #{nested_attributes.length}"
|
123
|
+
|
124
|
+
end.not_to raise_error
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
77
131
|
|
78
132
|
end
|
79
133
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osc_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajan Davis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|
@@ -141,20 +141,22 @@ files:
|
|
141
141
|
- Rakefile
|
142
142
|
- lib/ext/string.rb
|
143
143
|
- lib/osc_ruby.rb
|
144
|
-
- lib/osc_ruby/account.rb
|
145
|
-
- lib/osc_ruby/answer.rb
|
146
|
-
- lib/osc_ruby/
|
144
|
+
- lib/osc_ruby/classes/account.rb
|
145
|
+
- lib/osc_ruby/classes/answer.rb
|
146
|
+
- lib/osc_ruby/classes/incident.rb
|
147
|
+
- lib/osc_ruby/classes/product_category_shared.rb
|
148
|
+
- lib/osc_ruby/classes/query_results.rb
|
149
|
+
- lib/osc_ruby/classes/service_category.rb
|
150
|
+
- lib/osc_ruby/classes/service_class.rb
|
151
|
+
- lib/osc_ruby/classes/service_product.rb
|
147
152
|
- lib/osc_ruby/client.rb
|
148
153
|
- lib/osc_ruby/configuration.rb
|
149
154
|
- lib/osc_ruby/connect.rb
|
150
|
-
- lib/osc_ruby/
|
151
|
-
- lib/osc_ruby/
|
152
|
-
- lib/osc_ruby/
|
153
|
-
- lib/osc_ruby/
|
154
|
-
- lib/osc_ruby/
|
155
|
-
- lib/osc_ruby/service_class.rb
|
156
|
-
- lib/osc_ruby/service_product.rb
|
157
|
-
- lib/osc_ruby/validations_module.rb
|
155
|
+
- lib/osc_ruby/modules/class_factory_module.rb
|
156
|
+
- lib/osc_ruby/modules/nested_resource_module.rb
|
157
|
+
- lib/osc_ruby/modules/normalize_module.rb
|
158
|
+
- lib/osc_ruby/modules/query_module.rb
|
159
|
+
- lib/osc_ruby/modules/validations_module.rb
|
158
160
|
- lib/osc_ruby/version.rb
|
159
161
|
- osc_ruby.gemspec
|
160
162
|
- spec/core/account_spec.rb
|
data/lib/osc_ruby/incident.rb
DELETED
File without changes
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'osc_ruby/connect'
|
2
|
-
require 'osc_ruby/validations_module'
|
3
|
-
require 'json'
|
4
|
-
|
5
|
-
module OSCRuby
|
6
|
-
|
7
|
-
class QueryResults
|
8
|
-
|
9
|
-
include QueryModule
|
10
|
-
include ValidationsModule
|
11
|
-
|
12
|
-
def initialize; end
|
13
|
-
|
14
|
-
def query(client,query,return_json = false)
|
15
|
-
|
16
|
-
ValidationsModule::check_client(client)
|
17
|
-
|
18
|
-
ValidationsModule::check_query(query,"query")
|
19
|
-
|
20
|
-
@query = URI.escape("queryResults/?query=#{query}")
|
21
|
-
|
22
|
-
response = QueryModule::find(client,@query)
|
23
|
-
|
24
|
-
json_response = JSON.parse(response)
|
25
|
-
|
26
|
-
json_response.unshift("\n")
|
27
|
-
|
28
|
-
if return_json == true
|
29
|
-
json_response_final = QueryModule::query_injection(query,json_response)
|
30
|
-
puts json_response_final
|
31
|
-
end
|
32
|
-
|
33
|
-
QueryModule::remove_new_lines(json_response)
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|