keen-cli 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -158,6 +158,10 @@ $ keen events:add --file events.json
158
158
  $ keen events:add --file events.csv --csv
159
159
  ```
160
160
 
161
+ Notes:
162
+
163
+ + `keen.id` and `keen.created_at` properties are automatically removed from events before uploading. The API generates these properties and it will refuse them from clients. The automatic removal makes export & re-import scenarios easier.
164
+
161
165
  ##### Queries
162
166
 
163
167
  `queries:run` - Runs a query and prints the result
@@ -287,19 +291,20 @@ Parameters that apply to most commands include:
287
291
 
288
292
  ### Changelog
289
293
 
290
- + 0.2.2 - Return full API JSON response for queries
291
- + 0.2.1 - Add `collections:delete` command
294
+ + 0.2.3 - Strip `keen.created_at` and `keen.id` out of events to be added.
295
+ + 0.2.2 - Return full API JSON response for queries.
296
+ + 0.2.1 - Add `collections:delete` command.
292
297
  + 0.2.0 - Add support for [spark](https://github.com/holman/spark) ▁▂▃▅▇
293
- + 0.1.9 - Supports JSON-encoded filters and comma-seperated multiple group by
298
+ + 0.1.9 - Supports JSON-encoded filters and comma-seperated multiple group by.
294
299
  + 0.1.8 - Inputted lines can also be arrays of JSON objects. `--batch-size` param is now properly recognized.
295
- + 0.1.7 - Add docs command
300
+ + 0.1.7 - Add docs command.
296
301
  + 0.1.6 - Big refactoring to make importing events much cleaner and batching happen automatically. Also adds `queries:url`.
297
302
  + 0.1.5 – Support adding events from files with `--file`. Optionally add from CSV with `--csv`.
298
- + 0.1.4 – Support absolute timeframes via `--start` and `--end` flags
303
+ + 0.1.4 – Support absolute timeframes via `--start` and `--end` flags.
299
304
  + 0.1.3 – Add querying via JSON. Add query aliases. Add support for extraction fields.
300
- + 0.1.2 – Change `project:show` to `project:describe`
301
- + 0.1.1 – Add `project:collections`
302
- + 0.1.0 - Initial version
305
+ + 0.1.2 – Change `project:show` to `project:describe`.
306
+ + 0.1.1 – Add `project:collections`.
307
+ + 0.1.0 - Initial version.
303
308
 
304
309
  ### Contributing
305
310
 
@@ -86,6 +86,13 @@ module KeenCli
86
86
  private
87
87
 
88
88
  def add_event_and_flush_if_necessary(event)
89
+
90
+ # remove keen.id and keen.created_at
91
+ if keen = event["keen"]
92
+ keen.delete("id")
93
+ keen.delete("created_at")
94
+ end
95
+
89
96
  self.events.push(event)
90
97
  self.size += 1
91
98
  self.total_size += 1
@@ -1,3 +1,3 @@
1
1
  module KeenCli
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -156,6 +156,16 @@ module KeenCli
156
156
  expect(batch_processor.events).to be_empty
157
157
  end
158
158
 
159
+ it 'removes the keen.id property' do
160
+ batch_processor.add('{ "keen": { "id" : "abcde" } }')
161
+ expect(batch_processor.events.first).to eq({ "keen" => {} })
162
+ end
163
+
164
+ it 'removes the keen.created_at property' do
165
+ batch_processor.add('{ "keen": { "created_at" : "2014-01-01T00:00:00Z" } }')
166
+ expect(batch_processor.events.first).to eq({ "keen" => {} })
167
+ end
168
+
159
169
  end
160
170
 
161
171
  describe 'flush' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keen-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: