lib/octoparts/client.rb in octoparts-0.0.1 vs lib/octoparts/client.rb in octoparts-0.0.2

- old
+ new

@@ -1,5 +1,6 @@ +require 'active_support/core_ext/hash/keys' require 'uri' module Octoparts class Client OCTOPARTS_API_ENDPOINT_PATH = '/octoparts/2' @@ -18,10 +19,12 @@ process(:post, path, params, headers) end # TODO: doc def invoke(params) - body = params.to_json # TODO + stringify_params = params.deep_stringify_keys + aggregate_request = Model::AggregateRequest.new.extend(Representer::AggregateRequestRepresenter).from_hash(stringify_params) + body = aggregate_request.to_json(camelize: true) headers = { content_type: 'application/json' } resp = post(OCTOPARTS_API_ENDPOINT_PATH, body, headers) Response.new( Model::AggregateResponse.new.extend(Representer::AggregateResponseRepresenter).from_json(resp.body), resp.headers,