module Sage300Kit::Client::Connection
Public Instance Methods
delete(path, options = {})
click to toggle source
# File lib/sage300_kit/client/connection.rb, line 13 def delete(path, options = {}) request :delete, path, options end
get(path, options = {})
click to toggle source
# File lib/sage300_kit/client/connection.rb, line 5 def get(path, options = {}) request :get, path, options end
post(path, options = {})
click to toggle source
# File lib/sage300_kit/client/connection.rb, line 9 def post(path, options = {}) request :post, path, options end
Private Instance Methods
request(http_method, path, options)
click to toggle source
# File lib/sage300_kit/client/connection.rb, line 18 def request(http_method, path, options) begin response = self.class.send(http_method, path, { body: options }) status = response.code.to_i case status when 200 then data = response.parsed_response when 400 then data = "Bad Request" when 401 then data = "Unauthorized" when 500 then data = "Internal Server Error" when 502 then data = "Bad Gateway" when 503 then data = "Service Unavailable" end rescue Net::ReadTimeout => exception data = "Error Read Timeout" rescue Errno::ECONNREFUSED data = "Connection refused" end end