lib/macaco/api.rb in macaco-0.0.2 vs lib/macaco/api.rb in macaco-0.0.3

- old
+ new

@@ -2,11 +2,11 @@ class Api def self.post(args = {}) request = request_instance(args) - request.body = args[:data].to_json + request.body = args[:data] JSON.parse(http_response(request, args).body) end @@ -15,10 +15,10 @@ def self.http_response(request, args) http_instance(args).start { |http| http.request(request) } end def self.request_instance(args) - Net::HTTP::Post.new(args[:mail].api_path, initheader = { 'Content-Type' => 'application/json' }) + Net::HTTP::Post.new(args[:mail].api_path, { 'Content-Type' => args[:mail].content_type }) end def self.http_instance(args) http = Net::HTTP.new(args[:mail].api_root, 443) http.use_ssl = true