clever_tap_dubit 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.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.rspec +1 -0
  4. data/.rubocop.yml +48 -0
  5. data/.travis.yml +6 -0
  6. data/Gemfile +16 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +164 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +8 -0
  11. data/bin/setup +8 -0
  12. data/clever_tap.gemspec +33 -0
  13. data/lib/clever_tap/client.rb +113 -0
  14. data/lib/clever_tap/config.rb +25 -0
  15. data/lib/clever_tap/entity.rb +87 -0
  16. data/lib/clever_tap/event.rb +30 -0
  17. data/lib/clever_tap/failed_response.rb +28 -0
  18. data/lib/clever_tap/profile.rb +7 -0
  19. data/lib/clever_tap/response.rb +34 -0
  20. data/lib/clever_tap/successful_response.rb +30 -0
  21. data/lib/clever_tap/uploader.rb +72 -0
  22. data/lib/clever_tap/version.rb +3 -0
  23. data/lib/clever_tap.rb +79 -0
  24. data/lib/clevertap-ruby.rb +1 -0
  25. data/spec/factories/profile.rb +36 -0
  26. data/spec/integrations/clever_tap_spec.rb +81 -0
  27. data/spec/rubocop_spec.rb +12 -0
  28. data/spec/shared/clever_tap_client.rb +13 -0
  29. data/spec/shared/entity.rb +105 -0
  30. data/spec/spec_helper.rb +18 -0
  31. data/spec/units/clever_tap_client_spec.rb +277 -0
  32. data/spec/units/clever_tap_spec.rb +88 -0
  33. data/spec/units/event_spec.rb +43 -0
  34. data/spec/units/failed_response_spec.rb +31 -0
  35. data/spec/units/profile_spec.rb +29 -0
  36. data/spec/units/response_spec.rb +63 -0
  37. data/spec/units/successful_response_spec.rb +112 -0
  38. data/spec/units/uploader_spec.rb +129 -0
  39. data/spec/vcr_cassettes/CleverTap/uploading_a_many_profiles/when_only_some_are_valid/partially_succeds.yml +42 -0
  40. data/spec/vcr_cassettes/CleverTap/uploading_a_profile/when_is_invalid/fails.yml +41 -0
  41. data/spec/vcr_cassettes/CleverTap/uploading_a_profile/when_is_valid/succeed.yml +35 -0
  42. data/spec/vcr_cassettes/CleverTap/uploading_an_event/when_is_valid/succeed.yml +34 -0
  43. data/spec/vcr_cassettes/CleverTap_Client/_upload/when_upload_records_are_homogenous/and_invalid_records/calls_on_failed_upload_once.yml +38 -0
  44. data/spec/vcr_cassettes/CleverTap_Client/_upload/when_upload_records_are_homogenous/and_invalid_records/returns_an_array_with_one_failed_Response_object.yml +38 -0
  45. data/spec/vcr_cassettes/CleverTap_Client/_upload/when_upload_records_are_homogenous/and_valid_records/and_objects_do_not_fit_upload_limit_/calls_on_successful_upload_proc_twice.yml +67 -0
  46. data/spec/vcr_cassettes/CleverTap_Client/_upload/when_upload_records_are_homogenous/and_valid_records/and_objects_do_not_fit_upload_limit_/returns_an_array_with_two_successful_Response_objects.yml +67 -0
  47. data/spec/vcr_cassettes/CleverTap_Client/_upload/when_upload_records_are_homogenous/and_valid_records/and_objects_fit_upload_limit_/calls_on_successful_upload_proc_once.yml +36 -0
  48. data/spec/vcr_cassettes/CleverTap_Client/_upload/when_upload_records_are_homogenous/and_valid_records/and_objects_fit_upload_limit_/returns_an_array_with_one_successful_Response_object.yml +36 -0
  49. data/spec/vcr_cassettes/CleverTap_Uploader/_call/when_age_is_invalid/behaves_like_validation_failure/failed_to_upload_the_profiles.yml +48 -0
  50. data/spec/vcr_cassettes/CleverTap_Uploader/_call/when_education_status_is_invalid/behaves_like_validation_failure/failed_to_upload_the_profiles.yml +49 -0
  51. data/spec/vcr_cassettes/CleverTap_Uploader/_call/when_email_is_invalid/behaves_like_validation_failure/failed_to_upload_the_profiles.yml +48 -0
  52. data/spec/vcr_cassettes/CleverTap_Uploader/_call/when_employment_status_is_invalid/behaves_like_validation_failure/failed_to_upload_the_profiles.yml +48 -0
  53. data/spec/vcr_cassettes/CleverTap_Uploader/_call/when_marital_status_is_invalid/behaves_like_validation_failure/failed_to_upload_the_profiles.yml +48 -0
  54. data/spec/vcr_cassettes/CleverTap_Uploader/_call/when_phone_is_invalid/behaves_like_validation_failure/failed_to_upload_the_profiles.yml +48 -0
  55. data/spec/vcr_cassettes/CleverTap_Uploader/_call/when_the_creation_date_field_is_missing/behaves_like_validation_failure/failed_to_upload_the_profiles.yml +48 -0
  56. data/spec/vcr_cassettes/CleverTap_Uploader/_call/with_invalid_credentials/failed_to_upload_the_profiles.yml +36 -0
  57. data/spec/vcr_cassettes/CleverTap_Uploader/_call/with_valid_data/makes_successful_upload.yml +36 -0
  58. data/spec/vcr_config.rb +13 -0
  59. metadata +192 -0
