diff --git a/lib/microsoft/graph.rb b/lib/microsoft/graph.rb index 0686aaf..dd2d484 100644 --- a/lib/microsoft/graph.rb +++ b/lib/microsoft/graph.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "httparty" +require "ostruct" require "securerandom" require_relative "graph/version" require_relative "graph/batch" @@ -51,7 +52,7 @@ def call(endpoint, token: @token, method: "GET", headers: {}, params: nil, body: url, headers: headers, query: params, - body: @body_formatter.call(body, method: method).to_json, + body: @body_formatter.call(body, method: method), parser: InstanceParser ) diff --git a/lib/microsoft/graph/body_formatter.rb b/lib/microsoft/graph/body_formatter.rb index 9b8f59d..b6668a3 100644 --- a/lib/microsoft/graph/body_formatter.rb +++ b/lib/microsoft/graph/body_formatter.rb @@ -6,8 +6,9 @@ class BodyFormatter def call(body, method:) return nil unless Microsoft::Graph::BODY_METHODS.include?(method) return nil unless body + return body unless body.is_a?(Hash) - body.transform_keys(&method(:camelize)) + body.transform_keys(&method(:camelize)).to_json end private