keen-cli 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -25,7 +25,7 @@ GEM
25
25
  http (0.6.1)
26
26
  http_parser.rb (~> 0.6.0)
27
27
  http_parser.rb (0.6.0)
28
- keen (0.8.2)
28
+ keen (0.8.3)
29
29
  addressable (~> 2.3.5)
30
30
  multi_json (~> 1.3)
31
31
  multi_json (1.10.1)
data/README.md CHANGED
@@ -17,12 +17,14 @@ $ gem install keen-cli
17
17
  Verify the `keen` command is in your path by running it:
18
18
 
19
19
  ``` shell
20
- $ keen
21
20
  Commands:
22
- keen help [COMMAND] # Describe available commands or one specific command
23
- keen project:open # Open the current project
24
- keen project:show # Show the current project
25
- keen version # Print the keen-cli version
21
+ keen events:add # Add an event
22
+ keen help [COMMAND] # Describe available commands or one specific command
23
+ keen project:open # Open the current project
24
+ keen project:show # Show the current project
25
+ keen project:workbench # Open the current project's workbench
26
+ keen queries:run # Run a query
27
+ keen version # Print the keen-cli version
26
28
  ```
27
29
 
28
30
  You should see information about available commands.
@@ -73,6 +75,7 @@ keen-cli has a variety of commands, and most are namespaced for clarity.
73
75
  ##### Projects
74
76
 
75
77
  * `project:open` - Open the Project Overview page in a browser
78
+ * `project:workbench` - Open the Project Workbench in a browser
76
79
  * `project:show` - Get data about the project, uses the [project row resource](https://keen.io/docs/api/reference/#project-row-resource).
77
80
 
78
81
  ##### Events
@@ -135,24 +138,25 @@ Some examples:
135
138
 
136
139
  ``` shell
137
140
  # run a count
138
- $ keen queries:run -a count -c cli-tests
141
+ $ keen queries:run --collection cli-tests --analysis-type count
142
+ 1000
139
143
 
140
144
  # run a count with collection name from .env
141
145
  # KEEN_COLLECTION_NAME=cli-tests
142
- $ keen queries:run -a count
146
+ $ keen queries:run --analysis-type count
143
147
  1000
144
148
 
145
149
  # run a count with a group by
146
- $ keen queries:run -a count -g a
150
+ $ keen queries:run --collection cli-tests --analysis-type count --group-by username
147
151
  [
148
152
  {
149
- "a": 1,
153
+ "username": "dzello",
150
154
  "result": 1000
151
155
  }
152
156
  ]
153
157
 
154
158
  # run a query with a timeframe, target property, group by, and interval
155
- $ keen queries:run -c cli-tests --analysis-type median --target-property value --group-by cohort --timeframe last_24_hours --interval hourly
159
+ $ keen queries:run --collection cli-tests --analysis-type median --target-property value --group-by cohort --timeframe last_24_hours --interval hourly
156
160
 
157
161
  {
158
162
  "timeframe": {
data/lib/keen-cli/cli.rb CHANGED
@@ -55,6 +55,17 @@ module KeenCli
55
55
  JSON.pretty_generate(JSON.parse(response.to_s)).tap do |s| puts s end
56
56
  end
57
57
 
58
+ desc 'project:collections', 'Show the current project\'s collections'
59
+ map 'project:collections' => :project_collections
60
+ shared_options
61
+
62
+ def project_collections
63
+ Utils.process_options!(options)
64
+ Keen.event_collections.tap do |collections|
65
+ puts JSON.pretty_generate(collections)
66
+ end
67
+ end
68
+
58
69
  desc 'project:open', 'Open the current project'
59
70
  map 'project:open' => :project_open
60
71
  shared_options
@@ -66,6 +77,17 @@ module KeenCli
66
77
  end
67
78
  end
68
79
 
80
+ desc 'project:workbench', 'Open the current project\'s workbench'
81
+ map 'project:workbench' => :project_workbench
82
+ shared_options
83
+
84
+ def project_workbench
85
+ Utils.process_options!(options)
86
+ "https://keen.io/project/#{Keen.project_id}/workbench".tap do |project_url|
87
+ `open #{project_url}`
88
+ end
89
+ end
90
+
69
91
  desc 'queries:run', 'Run a query'
70
92
  map 'queries:run' => :queries_run
71
93
  shared_options
@@ -1,3 +1,3 @@
1
1
  module KeenCli
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: