module AWS::Core::Client::QueryJSON
def self.extended base
def self.extended base base.send(:include, ErrorParser) base.send(:define_client_methods) end
def define_client_method method_name, operation
def define_client_method method_name, operation add_client_request_method(method_name) do configure_request do |request, options| parser = self.class.option_parsers[method_name] x_amz_target = self.class::TARGET_PREFIX + operation request.headers["content-type"] = "application/x-amz-json-1.0" request.headers["x-amz-target"] = x_amz_target request.body = parser.to_json(options) end process_response do |response| response_body = response.http_response.body response_body = "{}" if response_body == "" data = JSON.load(response_body) MetaUtils.extend_method(response, :data) { data } end simulate_response do |response| data = {} MetaUtils.extend_method(response, :data) { data } end end end
def define_client_methods
configuration (yaml configuration file found in lib/api_config/)
Enumerates through the operations specified in the API
def define_client_methods api_config[:operations].each do |op| method_name = op[:method] option_parsers[method_name] = OptionGrammar.customize(op[:inputs]) end end
def option_parsers
- Private: -
Returns:
-
(Hash
- Returns a hash option)
def option_parsers @option_parsers ||= {} end