def send_request(api_method, http_method = 'GET', data = nil)
      if data.is_a?(Hash)
        data['api_username'] = @api_username
        data['api_password'] = @api_password
        data['api_key'] = @api_key

        post_data = data.map{|k,v| "#{CGI::escape(k)}=#{CGI::escape(v)}"}.join('&')
      else
        post_data = sprintf(
            "api_username=%s&api_password=%s&api_key=%s&%s",
            CGI::escape(@api_username),
            CGI::escape(@api_password),
            CGI::escape(@api_key),
            data
        )
      end

      uri = URI.parse("#{@api_url}/v#{@version}/client#{api_method}")
      http = Net::HTTP.new(uri.host, uri.port)
      http.use_ssl = true
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE

      request = http_method == 'GET' ? Net::HTTP::Get.new(uri.request_uri) : Net::HTTP::Post.new(uri.request_uri)
      request.body = !data.nil? ? post_data : ''

      request.initialize_http_header({
        "User-Agent" => "abenity/abenity-ruby v1"
      })

      response = http.request(request)

      return parse_response(response.body)
    end
def send_request(api_method, http_method = 'GET', data = nil)
      if data.is_a?(Hash)
        data['api_username'] = @api_username
        data['api_password'] = @api_password
        data['api_key'] = @api_key

        post_data = data.map{|k,v| "#{CGI::escape(k)}=#{CGI::escape(v)}"}.join('&')
      else
        post_data = sprintf(
            "api_username=%s&api_password=%s&api_key=%s&%s",
            CGI::escape(@api_username),
            CGI::escape(@api_password),
            CGI::escape(@api_key),
            data
        )
      end

      uri = URI.parse("#{@api_url}/v#{@version}/client#{api_method}")
      http = Net::HTTP.new(uri.host, uri.port)
      http.use_ssl = true
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE

      request = http_method == 'GET' ? Net::HTTP::Get.new(uri.request_uri) : Net::HTTP::Post.new(uri.request_uri)
      request.body = !data.nil? ? post_data : ''

      request.initialize_http_header({
        "User-Agent" => "abenity/abenity-ruby v1"
      })

      response = http.request(request)

      return parse_response(response.body)
    end
Public: Initialize an API Client

 api_username - A String of the API username
 api_password - A String of the API password
 api_key - A String of the API key
 version - An Integer naming the API version number
 environment - A String naming the environment
 timeout - An Integer specifiying the timeout on a request
 Public: Send a HTTP request to the API

 api_method - The API method to be called
 http_method - The HTTP method to be used (GET, POST, PUT, DELETE, etc.)
 data - Any data to be sent to the API

 Returns a data-object of the response