lib/vault-usage-client/client.rb in vault-usage-client-0.0.5 vs lib/vault-usage-client/client.rb in vault-usage-client-0.0.6

- old
+ new

@@ -41,11 +41,11 @@ end path = "/products/#{product_name}/usage/#{consumer_hid}" + "/events/#{event_id}/open/#{iso_format(start_time)}" unless detail.nil? headers = {'Content-Type' => 'application/json'} - body = JSON.generate(detail) + body = MultiJson.dump(detail) end connection = Excon.new(@url) connection.put(path: path, headers: headers, body: body, expects: [201]) end @@ -118,10 +118,10 @@ query[:exclude] = exclude.join(',') end query[:callback_url] = callback_url if callback_url connection = Excon.new(@url) response = connection.get(path: path, expects: [200], query: query) - payload = JSON.parse(response.body, {symbolize_keys: true}) + payload = MultiJson.load(response.body, {symbolize_keys: true}) return payload[:job_id] if payload[:job_id] events = payload[:events] events.each do |event| event.each do |key, value| event[key] = parse_date(value) if date?(value)