mpql 0.0.1 → 0.2.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efb2efbefe64a0440d1fc21620820791b9c8dbf6298b6cc55b22cc70d54f4a55
4
- data.tar.gz: a4dc264a5b02f0b7d6ee6e07f754bfebd4ef18b205cbb27a199f6238d49dcdb9
3
+ metadata.gz: 63f6d1580b0cfe2dd287109819933593584580d1ce946189259bbc2e02d388e3
4
+ data.tar.gz: e787d7df3af32c6456437b2253e17959b4f796137be7bd62e18eca36661a02ef
5
5
  SHA512:
6
- metadata.gz: bbeb54de0e804fffe71383d78edd38d44e28070e8f1b0b89ae309ca927bf76ab9e564819a0e498e19d4ce73f9813567172488c89a738d0b361a1143a921189d6
7
- data.tar.gz: 2441597897c95693cfe5b7a2fb41ffe628cf72afb3c9ec1d195af03b1dc7fb62a1650009f9d689a3da29cf14900c3cf49d840d900f6b81c160b405dc0e8961a6
6
+ metadata.gz: 3a4e8f13e344c494f35a88310fee8458c92d45c350c3776dcffbe8130656dd425db3239f2ad15c947a064ab2eac438b721b9438a1e1bccd815964d2533412bc7
7
+ data.tar.gz: c053010c82aecc7459e0a99f77eb501bc1a33d45b3b95b97d319771b1624a963abe04619fb7585a4222a11f46a5f75a6a33b367392e89cf0cef2b58d2f52762d
data/README.md CHANGED
@@ -74,6 +74,7 @@ mpql export --project-id 123456 --event "Signed Up" --from 2026-03-01 --to 2026-
74
74
  mpql engage --project-id 123456
75
75
  mpql engage --project-id 123456 --where 'properties["$email"] == "test@example.com"'
76
76
  mpql engage --project-id 123456 --distinct-id "user123"
77
+ mpql engage --project-id 123456 --distinct-id "user123" "user456" "user789"
77
78
  ```
78
79
 
79
80
  ### Date Formats
data/lib/mpql/cli.rb CHANGED
@@ -19,7 +19,7 @@ module Mpql
19
19
  desc: "Output raw JSON without pretty-printing"
20
20
  class_option :region, type: :string, enum: %w[us eu in],
21
21
  desc: "MixPanel region (us, eu, in)"
22
- class_option :project_id, type: :string, required: true,
22
+ class_option :project_id, type: :string,
23
23
  desc: "MixPanel project ID"
24
24
 
25
25
  desc "segmentation", "Query segmentation data for an event"
@@ -160,13 +160,24 @@ module Mpql
160
160
  mpql engage --project-id 123456 --where 'properties["$email"] == "test@example.com"'
161
161
 
162
162
  mpql engage --project-id 123456 --distinct-id "user123"
163
+
164
+ mpql engage --project-id 123456 --distinct-id "user123" "user456" "user789"
163
165
  LONGDESC
164
166
  option :where, type: :string, desc: "Filter expression"
165
- option :distinct_id, type: :string, desc: "Specific user distinct ID"
167
+ option :distinct_id, type: :array, desc: "User distinct ID(s)"
166
168
  option :page, type: :numeric, desc: "Result page number (starting from 0)"
167
169
  option :session_id, type: :string, desc: "Session ID for pagination"
168
170
  def engage
169
- result = client.engage(**optional_params(:where, :distinct_id, :page, :session_id))
171
+ params = optional_params(:where, :page, :session_id)
172
+ distinct_ids = options[:distinct_id]
173
+ if distinct_ids && distinct_ids.length == 1
174
+ params[:distinct_id] = distinct_ids.first
175
+ elsif distinct_ids && distinct_ids.length > 1
176
+ conditions = distinct_ids.map { |id| %(properties["$distinct_id"] == "#{id}") }
177
+ where_clause = conditions.join(" or ")
178
+ params[:where] = params[:where] ? "(#{params[:where]}) and (#{where_clause})" : where_clause
179
+ end
180
+ result = client.engage(**params)
170
181
  output(result)
171
182
  rescue Mpql::Error => e
172
183
  error_exit(e)
data/lib/mpql/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mpql
4
- VERSION = "0.0.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mpql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - tomorrowkey