class Kongrations::Request

Constants

METHODS_MAPPER

Attributes

payload[RW]

Public Instance Methods

execute() click to toggle source
# File lib/kongrations/request.rb, line 20
def execute
  http = Net::HTTP.new(CurrentEnvironment.kong_admin_url, 80)
  headers = {
    'Content-Type' => 'application/json',
    'apikey' => CurrentEnvironment.kong_admin_api_key
  }

  request = METHODS_MAPPER[method].new(path, headers)
  request.body = payload.to_json unless payload.nil?
  response = http.request(request)
  initialize_response_class(response)
end
initialize_response_class(response) click to toggle source
# File lib/kongrations/request.rb, line 33
def initialize_response_class(response)
  class_name = self.class.to_s.gsub('Request', 'Response')
  klass = Object.const_defined?(class_name) ? Object.const_get(class_name) : Response
  klass.new(response, self)
end
migration_data() click to toggle source
# File lib/kongrations/request.rb, line 39
def migration_data
  MigrationData.data
end