@@ -0,0 +1,129 @@
1
+ require 'spec_helper'
2
+
3
+ shared_examples_for 'validation failure' do |expected_code|
4
+ it 'failed to upload the profiles' do
5
+ result = subject.call(client)
6
+ body = JSON.parse(result.body)
7
+
8
+ aggregate_failures 'failed response' do
9
+ expect(result.success?).to be_truthy
10
+ expect(result.status).to eq(200)
11
+ expect(body).to include('processed' => 0,
12
+ 'status' => 'fail',
13
+ 'unprocessed' => contain_exactly(
14
+ a_hash_including('code' => expected_code),
15
+ a_hash_including('code' => expected_code)
16
+ ))
17
+ end
18
+ end
19
+ end
20
+
21
+ describe CleverTap::Uploader, vcr: true do
22
+ describe '#call' do
23
+ let(:profile_properties) { %i[id created_at full_name last_name bta] }
24
+ let(:client) { CleverTap::Client.new(AUTH_ACCOUNT_ID, AUTH_PASSCODE) }
25
+
26
+ context 'with valid data' do
27
+ let(:profiles) { [Profile.build_valid, Profile.build_valid] }
28
+
29
+ subject { described_class.new(profiles, identity_field: 'identity') }
30
+
31
+ it 'makes successful upload' do
32
+ result = subject.call(client)
33
+ body = JSON.parse(result.body)
34
+
35
+ aggregate_failures 'success response' do
36
+ expect(result.success?).to be_truthy
37
+ expect(result.status).to eq(200)
38
+ expect(body).to include('processed' => 2, 'unprocessed' => [], 'status' => 'success')
39
+ end
40
+ end
41
+ end
42
+
43
+ context 'when email is invalid' do
44
+ let(:profiles) { [Profile.build_valid('Email' => '1234'), Profile.build_valid('Email' => '1234')] }
45
+
46
+ subject { described_class.new(profiles, identity_field: 'identity') }
47
+
48
+ it_behaves_like 'validation failure', 515
49
+ end
50
+
51
+ context 'when phone is invalid' do
52
+ let(:profiles) { [Profile.build_valid('Phone' => '223'), Profile.build_valid('Phone' => '123')] }
53
+
54
+ subject { described_class.new(profiles, identity_field: 'identity') }
55
+
56
+ it_behaves_like 'validation failure', 516
57
+ end
58
+
59
+ context 'when employment status is invalid' do
60
+ let(:profiles) { [Profile.build_valid('Employed' => '223'), Profile.build_valid('Employed' => '123')] }
61
+
62
+ subject { described_class.new(profiles, identity_field: 'identity') }
63
+
64
+ it_behaves_like 'validation failure', 517
65
+ end
66
+
67
+ context 'when education status is invalid' do
68
+ let(:profiles) { [Profile.build_valid('Education' => '223'), Profile.build_valid('Education' => '123')] }
69
+
70
+ subject { described_class.new(profiles, identity_field: 'identity') }
71
+
72
+ it_behaves_like 'validation failure', 518
73
+ end
74
+
75
+ context 'when marital status is invalid' do
76
+ let(:profiles) { [Profile.build_valid('Married' => '223'), Profile.build_valid('Married' => '123')] }
77
+
78
+ subject { described_class.new(profiles, identity_field: 'identity') }
79
+
80
+ it_behaves_like 'validation failure', 519
81
+ end
82
+
83
+ context 'when age is invalid' do
84
+ let(:profiles) { [Profile.build_valid('Age' => 'aa'), Profile.build_valid('Age' => 'aa')] }
85
+
86
+ subject { described_class.new(profiles, identity_field: 'identity') }
87
+
88
+ it_behaves_like 'validation failure', 520
89
+ end
90
+
91
+ context 'when the identity field is missing' do
92
+ let(:profiles) { [Profile.build_valid, Profile.build_valid] }
93
+
94
+ subject { described_class.new(profiles, identity_field: 'fake_id') }
95
+
96
+ it do
97
+ expect { subject.call(client) }.to raise_error(RuntimeError, /missing identity field/i)
98
+ end
99
+ end
100
+
101
+ context 'when the creation date field is missing' do
102
+ let(:profiles) { [Profile.build_valid, Profile.build_valid] }
103
+
104
+ subject do
105
+ described_class.new(profiles, identity_field: 'identity', date_field: 'fake_created_at')
106
+ end
107
+
108
+ it_behaves_like 'validation failure', 525
109
+ end
110
+
111
+ context 'with invalid credentials' do
112
+ let(:client) { CleverTap::Client.new('fake-id', 'fake-pass') }
113
+ subject { described_class.new([Profile.build_valid], identity_field: 'identity') }
114
+
115
+ it 'failed to upload the profiles' do
116
+ result = subject.call(client)
117
+ body = JSON.parse(result.body)
118
+
119
+ aggregate_failures 'failed response' do
120
+ expect(result.success?).to be_falsy
121
+ expect(result.status).to eq(401)
122
+ expect(body).to include('code' => 401,
123
+ 'status' => 'fail',
124
+ 'error' => matching(/account id/i))
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.clevertap.com/1/upload
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"d":[{"identity":"3","ts":1521649274,"type":"profile","profileData":{"identity":3,"created_at":"2018-03-21
9
+ 18:21:14 +0200","Name":"John Rush","Email":"example@gmail.com","Gender":"M","Phone":"+35922333232","Employed":"Y","Education":"Graduate","Married":"Y","Age":"18"}},{"identity":"4","ts":1521649274,"type":"profile","profileData":{"identity":4,"created_at":"2018-03-21
10
+ 18:21:14 +0200","Name":"John Rush","Email":"$$$$$","Gender":"M","Phone":"+35922333232","Employed":"Y","Education":"Graduate","Married":"Y","Age":"18"}}]}'
11
+ headers:
12
+ Content-Type:
13
+ - application/json
14
+ X-CleverTap-Account-Id:
15
+ - fake_account_id
16
+ X-CleverTap-Passcode:
17
+ - fake_passcode
18
+ User-Agent:
19
+ - Faraday v0.14.0
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ content-type:
26
+ - application/json;charset=utf-8
27
+ content-length:
28
+ - '505'
29
+ connection:
30
+ - Close
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{ "status" : "partial" , "processed" : 1 , "unprocessed" : [ { "status"
34
+ : "fail" , "code" : 515 , "error" : "Profile data is incorrect. Email is not
35
+ valid.Skipped record number : 2" , "record" : { "identity" : "4" , "ts" :
36
+ 1521649274 , "type" : "profile" , "profileData" : { "identity" : 4 , "created_at"
37
+ : "2018-03-21 18:21:14 +0200" , "Name" : "John Rush" , "Email" : "$$$$$" ,
38
+ "Gender" : "M" , "Phone" : "+35922333232" , "Employed" : "Y" , "Education"
39
+ : "Graduate" , "Married" : "Y" , "Age" : "18"}}}]}'
40
+ http_version:
41
+ recorded_at: Wed, 21 Mar 2018 16:21:15 GMT
42
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,41 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.clevertap.com/1/upload
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"d":[{"identity":"2","ts":1521649274,"type":"profile","profileData":{"identity":2,"created_at":"2018-03-21
9
+ 18:21:14 +0200","Name":"John Rush","Email":"$$$$$","Gender":"M","Phone":"+35922333232","Employed":"Y","Education":"Graduate","Married":"Y","Age":"18"}}]}'
10
+ headers:
11
+ Content-Type:
12
+ - application/json
13
+ X-CleverTap-Account-Id:
14
+ - fake_account_id
15
+ X-CleverTap-Passcode:
16
+ - fake_passcode
17
+ User-Agent:
18
+ - Faraday v0.14.0
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ content-type:
25
+ - application/json;charset=utf-8
26
+ content-length:
27
+ - '502'
28
+ connection:
29
+ - Close
30
+ body:
31
+ encoding: UTF-8
32
+ string: '{ "status" : "fail" , "processed" : 0 , "unprocessed" : [ { "status"
33
+ : "fail" , "code" : 515 , "error" : "Profile data is incorrect. Email is not
34
+ valid.Skipped record number : 1" , "record" : { "identity" : "2" , "ts" :
35
+ 1521649274 , "type" : "profile" , "profileData" : { "identity" : 2 , "created_at"
36
+ : "2018-03-21 18:21:14 +0200" , "Name" : "John Rush" , "Email" : "$$$$$" ,
37
+ "Gender" : "M" , "Phone" : "+35922333232" , "Employed" : "Y" , "Education"
38
+ : "Graduate" , "Married" : "Y" , "Age" : "18"}}}]}'
39
+ http_version:
40
+ recorded_at: Wed, 21 Mar 2018 16:21:14 GMT
41
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,35 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.clevertap.com/1/upload
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"d":[{"identity":"1","ts":1521649274,"type":"profile","profileData":{"identity":1,"created_at":"2018-03-21
9
+ 18:21:14 +0200","Name":"John Rush","Email":"example@gmail.com","Gender":"M","Phone":"+35922333232","Employed":"Y","Education":"Graduate","Married":"Y","Age":"18"}}]}'
10
+ headers:
11
+ Content-Type:
12
+ - application/json
13
+ X-CleverTap-Account-Id:
14
+ - fake_account_id
15
+ X-CleverTap-Passcode:
16
+ - fake_passcode
17
+ User-Agent:
18
+ - Faraday v0.14.0
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ content-type:
25
+ - application/json;charset=utf-8
26
+ content-length:
27
+ - '63'
28
+ connection:
29
+ - Close
30
+ body:
31
+ encoding: UTF-8
32
+ string: '{ "status" : "success" , "processed" : 1 , "unprocessed" : [ ]}'
33
+ http_version:
34
+ recorded_at: Wed, 21 Mar 2018 16:21:14 GMT
35
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,34 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.clevertap.com/1/upload
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"d":[{"identity":"555","ts":1521649275,"type":"event","evtData":{"ID":555,"mobile":true},"evtName":"register"}]}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ X-CleverTap-Account-Id:
13
+ - fake_account_id
14
+ X-CleverTap-Passcode:
15
+ - fake_passcode
16
+ User-Agent:
17
+ - Faraday v0.14.0
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ content-type:
24
+ - application/json;charset=utf-8
25
+ content-length:
26
+ - '63'
27
+ connection:
28
+ - Close
29
+ body:
30
+ encoding: UTF-8
31
+ string: '{ "status" : "success" , "processed" : 1 , "unprocessed" : [ ]}'
32
+ http_version:
33
+ recorded_at: Wed, 21 Mar 2018 16:21:15 GMT
34
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.clevertap.com/1/upload?dryRun=0
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"d":[{"identity":"1414","type":"profile","profileData":{"ID":"1414","Name":"John","Phone":"+44+441234"}}]}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ X-CleverTap-Account-Id:
13
+ - fake_account_id
14
+ X-CleverTap-Passcode:
15
+ - fake_passcode
16
+ User-Agent:
17
+ - Faraday v0.14.0
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ content-type:
24
+ - application/json;charset=utf-8
25
+ content-length:
26
+ - '323'
27
+ connection:
28
+ - Close
29
+ body:
30
+ encoding: UTF-8
31
+ string: '{ "status" : "fail" , "processed" : 0 , "unprocessed" : [ { "status"
32
+ : "fail" , "code" : 516 , "error" : "Profile data is incorrect. Phone number
33
+ is not valid.Skipped record number : 1" , "record" : { "identity" : "1414"
34
+ , "type" : "profile" , "profileData" : { "ID" : "1414" , "Name" : "John" ,
35
+ "Phone" : "+44+441234"}}}]}'
36
+ http_version:
37
+ recorded_at: Wed, 21 Mar 2018 16:21:18 GMT
38
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.clevertap.com/1/upload?dryRun=0
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"d":[{"identity":"1414","type":"profile","profileData":{"ID":"1414","Name":"John","Phone":"+44+441234"}}]}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ X-CleverTap-Account-Id:
13
+ - fake_account_id
14
+ X-CleverTap-Passcode:
15
+ - fake_passcode
16
+ User-Agent:
17
+ - Faraday v0.14.0
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ content-type:
24
+ - application/json;charset=utf-8
25
+ content-length:
26
+ - '323'
27
+ connection:
28
+ - Close
29
+ body:
30
+ encoding: UTF-8
31
+ string: '{ "status" : "fail" , "processed" : 0 , "unprocessed" : [ { "status"
32
+ : "fail" , "code" : 516 , "error" : "Profile data is incorrect. Phone number
33
+ is not valid.Skipped record number : 1" , "record" : { "identity" : "1414"
34
+ , "type" : "profile" , "profileData" : { "ID" : "1414" , "Name" : "John" ,
35
+ "Phone" : "+44+441234"}}}]}'
36
+ http_version:
37
+ recorded_at: Wed, 21 Mar 2018 16:21:18 GMT
38
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,67 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.clevertap.com/1/upload?dryRun=0
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"d":[{"FBID":"1414","type":"event","evtData":{"Name":"John"},"evtName":"Web
9
+ Event"}]}'
10
+ headers:
11
+ Content-Type:
12
+ - application/json
13
+ X-CleverTap-Account-Id:
14
+ - fake_account_id
15
+ X-CleverTap-Passcode:
16
+ - fake_passcode
17
+ User-Agent:
18
+ - Faraday v0.14.0
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ content-type:
25
+ - application/json;charset=utf-8
26
+ content-length:
27
+ - '63'
28
+ connection:
29
+ - Close
30
+ body:
31
+ encoding: UTF-8
32
+ string: '{ "status" : "success" , "processed" : 1 , "unprocessed" : [ ]}'
33
+ http_version:
34
+ recorded_at: Wed, 21 Mar 2018 16:21:17 GMT
35
+ - request:
36
+ method: post
37
+ uri: https://api.clevertap.com/1/upload?dryRun=0
38
+ body:
39
+ encoding: UTF-8
40
+ string: '{"d":[{"FBID":"1515","type":"event","evtData":{"Name":"Jill"},"evtName":"Web
41
+ Event"}]}'
42
+ headers:
43
+ Content-Type:
44
+ - application/json
45
+ X-CleverTap-Account-Id:
46
+ - fake_account_id
47
+ X-CleverTap-Passcode:
48
+ - fake_passcode
49
+ User-Agent:
50
+ - Faraday v0.14.0
51
+ response:
52
+ status:
53
+ code: 200
54
+ message: OK
55
+ headers:
56
+ content-type:
57
+ - application/json;charset=utf-8
58
+ transfer-encoding:
59
+ - chunked
60
+ connection:
61
+ - Close
62
+ body:
63
+ encoding: UTF-8
64
+ string: '{ "status" : "success" , "processed" : 1 , "unprocessed" : [ ]}'
65
+ http_version:
66
+ recorded_at: Wed, 21 Mar 2018 16:21:18 GMT
67
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,67 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.clevertap.com/1/upload?dryRun=0
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"d":[{"FBID":"1414","type":"event","evtData":{"Name":"John"},"evtName":"Web
9
+ Event"}]}'
10
+ headers:
11
+ Content-Type:
12
+ - application/json
13
+ X-CleverTap-Account-Id:
14
+ - fake_account_id
15
+ X-CleverTap-Passcode:
16
+ - fake_passcode
17
+ User-Agent:
18
+ - Faraday v0.14.0
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ content-type:
25
+ - application/json;charset=utf-8
26
+ content-length:
27
+ - '63'
28
+ connection:
29
+ - Close
30
+ body:
31
+ encoding: UTF-8
32
+ string: '{ "status" : "success" , "processed" : 1 , "unprocessed" : [ ]}'
33
+ http_version:
34
+ recorded_at: Wed, 21 Mar 2018 16:21:17 GMT
35
+ - request:
36
+ method: post
37
+ uri: https://api.clevertap.com/1/upload?dryRun=0
38
+ body:
39
+ encoding: UTF-8
40
+ string: '{"d":[{"FBID":"1515","type":"event","evtData":{"Name":"Jill"},"evtName":"Web
41
+ Event"}]}'
42
+ headers:
43
+ Content-Type:
44
+ - application/json
45
+ X-CleverTap-Account-Id:
46
+ - fake_account_id
47
+ X-CleverTap-Passcode:
48
+ - fake_passcode
49
+ User-Agent:
50
+ - Faraday v0.14.0
51
+ response:
52
+ status:
53
+ code: 200
54
+ message: OK
55
+ headers:
56
+ content-type:
57
+ - application/json;charset=utf-8
58
+ content-length:
59
+ - '63'
60
+ connection:
61
+ - Close
62
+ body:
63
+ encoding: UTF-8
64
+ string: '{ "status" : "success" , "processed" : 1 , "unprocessed" : [ ]}'
65
+ http_version:
66
+ recorded_at: Wed, 21 Mar 2018 16:21:17 GMT
67
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.clevertap.com/1/upload?dryRun=0
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"d":[{"FBID":"1414","type":"event","evtData":{"Name":"John"},"evtName":"Web
9
+ Event"},{"FBID":"1515","type":"event","evtData":{"Name":"Jill"},"evtName":"Web
10
+ Event"}]}'
11
+ headers:
12
+ Content-Type:
13
+ - application/json
14
+ X-CleverTap-Account-Id:
15
+ - fake_account_id
16
+ X-CleverTap-Passcode:
17
+ - fake_passcode
18
+ User-Agent:
19
+ - Faraday v0.14.0
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ content-type:
26
+ - application/json;charset=utf-8
27
+ content-length:
28
+ - '63'
29
+ connection:
30
+ - Close
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{ "status" : "success" , "processed" : 2 , "unprocessed" : [ ]}'
34
+ http_version:
35
+ recorded_at: Wed, 21 Mar 2018 16:21:17 GMT
36
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.clevertap.com/1/upload?dryRun=0
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"d":[{"FBID":"1414","type":"event","evtData":{"Name":"John"},"evtName":"Web
9
+ Event"},{"FBID":"1515","type":"event","evtData":{"Name":"Jill"},"evtName":"Web
10
+ Event"}]}'
11
+ headers:
12
+ Content-Type:
13
+ - application/json
14
+ X-CleverTap-Account-Id:
15
+ - fake_account_id
16
+ X-CleverTap-Passcode:
17
+ - fake_passcode
18
+ User-Agent:
19
+ - Faraday v0.14.0
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ content-type:
26
+ - application/json;charset=utf-8
27
+ content-length:
28
+ - '63'
29
+ connection:
30
+ - Close
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{ "status" : "success" , "processed" : 2 , "unprocessed" : [ ]}'
34
+ http_version:
35
+ recorded_at: Wed, 21 Mar 2018 16:21:16 GMT
36
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.clevertap.com/1/upload
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"d":[{"identity":"13","ts":1521649266,"type":"profile","profileData":{"identity":13,"created_at":"2018-03-21
9
+ 18:21:06 +0200","Name":"John Rush","Email":"example@gmail.com","Gender":"M","Phone":"+35922333232","Employed":"Y","Education":"Graduate","Married":"Y","Age":"aa"}},{"identity":"14","ts":1521649266,"type":"profile","profileData":{"identity":14,"created_at":"2018-03-21
10
+ 18:21:06 +0200","Name":"John Rush","Email":"example@gmail.com","Gender":"M","Phone":"+35922333232","Employed":"Y","Education":"Graduate","Married":"Y","Age":"aa"}}]}'
11
+ headers:
12
+ Content-Type:
13
+ - application/json
14
+ X-CleverTap-Account-Id:
15
+ - fake_account_id
16
+ X-CleverTap-Passcode:
17
+ - fake_passcode
18
+ User-Agent:
19
+ - Faraday v0.14.0
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ content-type:
26
+ - application/json;charset=utf-8
27
+ content-length:
28
+ - '965'
29
+ connection:
30
+ - Close
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{ "status" : "fail" , "processed" : 0 , "unprocessed" : [ { "status"
34
+ : "fail" , "code" : 520 , "error" : "Profile data is incorrect. Age is invalid.Skipped
35
+ record number : 1" , "record" : { "identity" : "13" , "ts" : 1521649266 ,
36
+ "type" : "profile" , "profileData" : { "identity" : "13" , "created_at" :
37
+ "2018-03-21 18:21:06 +0200" , "Name" : "John Rush" , "Email" : "example@gmail.com"
38
+ , "Gender" : "M" , "Phone" : 35922333232 , "Employed" : "Y" , "Education"
39
+ : "Graduate" , "Married" : "Y" , "Age" : "aa"}}} , { "status" : "fail" , "code"
40
+ : 520 , "error" : "Profile data is incorrect. Age is invalid.Skipped record
41
+ number : 2" , "record" : { "identity" : "14" , "ts" : 1521649266 , "type"
42
+ : "profile" , "profileData" : { "identity" : "14" , "created_at" : "2018-03-21
43
+ 18:21:06 +0200" , "Name" : "John Rush" , "Email" : "example@gmail.com" , "Gender"
44
+ : "M" , "Phone" : 35922333232 , "Employed" : "Y" , "Education" : "Graduate"
45
+ , "Married" : "Y" , "Age" : "aa"}}}]}'
46
+ http_version:
47
+ recorded_at: Wed, 21 Mar 2018 16:21:07 GMT
48
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.clevertap.com/1/upload
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"d":[{"identity":"9","ts":1521649266,"type":"profile","profileData":{"identity":9,"created_at":"2018-03-21
9
+ 18:21:06 +0200","Name":"John Rush","Email":"example@gmail.com","Gender":"M","Phone":"+35922333232","Employed":"Y","Education":"223","Married":"Y","Age":"18"}},{"identity":"10","ts":1521649266,"type":"profile","profileData":{"identity":10,"created_at":"2018-03-21
10
+ 18:21:06 +0200","Name":"John Rush","Email":"example@gmail.com","Gender":"M","Phone":"+35922333232","Employed":"Y","Education":"123","Married":"Y","Age":"18"}}]}'
11
+ headers:
12
+ Content-Type:
13
+ - application/json
14
+ X-CleverTap-Account-Id:
15
+ - fake_account_id
16
+ X-CleverTap-Passcode:
17
+ - fake_passcode
18
+ User-Agent:
19
+ - Faraday v0.14.0
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ content-type:
26
+ - application/json;charset=utf-8
27
+ content-length:
28
+ - '1013'
29
+ connection:
30
+ - Close
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{ "status" : "fail" , "processed" : 0 , "unprocessed" : [ { "status"
34
+ : "fail" , "code" : 518 , "error" : "Profile data is incorrect. Education
35
+ needs to be School/College/Graduate..Skipped record number : 1" , "record"
36
+ : { "identity" : "9" , "ts" : 1521649266 , "type" : "profile" , "profileData"
37
+ : { "identity" : 9 , "created_at" : "2018-03-21 18:21:06 +0200" , "Name" :
38
+ "John Rush" , "Email" : "example@gmail.com" , "Gender" : "M" , "Phone" : 35922333232
39
+ , "Employed" : "Y" , "Education" : "223" , "Married" : "Y" , "Age" : "18"}}}
40
+ , { "status" : "fail" , "code" : 518 , "error" : "Profile data is incorrect.
41
+ Education needs to be School/College/Graduate..Skipped record number : 2"
42
+ , "record" : { "identity" : "10" , "ts" : 1521649266 , "type" : "profile"
43
+ , "profileData" : { "identity" : 10 , "created_at" : "2018-03-21 18:21:06
44
+ +0200" , "Name" : "John Rush" , "Email" : "example@gmail.com" , "Gender" :
45
+ "M" , "Phone" : 35922333232 , "Employed" : "Y" , "Education" : "123" , "Married"
46
+ : "Y" , "Age" : "18"}}}]}'
47
+ http_version:
48
+ recorded_at: Wed, 21 Mar 2018 16:21:06 GMT
49
+ recorded_with: VCR 4.0.0