lib/keen/client.rb in keen-0.2.2 vs lib/keen/client.rb in keen-0.3.0

- old
+ new

@@ -54,20 +54,24 @@ end event = Keen::Event.new(event_collection, event_properties) # build the request: - url = "#{base_url}/projects/#{project_id}/events/#{event_collection}" + if event.properties.is_a?(Array) + url = "#{base_url}/projects/#{project_id}/events" + body = {event_collection => event.properties} + else + url = "#{base_url}/projects/#{project_id}/events/#{event_collection}" + body = event.properties + end uri = URI.parse(url) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.ca_file = ssl_cert_file http.verify_mode = OpenSSL::SSL::VERIFY_PEER http.verify_depth = 5 request = Net::HTTP::Post.new(uri.path) - - body = event.properties if timestamp request.body[:keen] = { :timestamp => timestamp }