leanplum_api 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5a76aed3d020547e134ee3a112266a894ede780
|
4
|
+
data.tar.gz: 79ef59a1a63018388963bd3d71de1af95ac9cd72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7878726aa0f68c2445c941e3e695ee341780836625f9022fe4a4efa80fbb89f6163fc11991f56781e36132b47b9a2e325bb7452a0bfcefd18892b8e1d2a7543e
|
7
|
+
data.tar.gz: 8c2cbb38fbc6f12b439f6f01512bdb94a952bb6fc895ed8f57853b5a57a01605ba73b88f4585db0f9991cc6a29f8ea4f3365412e92e692636b30689682ed8977
|
@@ -16,8 +16,10 @@ module LeanplumApi
|
|
16
16
|
|
17
17
|
@app.call(environment).on_complete do |response|
|
18
18
|
fail ResourceNotFoundError, response.inspect if response.status == 404
|
19
|
-
fail BadResponseError, response.inspect unless response.status == 200
|
20
|
-
|
19
|
+
fail BadResponseError, response.inspect unless response.status == 200
|
20
|
+
|
21
|
+
responses = response.body['response']
|
22
|
+
fail BadResponseError, "No response array: #{response.inspect}" unless responses.is_a?(Array)
|
21
23
|
|
22
24
|
validate_request_success(responses, requests) if LeanplumApi.configuration.validate_response
|
23
25
|
end
|
@@ -27,7 +29,7 @@ module LeanplumApi
|
|
27
29
|
|
28
30
|
def validate_request_success(success_indicators, requests)
|
29
31
|
if requests && success_indicators.size != requests.size
|
30
|
-
fail BadResponseError, "Attempted #{requests.size} operations
|
32
|
+
fail BadResponseError, "Attempted #{requests.size} operations; responses for only #{success_indicators.size}!"
|
31
33
|
end
|
32
34
|
|
33
35
|
failures = success_indicators.map.with_index do |indicator, i|
|
@@ -37,7 +39,8 @@ module LeanplumApi
|
|
37
39
|
|
38
40
|
next nil if indicator[SUCCESS].to_s == 'true'
|
39
41
|
|
40
|
-
|
42
|
+
failure = { message: indicator.key?(SUCCESS) ? indicator.to_s : "No :success key found in #{indicator}" }
|
43
|
+
requests ? failure.merge(operation: requests[i]) : failure
|
41
44
|
end.compact
|
42
45
|
|
43
46
|
unless failures.empty?
|
data/lib/leanplum_api/version.rb
CHANGED
data/spec/api_spec.rb
CHANGED
@@ -302,17 +302,17 @@ describe LeanplumApi::API do
|
|
302
302
|
end
|
303
303
|
|
304
304
|
context 'hash utility methods' do
|
305
|
-
let(:hash_with_times) { { not_time: 'grippin', time:
|
305
|
+
let(:hash_with_times) { { not_time: 'grippin', time: last_event_time, date: last_event_time.to_date } }
|
306
306
|
|
307
307
|
it 'turns datetimes into seconds from the epoch' do
|
308
308
|
expect(api.send(:fix_seconds_since_epoch, hash_with_times)).to eq(
|
309
|
-
hash_with_times.merge(time:
|
309
|
+
hash_with_times.merge(time: last_event_time.strftime('%s').to_i, date: last_event_time.to_date.strftime('%s').to_i)
|
310
310
|
)
|
311
311
|
end
|
312
312
|
|
313
313
|
it 'turns datetimes into iso8601 format' do
|
314
314
|
expect(api.send(:fix_iso8601, hash_with_times)).to eq(
|
315
|
-
hash_with_times.merge(time:
|
315
|
+
hash_with_times.merge(time: last_event_time.iso8601, date: last_event_time.to_date.iso8601)
|
316
316
|
)
|
317
317
|
end
|
318
318
|
end
|
@@ -10,17 +10,17 @@ describe LeanplumApi::DataExportAPI do
|
|
10
10
|
context 'data export methods' do
|
11
11
|
context 'export_data' do
|
12
12
|
context 'regular export' do
|
13
|
-
it 'should request a data export job with a starttime' do
|
14
|
-
VCR.use_cassette('export_data') do
|
15
|
-
expect { api.export_data(Time.at(1438660800).utc) }.to raise_error LeanplumApi::BadResponseError
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
13
|
it 'should request a data export job with start and end dates' do
|
20
14
|
VCR.use_cassette('export_data_dates') do
|
21
15
|
expect { api.export_data(Date.new(2017, 8, 5), Date.new(2017, 8, 6)) }.to_not raise_error
|
22
16
|
end
|
23
17
|
end
|
18
|
+
|
19
|
+
it 'should exception when requesting a data export job with an invalid starttime' do
|
20
|
+
VCR.use_cassette('export_data') do
|
21
|
+
expect { api.export_data(Time.at(1438660800).utc) }.to raise_error LeanplumApi::BadResponseError
|
22
|
+
end
|
23
|
+
end
|
24
24
|
end
|
25
25
|
|
26
26
|
context 's3 export' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leanplum_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lumos Labs, Inc.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-09-
|
12
|
+
date: 2017-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|