leanplum_api 1.3.1

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.
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://www.leanplum.com/api?action=multi&apiVersion=1.0.6&appId=<LEANPLUM_APP_ID>&clientKey=<LEANPLUM_PRODUCTION_KEY>&devMode=false&time=1439337600
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"data":[{"userId":123456,"action":"setUserAttributes","userAttributes":{"first_name":"Mike","last_name":"Jones","gender":"m","email":"still_tippin@test.com","create_date":"2010-01-01"}},{"userId":12345,"time":"1439337600","action":"track","event":"purchase","params":{"params":{"some_timestamp":"2015-05-01
9
+ 01:02:03"}}},{"userId":54321,"time":"1439337000","action":"track","event":"purchase_page_view"}]}'
10
+ headers:
11
+ User-Agent:
12
+ - Faraday v0.9.2
13
+ Content-Type:
14
+ - application/json
15
+ Accept-Encoding:
16
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
17
+ Accept:
18
+ - "*/*"
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ Access-Control-Allow-Origin:
25
+ - "*"
26
+ Content-Type:
27
+ - application/json
28
+ Date:
29
+ - Wed, 04 Nov 2015 20:50:05 GMT
30
+ Server:
31
+ - Google Frontend
32
+ Cache-Control:
33
+ - private
34
+ Alt-Svc:
35
+ - quic=":443"; p="1"; ma=604800
36
+ Transfer-Encoding:
37
+ - chunked
38
+ body:
39
+ encoding: UTF-8
40
+ string: '{"response":[{"isOffline":true,"success":true,"warning":{"message":"Anomaly
41
+ detected: time skew. User will be excluded from analytics."}},{"success":true,"warning":{"message":"Anomaly
42
+ detected: time skew. User will be excluded from analytics."}},{"success":true,"warning":{"message":"Anomaly
43
+ detected: time skew. User will be excluded from analytics."}}]}'
44
+ http_version:
45
+ recorded_at: Wed, 12 Aug 2015 00:00:00 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,86 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://www.leanplum.com/api?action=multi&apiVersion=1.0.6&appId=<LEANPLUM_APP_ID>&clientKey=<LEANPLUM_PRODUCTION_KEY>&devMode=false&time=1439337600
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"data":[{"userId":12345,"time":"1439337600","action":"track","event":"purchase","params":{"params":{"some_timestamp":"2015-05-01
9
+ 01:02:03"}}},{"userId":54321,"time":"1439337000","action":"track","event":"purchase_page_view"}]}'
10
+ headers:
11
+ User-Agent:
12
+ - Faraday v0.9.2
13
+ Content-Type:
14
+ - application/json
15
+ Accept-Encoding:
16
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
17
+ Accept:
18
+ - "*/*"
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ Access-Control-Allow-Origin:
25
+ - "*"
26
+ Content-Type:
27
+ - application/json
28
+ Date:
29
+ - Thu, 05 Nov 2015 07:53:30 GMT
30
+ Server:
31
+ - Google Frontend
32
+ Cache-Control:
33
+ - private
34
+ Alt-Svc:
35
+ - quic=":443"; p="1"; ma=604800
36
+ Transfer-Encoding:
37
+ - chunked
38
+ body:
39
+ encoding: UTF-8
40
+ string: '{"response":[{"isOffline":true,"success":true,"warning":{"message":"Anomaly
41
+ detected: time skew. User will be excluded from analytics."}},{"success":true,"warning":{"message":"Anomaly
42
+ detected: time skew. User will be excluded from analytics."}}]}'
43
+ http_version:
44
+ recorded_at: Wed, 12 Aug 2015 00:00:00 GMT
45
+ - request:
46
+ method: post
47
+ uri: https://www.leanplum.com/api?action=multi&apiVersion=1.0.6&appId=<LEANPLUM_APP_ID>&clientKey=<LEANPLUM_DEVELOPMENT_KEY>&devMode=false&time=1439337600
48
+ body:
49
+ encoding: UTF-8
50
+ string: '{"data":[{"action":"setUserAttributes","resetAnomalies":true,"userId":12345},{"action":"setUserAttributes","resetAnomalies":true,"userId":54321}]}'
51
+ headers:
52
+ User-Agent:
53
+ - Faraday v0.9.2
54
+ Content-Type:
55
+ - application/json
56
+ Accept-Encoding:
57
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
58
+ Accept:
59
+ - "*/*"
60
+ response:
61
+ status:
62
+ code: 200
63
+ message: OK
64
+ headers:
65
+ Access-Control-Allow-Origin:
66
+ - "*"
67
+ Content-Type:
68
+ - application/json
69
+ Date:
70
+ - Thu, 05 Nov 2015 07:53:30 GMT
71
+ Server:
72
+ - Google Frontend
73
+ Cache-Control:
74
+ - private
75
+ Alt-Svc:
76
+ - quic=":443"; p="1"; ma=604800
77
+ Transfer-Encoding:
78
+ - chunked
79
+ body:
80
+ encoding: UTF-8
81
+ string: '{"response":[{"success":true,"warning":{"message":"Anomaly detected:
82
+ time skew. User will be excluded from analytics."}},{"success":true,"warning":{"message":"Anomaly
83
+ detected: time skew. User will be excluded from analytics."}}]}'
84
+ http_version:
85
+ recorded_at: Wed, 12 Aug 2015 00:00:00 GMT
86
+ recorded_with: VCR 2.9.3
data/spec/http_spec.rb ADDED
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe LeanplumApi::HTTP do
4
+ context 'regular mode' do
5
+ it 'should build the right multi url' do
6
+ http = described_class.new
7
+ expect(http.send(:authed_multi_param_string)).to eq("appId=#{ENV.fetch('LEANPLUM_APP_ID')}&clientKey=#{ENV.fetch('LEANPLUM_PRODUCTION_KEY')}&apiVersion=1.0.6&devMode=false&action=multi&time=#{Time.now.utc.strftime('%s')}")
8
+ end
9
+ end
10
+
11
+ context 'devMode' do
12
+ around(:all) do |example|
13
+ LeanplumApi.configure { |c| c.developer_mode = true }
14
+ example.run
15
+ LeanplumApi.configure { |c| c.developer_mode = false }
16
+ end
17
+
18
+ it 'should build the right developer mode url' do
19
+ http = described_class.new
20
+ expect(http.send(:authed_multi_param_string)).to eq("appId=#{ENV.fetch('LEANPLUM_APP_ID')}&clientKey=#{ENV.fetch('LEANPLUM_PRODUCTION_KEY')}&apiVersion=1.0.6&devMode=true&action=multi&time=#{Time.now.utc.strftime('%s')}")
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,45 @@
1
+ ENV['RAILS_ENV'] = 'test'
2
+ require 'rspec'
3
+ require 'leanplum_api'
4
+ require 'timecop'
5
+ require 'webmock'
6
+ require 'webmock/rspec'
7
+ require 'vcr'
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ RSpec.configure do |config|
13
+ config.before(:all) do
14
+ FileUtils.mkdir('log') unless File.exist?('log')
15
+
16
+ LeanplumApi.configure do |configuration|
17
+ configuration.production_key = ENV.fetch('LEANPLUM_PRODUCTION_KEY')
18
+ configuration.app_id = ENV.fetch('LEANPLUM_APP_ID')
19
+ configuration.data_export_key = ENV.fetch('LEANPLUM_DATA_EXPORT_KEY')
20
+ configuration.content_read_only_key = ENV.fetch('LEANPLUM_CONTENT_READ_ONLY_KEY')
21
+ configuration.development_key = ENV.fetch('LEANPLUM_DEVELOPMENT_KEY')
22
+ end
23
+
24
+ Timecop.freeze('2015-08-12'.to_time.utc)
25
+ end
26
+
27
+ config.after(:suite) do
28
+ Dir['log/*.log'].each { |file| File.delete(file) }
29
+ FileUtils.rmdir('log')
30
+ end
31
+ end
32
+
33
+ VCR.configure do |c|
34
+ c.cassette_library_dir = 'spec/fixtures/vcr'
35
+ c.hook_into :webmock
36
+ c.filter_sensitive_data('<LEANPLUM_PRODUCTION_KEY>') { ENV.fetch('LEANPLUM_PRODUCTION_KEY') }
37
+ c.filter_sensitive_data('<LEANPLUM_APP_ID>') { ENV.fetch('LEANPLUM_APP_ID') }
38
+ c.filter_sensitive_data('<LEANPLUM_CONTENT_READ_ONLY_KEY>') { ENV.fetch('LEANPLUM_CONTENT_READ_ONLY_KEY') }
39
+ c.filter_sensitive_data('<LEANPLUM_DATA_EXPORT_KEY>') { ENV.fetch('LEANPLUM_DATA_EXPORT_KEY') }
40
+ c.filter_sensitive_data('<LEANPLUM_DEVELOPMENT_KEY>') { ENV.fetch('LEANPLUM_DEVELOPMENT_KEY') }
41
+
42
+ c.default_cassette_options = {
43
+ match_requests_on: [:method, :uri, :body]
44
+ }
45
+ end
metadata ADDED
@@ -0,0 +1,211 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: leanplum_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.1
5
+ platform: ruby
6
+ authors:
7
+ - Lumos Labs, Inc.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.9'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 0.9.1
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '0.9'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 0.9.1
47
+ - !ruby/object:Gem::Dependency
48
+ name: faraday_middleware
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0.10'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0.10'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '10.4'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '10.4'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '3'
89
+ - !ruby/object:Gem::Dependency
90
+ name: timecop
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0.8'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0.8'
103
+ - !ruby/object:Gem::Dependency
104
+ name: vcr
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '2'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '2'
117
+ - !ruby/object:Gem::Dependency
118
+ name: webmock
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '1'
131
+ description: Ruby-esque access to Leanplum API
132
+ email:
133
+ - analytics-dev@lumoslabs.com
134
+ executables: []
135
+ extensions: []
136
+ extra_rdoc_files: []
137
+ files:
138
+ - Gemfile
139
+ - LICENSE.txt
140
+ - README.md
141
+ - Rakefile
142
+ - lib/leanplum_api.rb
143
+ - lib/leanplum_api/api.rb
144
+ - lib/leanplum_api/configuration.rb
145
+ - lib/leanplum_api/content_read_only.rb
146
+ - lib/leanplum_api/data_export.rb
147
+ - lib/leanplum_api/development.rb
148
+ - lib/leanplum_api/exception.rb
149
+ - lib/leanplum_api/http.rb
150
+ - lib/leanplum_api/logger.rb
151
+ - lib/leanplum_api/version.rb
152
+ - spec/api_spec.rb
153
+ - spec/configuration_spec.rb
154
+ - spec/fixtures/vcr/export_data.yml
155
+ - spec/fixtures/vcr/export_data_dates.yml
156
+ - spec/fixtures/vcr/export_user.yml
157
+ - spec/fixtures/vcr/get_ab_test.yml
158
+ - spec/fixtures/vcr/get_ab_tests.yml
159
+ - spec/fixtures/vcr/get_export_results.yml
160
+ - spec/fixtures/vcr/get_messages.yml
161
+ - spec/fixtures/vcr/get_vars.yml
162
+ - spec/fixtures/vcr/reset_anomalous_user.yml
163
+ - spec/fixtures/vcr/set_user_attributes.yml
164
+ - spec/fixtures/vcr/track_events.yml
165
+ - spec/fixtures/vcr/track_events_and_attributes.yml
166
+ - spec/fixtures/vcr/track_events_anomaly_overrider.yml
167
+ - spec/http_spec.rb
168
+ - spec/spec_helper.rb
169
+ homepage: http://www.github.com/lumoslabs/leanplum_api
170
+ licenses:
171
+ - MIT
172
+ metadata: {}
173
+ post_install_message:
174
+ rdoc_options: []
175
+ require_paths:
176
+ - lib
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: 1.9.3
182
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ requirements: []
188
+ rubyforge_project:
189
+ rubygems_version: 2.2.3
190
+ signing_key:
191
+ specification_version: 4
192
+ summary: Gem for the Leanplum API
193
+ test_files:
194
+ - spec/api_spec.rb
195
+ - spec/configuration_spec.rb
196
+ - spec/fixtures/vcr/export_data.yml
197
+ - spec/fixtures/vcr/export_data_dates.yml
198
+ - spec/fixtures/vcr/export_user.yml
199
+ - spec/fixtures/vcr/get_ab_test.yml
200
+ - spec/fixtures/vcr/get_ab_tests.yml
201
+ - spec/fixtures/vcr/get_export_results.yml
202
+ - spec/fixtures/vcr/get_messages.yml
203
+ - spec/fixtures/vcr/get_vars.yml
204
+ - spec/fixtures/vcr/reset_anomalous_user.yml
205
+ - spec/fixtures/vcr/set_user_attributes.yml
206
+ - spec/fixtures/vcr/track_events.yml
207
+ - spec/fixtures/vcr/track_events_and_attributes.yml
208
+ - spec/fixtures/vcr/track_events_anomaly_overrider.yml
209
+ - spec/http_spec.rb
210
+ - spec/spec_helper.rb
211
+ has_rdoc: