kns_endpoint 0.0.5 → 0.0.7
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.
- data/lib/kns_endpoint.rb +7 -3
- metadata +2 -2
data/lib/kns_endpoint.rb
CHANGED
@@ -91,6 +91,7 @@ module Kynetx
|
|
91
91
|
raise "Undefined Domain" unless @@domain
|
92
92
|
|
93
93
|
api_call = "https://cs.kobj.net/blue/event/#{@@domain.to_s}/#{e.to_s}/#{ruleset}"
|
94
|
+
puts api_call if $KNS_ENDPOINT_DEBUG
|
94
95
|
uri = URI.parse(api_call)
|
95
96
|
http_session = Net::HTTP.new(uri.host, uri.port)
|
96
97
|
http_session.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
@@ -109,9 +110,10 @@ module Kynetx
|
|
109
110
|
resp, data = http.request(req, params.to_url_params)
|
110
111
|
@session = parse_cookie(resp, 'SESSION_ID')
|
111
112
|
|
112
|
-
puts 'Code = ' + resp.code if $
|
113
|
-
puts 'Message = ' + resp.message if $
|
114
|
-
resp.each {|key, val| puts key + ' = ' + val} if $
|
113
|
+
puts 'Code = ' + resp.code if $KNS_ENDPOINT_DEBUG
|
114
|
+
puts 'Message = ' + resp.message if $KNS_ENDPOINT_DEBUG
|
115
|
+
resp.each {|key, val| puts key + ' = ' + val} if $KNS_ENDPOINT_DEBUG
|
116
|
+
puts "Data = \n" + data if $KNS_ENDPOINT_DEBUG
|
115
117
|
|
116
118
|
|
117
119
|
raise "Unexpected response from KNS (HTTP Error: #{resp.code} - #{resp.message})" unless resp.code == '200'
|
@@ -148,6 +150,8 @@ module Kynetx
|
|
148
150
|
end
|
149
151
|
|
150
152
|
def symbolize_keys(hash)
|
153
|
+
return {} unless hash.class == Hash
|
154
|
+
|
151
155
|
hash.inject({}){|result, (key, value)|
|
152
156
|
new_key = case key
|
153
157
|
when String then key.to_sym
|