amplitude-api 0.3.1 → 0.3.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 +4 -4
- data/Changelog.md +3 -0
- data/lib/amplitude_api/event.rb +2 -2
- data/lib/amplitude_api/version.rb +1 -1
- data/spec/lib/amplitude_api/event_spec.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 275373a4c26fc2028070205735f535ab9411dad8c98986c1dae0793e44098106
|
4
|
+
data.tar.gz: 5d79d4ff3ebc1218f5ce1ddff49fc5c323b250862db1e4c4e5136f76c3eb6f1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af5c1085ae807de968a2737ec4eab0da585baca1596ac38caed7960b457d854d7e83e4a0fa0fbf9826164239891d047fbc0e3e1801104696e5323fd05f0e3b7c
|
7
|
+
data.tar.gz: 12817cbd4e8929d02cea2b2499bbe309d459fcc1388e9b70003503e6d3df00e974185342bfae02e9d61cdf5d8b4af296616af1dc720db42f91a456b56f70452c
|
data/Changelog.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
We would like to think our many [contributors](https://github.com/toothrot/amplitude-api/graphs/contributors) for
|
4
4
|
suggestions, ideas and improvements to Amplitude API.
|
5
5
|
|
6
|
+
## 0.3.2 (2021-02-23)
|
7
|
+
* Creates new properties on initialization
|
8
|
+
|
6
9
|
## 0.3.1 (2021-02-23)
|
7
10
|
* Allows sending options to Amplitude
|
8
11
|
* Solves an error when accessing event properties not been created yet
|
data/lib/amplitude_api/event.rb
CHANGED
@@ -16,11 +16,11 @@ class AmplitudeAPI
|
|
16
16
|
# See (Amplitude HTTP API Documentation)[https://developers.amplitude.com/docs/http-api-v2]
|
17
17
|
# for a list of valid parameters and their types.
|
18
18
|
def initialize(attributes = {})
|
19
|
+
@extra_properties = []
|
19
20
|
attributes.each do |k, v|
|
20
|
-
send("#{k}=", v)
|
21
|
+
send("#{k}=", v)
|
21
22
|
end
|
22
23
|
validate_arguments
|
23
|
-
@extra_properties = []
|
24
24
|
end
|
25
25
|
|
26
26
|
def method_missing(method_name, *args)
|
@@ -334,6 +334,19 @@ describe AmplitudeAPI::Event do
|
|
334
334
|
)
|
335
335
|
}
|
336
336
|
|
337
|
+
it "creates properties on initialization" do
|
338
|
+
property_value = "an arbitrary value"
|
339
|
+
creation_data = {
|
340
|
+
user_id: "whatever",
|
341
|
+
event_type: "something happened",
|
342
|
+
arbitrary_property: property_value
|
343
|
+
}
|
344
|
+
|
345
|
+
initialized_event = klass.new(creation_data)
|
346
|
+
|
347
|
+
expect(initialized_event.arbitrary_property).to eq property_value
|
348
|
+
end
|
349
|
+
|
337
350
|
it "creates arbitrary properties when assigning values" do
|
338
351
|
event.arbitrary_property = "arbitrary value"
|
339
352
|
|