osc_ruby 0.7.1 → 1.0.2
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/.codeclimate.yml +25 -25
- data/.gitignore +15 -15
- data/.rspec +1 -1
- data/.rubocop.yml +1156 -1156
- data/.travis.yml +9 -9
- data/Gemfile +3 -3
- data/License.txt +21 -0
- data/README.md +95 -242
- data/Rakefile +2 -2
- data/lib/ext/string.rb +18 -18
- data/lib/osc_ruby/classes/query_results.rb +40 -60
- data/lib/osc_ruby/client.rb +40 -40
- data/lib/osc_ruby/configuration.rb +14 -13
- data/lib/osc_ruby/connect.rb +218 -209
- data/lib/osc_ruby/modules/normalize_module.rb +121 -121
- data/lib/osc_ruby/modules/query_module.rb +69 -69
- data/lib/osc_ruby/modules/validations_module.rb +168 -168
- data/lib/osc_ruby/version.rb +2 -2
- data/lib/osc_ruby.rb +4 -10
- data/osc_ruby.gemspec +28 -29
- data/spec/core/client_spec.rb +96 -96
- data/spec/core/configuration_spec.rb +4 -4
- data/spec/core/connect_spec.rb +366 -364
- data/spec/core/query_results_spec.rb +107 -133
- data/spec/core/spec_helper.rb +25 -25
- data/tasks/rspec.rake +2 -2
- metadata +23 -22
- data/LICENSE.txt +0 -22
- data/lib/osc_ruby/classes/account.rb +0 -75
- data/lib/osc_ruby/classes/answer.rb +0 -117
- data/lib/osc_ruby/classes/incident.rb +0 -13
- data/lib/osc_ruby/classes/product_category_shared.rb +0 -118
- data/lib/osc_ruby/classes/service_category.rb +0 -6
- data/lib/osc_ruby/classes/service_class.rb +0 -66
- data/lib/osc_ruby/classes/service_product.rb +0 -6
- data/lib/osc_ruby/modules/class_factory_module.rb +0 -165
- data/lib/osc_ruby/modules/nested_resource_module.rb +0 -10
- data/spec/core/account_spec.rb +0 -497
- data/spec/core/answer_spec.rb +0 -545
- data/spec/core/service_category_spec.rb +0 -445
- data/spec/core/service_product_spec.rb +0 -443
data/lib/osc_ruby/connect.rb
CHANGED
@@ -1,210 +1,219 @@
|
|
1
|
-
require 'osc_ruby/client'
|
2
|
-
|
3
|
-
require 'net/http'
|
4
|
-
require 'openssl'
|
5
|
-
require 'uri'
|
6
|
-
require 'cgi'
|
7
|
-
|
8
|
-
module OSCRuby
|
9
|
-
|
10
|
-
class Connect
|
11
|
-
# This class is purely to provide the underlying methods for CRUD functionality using Net::HTTP, URI, and OpenSSL
|
12
|
-
|
13
|
-
def self.get(client,resource_url = nil)
|
14
|
-
|
15
|
-
@final_config = get_check(client,resource_url)
|
16
|
-
|
17
|
-
@uri = @final_config['site_url']
|
18
|
-
|
19
|
-
@username = @final_config['username']
|
20
|
-
@password = @final_config['password']
|
21
|
-
|
22
|
-
Net::HTTP.start(@uri.host, @uri.port,
|
23
|
-
:use_ssl => true,
|
24
|
-
:verify_mode => @final_config['ssl']) do |http|
|
25
|
-
|
26
|
-
request = Net::HTTP::Get.new @uri.request_uri
|
27
|
-
|
28
|
-
request.add_field('Content-Type', 'application/x-www-form-urlencoded')
|
29
|
-
if @final_config['suppress_rules'] == true
|
30
|
-
request.add_field 'OSvC-CREST-Suppress-All',true
|
31
|
-
end
|
32
|
-
|
33
|
-
request.basic_auth @username, @password
|
34
|
-
|
35
|
-
http.request request # Net::HTTPResponse object
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.post_or_patch(client,resource_url = nil, json_content = nil,patch_request = false)
|
42
|
-
|
43
|
-
@final_config = post_and_patch_check(client,resource_url, json_content, patch_request)
|
44
|
-
|
45
|
-
@
|
46
|
-
@
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
:
|
51
|
-
|
52
|
-
|
53
|
-
request
|
54
|
-
request.
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
@
|
75
|
-
@
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
:
|
80
|
-
|
81
|
-
|
82
|
-
request
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
'
|
115
|
-
'
|
116
|
-
'
|
117
|
-
'
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
if config.
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
1
|
+
require 'osc_ruby/client'
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
require 'openssl'
|
5
|
+
require 'uri'
|
6
|
+
require 'cgi'
|
7
|
+
|
8
|
+
module OSCRuby
|
9
|
+
|
10
|
+
class Connect
|
11
|
+
# This class is purely to provide the underlying methods for CRUD functionality using Net::HTTP, URI, and OpenSSL
|
12
|
+
|
13
|
+
def self.get(client,resource_url = nil)
|
14
|
+
|
15
|
+
@final_config = get_check(client,resource_url)
|
16
|
+
|
17
|
+
@uri = @final_config['site_url']
|
18
|
+
|
19
|
+
@username = @final_config['username']
|
20
|
+
@password = @final_config['password']
|
21
|
+
|
22
|
+
Net::HTTP.start(@uri.host, @uri.port,
|
23
|
+
:use_ssl => true,
|
24
|
+
:verify_mode => @final_config['ssl']) do |http|
|
25
|
+
|
26
|
+
request = Net::HTTP::Get.new @uri.request_uri
|
27
|
+
|
28
|
+
request.add_field('Content-Type', 'application/x-www-form-urlencoded')
|
29
|
+
if @final_config['suppress_rules'] == true
|
30
|
+
request.add_field 'OSvC-CREST-Suppress-All',true
|
31
|
+
end
|
32
|
+
|
33
|
+
request.basic_auth @username, @password
|
34
|
+
|
35
|
+
http.request request # Net::HTTPResponse object
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.post_or_patch(client,resource_url = nil, json_content = nil,patch_request = false)
|
42
|
+
|
43
|
+
@final_config = post_and_patch_check(client,resource_url, json_content, patch_request)
|
44
|
+
@uri = @final_config['site_url']
|
45
|
+
@username = @final_config['username']
|
46
|
+
@password = @final_config['password']
|
47
|
+
|
48
|
+
Net::HTTP.start(@uri.host, @uri.port,
|
49
|
+
:use_ssl => true,
|
50
|
+
:verify_mode => @final_config['ssl']) do |http|
|
51
|
+
|
52
|
+
request = Net::HTTP::Post.new @uri.request_uri
|
53
|
+
request.basic_auth @username, @password
|
54
|
+
request.content_type = "application/json"
|
55
|
+
if @final_config['patch_request'] == true
|
56
|
+
request.add_field 'X-HTTP-Method-Override','PATCH'
|
57
|
+
end
|
58
|
+
if @final_config['suppress_rules'] == true
|
59
|
+
request.add_field 'OSvC-CREST-Suppress-All',true
|
60
|
+
end
|
61
|
+
request.body = JSON.dump(json_content)
|
62
|
+
|
63
|
+
http.request request # Net::HTTPResponse object
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.delete(client,resource_url = nil)
|
70
|
+
|
71
|
+
@final_config = delete_check(client,resource_url)
|
72
|
+
|
73
|
+
@uri = @final_config['site_url']
|
74
|
+
@username = @final_config['username']
|
75
|
+
@password = @final_config['password']
|
76
|
+
|
77
|
+
Net::HTTP.start(@uri.host, @uri.port,
|
78
|
+
:use_ssl => true,
|
79
|
+
:verify_mode => @final_config['ssl']) do |http|
|
80
|
+
|
81
|
+
request = Net::HTTP::Delete.new @uri.request_uri
|
82
|
+
request.basic_auth @username, @password
|
83
|
+
|
84
|
+
http.request request # Net::HTTPResponse object
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
## checking methods
|
92
|
+
|
93
|
+
def self.generate_url_and_config(client,resource_url = nil, patch_request = false)
|
94
|
+
|
95
|
+
check_client_config(client)
|
96
|
+
|
97
|
+
@config = client.config
|
98
|
+
|
99
|
+
@version = @config.version
|
100
|
+
|
101
|
+
@ssl_verification = ssl_check(@config)
|
102
|
+
|
103
|
+
@rule_suppression = rule_suppress_check(@config)
|
104
|
+
|
105
|
+
@cust_or_demo = demo_check(@config)
|
106
|
+
|
107
|
+
@url = "https://" + @config.interface + ".#{@cust_or_demo}.com/services/rest/connect/#{@version}/#{resource_url}"
|
108
|
+
|
109
|
+
@final_uri = URI(@url)
|
110
|
+
|
111
|
+
@patch_request = patch_request == true ? true : false
|
112
|
+
|
113
|
+
@final_config = {'site_url' => @final_uri,
|
114
|
+
'username' => @config.username,
|
115
|
+
'password' => @config.password,
|
116
|
+
'patch_request' => @patch_request,
|
117
|
+
'ssl' => @ssl_verification,
|
118
|
+
'suppress_rules' => @rule_suppression
|
119
|
+
}
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.demo_check(config)
|
124
|
+
if config.demo_site == true
|
125
|
+
"rightnowdemo"
|
126
|
+
else
|
127
|
+
"custhelp"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def self.rule_suppress_check(config)
|
132
|
+
|
133
|
+
if config.suppress_rules == true || config.suppress_rules == "Yes"
|
134
|
+
|
135
|
+
true
|
136
|
+
|
137
|
+
else
|
138
|
+
|
139
|
+
false
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
def self.ssl_check(config)
|
146
|
+
|
147
|
+
if config.no_ssl_verify == true
|
148
|
+
|
149
|
+
OpenSSL::SSL::VERIFY_NONE
|
150
|
+
|
151
|
+
else
|
152
|
+
|
153
|
+
OpenSSL::SSL::VERIFY_PEER
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
def self.check_client_config(client)
|
160
|
+
|
161
|
+
if client.nil?
|
162
|
+
raise ArgumentError, "Client must have some configuration set; please create an instance of OSCRuby::Client with configuration settings"
|
163
|
+
else
|
164
|
+
@config = client.config
|
165
|
+
end
|
166
|
+
|
167
|
+
if @config.nil?
|
168
|
+
raise ArgumentError, "Client configuration cannot be nil or blank"
|
169
|
+
elsif @config.interface.nil?
|
170
|
+
raise ArgumentError, "The configured client interface cannot be nil or blank"
|
171
|
+
elsif @config.username.nil?
|
172
|
+
raise ArgumentError, "The configured client username cannot be nil or blank"
|
173
|
+
elsif @config.password.nil?
|
174
|
+
raise ArgumentError, "The configured client password cannot be nil or blank"
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
def self.get_check(client,resource_url = nil)
|
180
|
+
|
181
|
+
if client.nil?
|
182
|
+
raise ArgumentError, "Client must have some configuration set; please create an instance of OSCRuby::Client with configuration settings"
|
183
|
+
elsif !resource_url.nil?
|
184
|
+
@final_config = generate_url_and_config(client,resource_url)
|
185
|
+
else
|
186
|
+
@final_config = generate_url_and_config(client,nil)
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|
190
|
+
|
191
|
+
def self.post_and_patch_check(client,resource_url = nil, json_content = nil, patch_request = false)
|
192
|
+
|
193
|
+
if client.nil?
|
194
|
+
raise ArgumentError, "Client must have some configuration set; please create an instance of OSCRuby::Client with configuration settings"
|
195
|
+
elsif resource_url.nil?
|
196
|
+
raise ArgumentError, "There is no URL resource provided; please specify a URL resource that you would like to send a POST or PATCH request to"
|
197
|
+
elsif json_content.nil?
|
198
|
+
raise ArgumentError, "There is no json content provided; please specify json content that you would like to send a POST or PATCH request with"
|
199
|
+
elsif patch_request == true
|
200
|
+
@final_config = generate_url_and_config(client,resource_url,true)
|
201
|
+
else
|
202
|
+
@final_config = generate_url_and_config(client,resource_url)
|
203
|
+
end
|
204
|
+
|
205
|
+
end
|
206
|
+
|
207
|
+
def self.delete_check(client,resource_url = nil)
|
208
|
+
if client.nil?
|
209
|
+
raise ArgumentError, "Client must have some configuration set; please create an instance of OSCRuby::Client with configuration settings"
|
210
|
+
elsif resource_url.nil?
|
211
|
+
raise ArgumentError, "There is no URL resource provided; please specify a URL resource that you would like to send a POST or PATCH request to"
|
212
|
+
else
|
213
|
+
@final_config = generate_url_and_config(client,resource_url)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
end
|
218
|
+
|
210
219
|
end
|
@@ -1,122 +1,122 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
|
-
module OSCRuby
|
4
|
-
|
5
|
-
module NormalizeModule
|
6
|
-
|
7
|
-
class << self
|
8
|
-
|
9
|
-
def normalize(input,resource)
|
10
|
-
|
11
|
-
if input.code.to_i == 404
|
12
|
-
|
13
|
-
input.body
|
14
|
-
|
15
|
-
else
|
16
|
-
|
17
|
-
json_input = JSON.parse(input.body)
|
18
|
-
|
19
|
-
final_hash = []
|
20
|
-
|
21
|
-
json_input['items'].each do |item|
|
22
|
-
|
23
|
-
item['rows'].each_with_index do |row,row_i|
|
24
|
-
|
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
|
30
|
-
|
31
|
-
final_hash.push(obj_hash)
|
32
|
-
|
33
|
-
if json_input['items'].count > 1 && (item['rows'].count-1 <= row_i)
|
34
|
-
|
35
|
-
final_hash.push("\n")
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
final_hash.to_json
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
def nested_normalize(input,resource)
|
50
|
-
|
51
|
-
if input.code.to_i == 404
|
52
|
-
|
53
|
-
input.body
|
54
|
-
|
55
|
-
else
|
56
|
-
|
57
|
-
json_input = JSON.parse(input.body)
|
58
|
-
|
59
|
-
final_hash = []
|
60
|
-
|
61
|
-
json_input['items'].each do |item|
|
62
|
-
|
63
|
-
item_array = []
|
64
|
-
|
65
|
-
item['rows'].each_with_index do |row,row_i|
|
66
|
-
|
67
|
-
obj_hash = {}
|
68
|
-
|
69
|
-
item['columnNames'].each_with_index do |column,i|
|
70
|
-
obj_hash[column] = if !row[i].nil? && row[i].is_i? == true then row[i].to_i else row[i] end
|
71
|
-
end
|
72
|
-
|
73
|
-
item_array.push(obj_hash)
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
final_hash.push(item_array)
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
puts JSON.pretty_generate(final_hash)
|
82
|
-
|
83
|
-
final_hash.to_json
|
84
|
-
|
85
|
-
end
|
86
|
-
|
87
|
-
end
|
88
|
-
|
89
|
-
def query_injection(query,json_response)
|
90
|
-
|
91
|
-
queries = query.split(';')
|
92
|
-
|
93
|
-
count = 0
|
94
|
-
|
95
|
-
json_response.each_with_index do |hash,i|
|
96
|
-
if hash == "\n" && queries.count > 1
|
97
|
-
json_response[i] = "\nResults for #{queries[count]}:"
|
98
|
-
count += 1
|
99
|
-
elsif hash == "\n"
|
100
|
-
json_response.delete_at(i)
|
101
|
-
elsif json_response.last == "\n"
|
102
|
-
json_response.delete_at(json_response.count - 1)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
json_response
|
107
|
-
|
108
|
-
end
|
109
|
-
|
110
|
-
def remove_new_lines(json_response)
|
111
|
-
json_response.each_with_index do |hash,i|
|
112
|
-
if hash == "\n"
|
113
|
-
json_response.delete_at(i)
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
json_response
|
118
|
-
end
|
119
|
-
|
120
|
-
end
|
121
|
-
end
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module OSCRuby
|
4
|
+
|
5
|
+
module NormalizeModule
|
6
|
+
|
7
|
+
class << self
|
8
|
+
|
9
|
+
def normalize(input,resource)
|
10
|
+
|
11
|
+
if input.code.to_i == 404
|
12
|
+
|
13
|
+
input.body
|
14
|
+
|
15
|
+
else
|
16
|
+
|
17
|
+
json_input = JSON.parse(input.body)
|
18
|
+
|
19
|
+
final_hash = []
|
20
|
+
|
21
|
+
json_input['items'].each do |item|
|
22
|
+
|
23
|
+
item['rows'].each_with_index do |row,row_i|
|
24
|
+
|
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
|
30
|
+
|
31
|
+
final_hash.push(obj_hash)
|
32
|
+
|
33
|
+
if json_input['items'].count > 1 && (item['rows'].count-1 <= row_i)
|
34
|
+
|
35
|
+
final_hash.push("\n")
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
final_hash.to_json
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
def nested_normalize(input,resource)
|
50
|
+
|
51
|
+
if input.code.to_i == 404
|
52
|
+
|
53
|
+
input.body
|
54
|
+
|
55
|
+
else
|
56
|
+
|
57
|
+
json_input = JSON.parse(input.body)
|
58
|
+
|
59
|
+
final_hash = []
|
60
|
+
|
61
|
+
json_input['items'].each do |item|
|
62
|
+
|
63
|
+
item_array = []
|
64
|
+
|
65
|
+
item['rows'].each_with_index do |row,row_i|
|
66
|
+
|
67
|
+
obj_hash = {}
|
68
|
+
|
69
|
+
item['columnNames'].each_with_index do |column,i|
|
70
|
+
obj_hash[column] = if !row[i].nil? && row[i].is_i? == true then row[i].to_i else row[i] end
|
71
|
+
end
|
72
|
+
|
73
|
+
item_array.push(obj_hash)
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
final_hash.push(item_array)
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
puts JSON.pretty_generate(final_hash)
|
82
|
+
|
83
|
+
final_hash.to_json
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
def query_injection(query,json_response)
|
90
|
+
|
91
|
+
queries = query.split(';')
|
92
|
+
|
93
|
+
count = 0
|
94
|
+
|
95
|
+
json_response.each_with_index do |hash,i|
|
96
|
+
if hash == "\n" && queries.count > 1
|
97
|
+
json_response[i] = "\nResults for #{queries[count]}:"
|
98
|
+
count += 1
|
99
|
+
elsif hash == "\n"
|
100
|
+
json_response.delete_at(i)
|
101
|
+
elsif json_response.last == "\n"
|
102
|
+
json_response.delete_at(json_response.count - 1)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
json_response
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
def remove_new_lines(json_response)
|
111
|
+
json_response.each_with_index do |hash,i|
|
112
|
+
if hash == "\n"
|
113
|
+
json_response.delete_at(i)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
json_response
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
122
122
|
end
|