amplitude-api 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -3
- data/.rubocop.yml +5159 -19
- data/Changelog.md +12 -0
- data/Gemfile +1 -11
- data/amplitude-api.gemspec +6 -4
- data/lib/amplitude_api/event.rb +4 -4
- data/lib/amplitude_api/version.rb +1 -1
- data/lib/amplitude_api.rb +1 -1
- data/spec/lib/amplitude_api/event_spec.rb +13 -0
- data/spec/lib/amplitude_api_spec.rb +2 -2
- metadata +66 -22
- data/Gemfile.lock +0 -63
- data/lib/amplitude-api.rb +0 -3
data/Changelog.md
CHANGED
@@ -3,6 +3,18 @@
|
|
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.4.0 (2022-04-28)
|
7
|
+
* Increases required Ruby version to supported ones. Minimum Ruby version is now 2.7
|
8
|
+
* Allows using version 2 of Faraday
|
9
|
+
* Upgrades development dependencies
|
10
|
+
* Adds more Rubocop rules
|
11
|
+
|
12
|
+
## 0.3.3 (2021-02-24)
|
13
|
+
* Relaxes Faraday dependency
|
14
|
+
|
15
|
+
## 0.3.2 (2021-02-23)
|
16
|
+
* Creates new properties on initialization
|
17
|
+
|
6
18
|
## 0.3.1 (2021-02-23)
|
7
19
|
* Allows sending options to Amplitude
|
8
20
|
* Solves an error when accessing event properties not been created yet
|
data/Gemfile
CHANGED
@@ -1,14 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Generated from /Users/alex/development/amplitude-api/amplitude-api.gemspec
|
4
3
|
source "https://rubygems.org"
|
5
|
-
|
6
|
-
gem "faraday", "~> 1.3"
|
7
|
-
|
8
|
-
group :development, :test do
|
9
|
-
gem "pry", "~> 0.12.2"
|
10
|
-
gem "rake", ">= 12.0"
|
11
|
-
gem "rspec", ">= 2.99.0"
|
12
|
-
gem "rubocop", "~> 0.66.0", require: false
|
13
|
-
gem "rubocop-rspec"
|
14
|
-
end
|
4
|
+
gemspec
|
data/amplitude-api.gemspec
CHANGED
@@ -20,8 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_development_dependency "pry", "~> 0.12.2"
|
23
|
-
spec.add_development_dependency "rake", "
|
24
|
-
spec.add_development_dependency "rspec", "
|
25
|
-
spec.
|
26
|
-
spec.
|
23
|
+
spec.add_development_dependency "rake", ">= 13.0.6", "< 14.0"
|
24
|
+
spec.add_development_dependency "rspec", ">= 3.11.0", "< 4.0"
|
25
|
+
spec.add_development_dependency "rubocop", ">= 1.28.2", "< 2.0"
|
26
|
+
spec.add_development_dependency "rubocop-rspec", ">= 2.10.0", "< 3.0"
|
27
|
+
spec.add_dependency "faraday", ">= 1.0", "< 3.0"
|
28
|
+
spec.required_ruby_version = ">= 2.7"
|
27
29
|
end
|
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)
|
@@ -39,13 +39,13 @@ class AmplitudeAPI
|
|
39
39
|
|
40
40
|
def create_setter(attribute_name)
|
41
41
|
self.class.send(:define_method, "#{attribute_name}=".to_sym) do |value|
|
42
|
-
instance_variable_set("
|
42
|
+
instance_variable_set("@#{attribute_name}", value)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
def create_getter(attribute_name)
|
47
47
|
self.class.send(:define_method, attribute_name.to_sym) do
|
48
|
-
instance_variable_get("
|
48
|
+
instance_variable_get("@#{attribute_name}")
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
data/lib/amplitude_api.rb
CHANGED
@@ -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
|
|
@@ -432,7 +432,7 @@ describe AmplitudeAPI do
|
|
432
432
|
end
|
433
433
|
|
434
434
|
describe ".delete" do
|
435
|
-
let(:connection) { instance_double("Faraday::Connection", post: nil,
|
435
|
+
let(:connection) { instance_double("Faraday::Connection", post: nil, request: nil) }
|
436
436
|
|
437
437
|
before do
|
438
438
|
allow(Faraday).to receive(:new).and_yield(connection).and_return(connection)
|
@@ -445,7 +445,7 @@ describe AmplitudeAPI do
|
|
445
445
|
|
446
446
|
described_class.delete(user_ids: "123")
|
447
447
|
|
448
|
-
expect(connection).to have_received(:
|
448
|
+
expect(connection).to have_received(:request).with(:basic_auth, api_key, secret_key)
|
449
449
|
end
|
450
450
|
|
451
451
|
it "sends the requester" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amplitude-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Rakoczy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -30,54 +30,100 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
- - "
|
33
|
+
version: 13.0.6
|
34
|
+
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
36
|
+
version: '14.0'
|
37
37
|
type: :development
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
-
- - "
|
43
|
+
version: 13.0.6
|
44
|
+
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '14.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
54
|
-
- - "
|
53
|
+
version: 3.11.0
|
54
|
+
- - "<"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '
|
56
|
+
version: '4.0'
|
57
57
|
type: :development
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
64
|
-
- - "
|
63
|
+
version: 3.11.0
|
64
|
+
- - "<"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '4.0'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: rubocop
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 1.28.2
|
74
|
+
- - "<"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '2.0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 1.28.2
|
84
|
+
- - "<"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '2.0'
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: rubocop-rspec
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.10.0
|
94
|
+
- - "<"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
type: :development
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.10.0
|
104
|
+
- - "<"
|
65
105
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
106
|
+
version: '3.0'
|
67
107
|
- !ruby/object:Gem::Dependency
|
68
108
|
name: faraday
|
69
109
|
requirement: !ruby/object:Gem::Requirement
|
70
110
|
requirements:
|
71
|
-
- - "
|
111
|
+
- - ">="
|
72
112
|
- !ruby/object:Gem::Version
|
73
|
-
version: '1.
|
113
|
+
version: '1.0'
|
114
|
+
- - "<"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '3.0'
|
74
117
|
type: :runtime
|
75
118
|
prerelease: false
|
76
119
|
version_requirements: !ruby/object:Gem::Requirement
|
77
120
|
requirements:
|
78
|
-
- - "
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '1.0'
|
124
|
+
- - "<"
|
79
125
|
- !ruby/object:Gem::Version
|
80
|
-
version: '
|
126
|
+
version: '3.0'
|
81
127
|
description: Provides an integration for sending events to Amplitude
|
82
128
|
email:
|
83
129
|
- arakoczy@gmail.com
|
@@ -92,11 +138,9 @@ files:
|
|
92
138
|
- ".yardopts"
|
93
139
|
- Changelog.md
|
94
140
|
- Gemfile
|
95
|
-
- Gemfile.lock
|
96
141
|
- LICENSE
|
97
142
|
- Rakefile
|
98
143
|
- amplitude-api.gemspec
|
99
|
-
- lib/amplitude-api.rb
|
100
144
|
- lib/amplitude_api.rb
|
101
145
|
- lib/amplitude_api/config.rb
|
102
146
|
- lib/amplitude_api/event.rb
|
@@ -119,14 +163,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
163
|
requirements:
|
120
164
|
- - ">="
|
121
165
|
- !ruby/object:Gem::Version
|
122
|
-
version: '2.
|
166
|
+
version: '2.7'
|
123
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
168
|
requirements:
|
125
169
|
- - ">="
|
126
170
|
- !ruby/object:Gem::Version
|
127
171
|
version: '0'
|
128
172
|
requirements: []
|
129
|
-
rubygems_version: 3.
|
173
|
+
rubygems_version: 3.1.6
|
130
174
|
signing_key:
|
131
175
|
specification_version: 4
|
132
176
|
summary: Send events to the Amplitude API
|
data/Gemfile.lock
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
ast (2.4.0)
|
5
|
-
coderay (1.1.2)
|
6
|
-
diff-lcs (1.3)
|
7
|
-
faraday (1.3.0)
|
8
|
-
faraday-net_http (~> 1.0)
|
9
|
-
multipart-post (>= 1.2, < 3)
|
10
|
-
ruby2_keywords
|
11
|
-
faraday-net_http (1.0.1)
|
12
|
-
jaro_winkler (1.5.2)
|
13
|
-
method_source (0.9.2)
|
14
|
-
multipart-post (2.1.1)
|
15
|
-
parallel (1.17.0)
|
16
|
-
parser (2.6.2.0)
|
17
|
-
ast (~> 2.4.0)
|
18
|
-
pry (0.12.2)
|
19
|
-
coderay (~> 1.1.0)
|
20
|
-
method_source (~> 0.9.0)
|
21
|
-
psych (3.1.0)
|
22
|
-
rainbow (3.0.0)
|
23
|
-
rake (12.3.3)
|
24
|
-
rspec (3.8.0)
|
25
|
-
rspec-core (~> 3.8.0)
|
26
|
-
rspec-expectations (~> 3.8.0)
|
27
|
-
rspec-mocks (~> 3.8.0)
|
28
|
-
rspec-core (3.8.0)
|
29
|
-
rspec-support (~> 3.8.0)
|
30
|
-
rspec-expectations (3.8.2)
|
31
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.8.0)
|
33
|
-
rspec-mocks (3.8.0)
|
34
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
-
rspec-support (~> 3.8.0)
|
36
|
-
rspec-support (3.8.0)
|
37
|
-
rubocop (0.66.0)
|
38
|
-
jaro_winkler (~> 1.5.1)
|
39
|
-
parallel (~> 1.10)
|
40
|
-
parser (>= 2.5, != 2.5.1.1)
|
41
|
-
psych (>= 3.1.0)
|
42
|
-
rainbow (>= 2.2.2, < 4.0)
|
43
|
-
ruby-progressbar (~> 1.7)
|
44
|
-
unicode-display_width (>= 1.4.0, < 1.6)
|
45
|
-
rubocop-rspec (1.32.0)
|
46
|
-
rubocop (>= 0.60.0)
|
47
|
-
ruby-progressbar (1.10.0)
|
48
|
-
ruby2_keywords (0.0.4)
|
49
|
-
unicode-display_width (1.5.0)
|
50
|
-
|
51
|
-
PLATFORMS
|
52
|
-
ruby
|
53
|
-
|
54
|
-
DEPENDENCIES
|
55
|
-
faraday (~> 1.3)
|
56
|
-
pry (~> 0.12.2)
|
57
|
-
rake (>= 12.0)
|
58
|
-
rspec (>= 2.99.0)
|
59
|
-
rubocop (~> 0.66.0)
|
60
|
-
rubocop-rspec
|
61
|
-
|
62
|
-
BUNDLED WITH
|
63
|
-
1.17.3
|
data/lib/amplitude-api.rb
DELETED