leanplum_api 3.0.1 → 3.0.2

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: 2e94814a101ee266130f5484232809cd1543d641
4
- data.tar.gz: 1f6bd9fefa701bad19d839fbc42dcc0833a61d6a
3
+ metadata.gz: 0c7a269a442739ed3de7ce55113e6c811d559fb5
4
+ data.tar.gz: 5c88e058755a2e71e6560daa8cfcb4fcb252fea5
5
5
  SHA512:
6
- metadata.gz: acbaab2cf26e530ab7fc1f48a5021f6f1732c4b75255448e2f28f079fe6b70a1233f588211f6dd11b82402eb99d625297abc0c96ba3b2e7bfa1aad25891855e2
7
- data.tar.gz: 1f72ae8dcd7e107af18433ab762447c0df4f96cb763cc0aefd5276efd4a29402216b3cda8b7b68a3b8b2ed216c9e6ebfd616bbe9d9658e1bbdaa46e6b4e60733
6
+ metadata.gz: 7823628353da613c0730d17e096e0473c15921fdd8d24a060fdb8b79c145ca4c7db267a43f3afac9ea1a0489c42e63be5d6da06b851de5f7368c9a4819e8f380
7
+ data.tar.gz: 486e871d455d2bb514b259efb243d19b33e7b772d4f1efd9ddec23d2bb906b8113f3e0c8a3b80ab52db495891244e2f7172d96f6bb2d0c287dfc4626dfc3e282
data/README.md CHANGED
@@ -6,6 +6,8 @@ Gem for the Leanplum API.
6
6
 
7
7
  Leanplum calls it a REST API but it is not very RESTful.
8
8
 
9
+ Leanplum also likes to change and break stuff in their API without changing the version number, so buyer beware.
10
+
9
11
  The gem uses the ```multi``` method with a POST for all event tracking and user attribute updating requests. Check Leanplum's docs for more information on ```multi```.
10
12
 
11
13
  Tested with Leanplum API version 1.0.6.
@@ -34,7 +36,7 @@ LeanplumApi.configure do |config|
34
36
  config.timeout_seconds # Defaults to 600
35
37
  config.api_version # Defaults to 1.0.6
36
38
 
37
- # S3 export required options
39
+ # S3 export required options - see note below on the S3 export API
38
40
  config.s3_bucket_name = 'my_bucket'
39
41
  config.s3_access_id = 'access_id'
40
42
  config.s3_access_key = 'access_key'
@@ -47,7 +49,7 @@ end
47
49
 
48
50
  ## Usage
49
51
 
50
- Tracking events and user attributes:
52
+ ### Tracking events and user attributes:
51
53
 
52
54
  ```ruby
53
55
  api = LeanplumApi::API.new
@@ -64,9 +66,10 @@ attribute_hash = {
64
66
  }
65
67
  api.set_user_attributes(attribute_hash)
66
68
 
67
- # You must also provide the :event property for event tracking. :info is an optional property for an extra string.
68
- # You can optionally provide a :time; if it is not set Leanplum will timestamp the event "now".
69
- # All other key/values besides :user_id, :device_id, :event, and :time will be sent as event params.
69
+ # You must also provide the :event property for event tracking.
70
+ ## :info is an optional property for an extra string.
71
+ ## You can optionally provide a :time; if it is not set Leanplum will timestamp the event "now".
72
+ ## All other key/values besides :user_id, :device_id, :event, and :time will be sent as event params.
70
73
  event = {
71
74
  user_id: 12345,
72
75
  event: 'purchase',
@@ -88,20 +91,21 @@ api.reset_anomalous_users([12345, 23456])
88
91
  api.track_events(event, force_anomalous_override: true)
89
92
  ```
90
93
 
91
- API based data export:
94
+ ### API based data export:
95
+
92
96
  ```ruby
93
97
  api = LeanplumApi::API.new
94
98
  job_id = api.export_data(start_time, end_time)
95
99
  response = wait_for_job(job_id)
96
100
  ```
97
101
 
98
- Note well that Leanplum now officially recommends use of the automated S3 export instead of API based export. According to a Leanplum engineer these two data export methodologies are completely independent data paths and in our experience we have found API based data export to be missing 10-15% of the data that is eventually returned by the automated export.
102
+ **Note well that Leanplum now officially recommends use of the automated S3 export instead of API based export.** According to a Leanplum engineer these two data export methodologies are completely independent data paths and in our experience we have found API based data export to be missing 10-15% of the data that is eventually returned by the automated export.
99
103
 
100
104
  ## Specs
101
105
 
102
106
  `bundle exec rspec` should work fine at running existing specs.
103
107
 
104
- To write _new__ specs (or regenerate one of VCR's YAML files), you must set the `LEANPLUM_PRODUCTION_KEY`, `LEANPLUM_APP_ID`, `LEANPLUM_CONTENT_READ_ONLY_KEY`, `LEANPLUM_DEVELOPMENT_KEY`, and `LEANPLUM_DATA_EXPORT_KEY` environment variables (preferably to some development only keys) to something and then run rspec. VCR will create fixture data based on your requests, masking your actual keys so that it's safe to commit the file.
108
+ To write _new_ specs (or regenerate one of [VCR](https://github.com/vcr/vcr)'s YAML files), you must set the `LEANPLUM_PRODUCTION_KEY`, `LEANPLUM_APP_ID`, `LEANPLUM_CONTENT_READ_ONLY_KEY`, `LEANPLUM_DEVELOPMENT_KEY`, and `LEANPLUM_DATA_EXPORT_KEY` environment variables (preferably to some development only keys) to something and then run rspec. VCR will create fixture data based on your requests, masking your actual keys so that it's safe to commit the file.
105
109
 
106
110
  > BE AWARE THAT IF YOU WRITE A NEW SPEC OR DELETE A VCR FILE, IT'S POSSIBLE THAT REAL DATA WILL BE WRITTEN TO THE `LEANPLUM_APP_ID` YOU CONFIGURE! Certainly a real request will be made to rebuild the VCR file, and while specs run with ```devMode=true```, it's usually a good idea to create a fake app for testing/running specs against.
107
111
 
@@ -33,9 +33,15 @@ module LeanplumApi
33
33
  if options[:force_anomalous_override]
34
34
  user_ids_to_reset = []
35
35
  response.each_with_index do |indicator, i|
36
- if indicator['warning'] && indicator['warning']['message'] =~ /Anomaly detected/i
37
- # Leanplum does not return their warnings in order!!! So we just have to reset everyone who had any events.
38
- # This is what the code should be:
36
+ # Leanplum's engineering team likes to break their API and or change stuff without warning (often)
37
+ # and has no idea what "versioning" actually means, so we just reset
38
+ # everyone all the time. This condition should be:
39
+ # if indicator['warning'] && indicator['warning']['message'] =~ /Past event detected/i
40
+ #
41
+ # but it has to be:
42
+ if indicator['warning']
43
+ # Leanplum does not return their warnings in order!!! So we just have
44
+ # to reset everyone who had any events. This is what the code should be:
39
45
  # user_ids_to_reset << request_data[i]['userId']
40
46
 
41
47
  # This is what it has to be:
@@ -1,3 +1,3 @@
1
1
  module LeanplumApi
2
- VERSION = '3.0.1'
2
+ VERSION = '3.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leanplum_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lumos Labs, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-17 00:00:00.000000000 Z
11
+ date: 2017-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  version: '0'
194
194
  requirements: []
195
195
  rubyforge_project:
196
- rubygems_version: 2.2.3
196
+ rubygems_version: 2.6.11
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: Gem for the Leanplum API
@@ -217,4 +217,3 @@ test_files:
217
217
  - spec/fixtures/vcr/track_offline_events.yml
218
218
  - spec/http_spec.rb
219
219
  - spec/spec_helper.rb
220
- has_rdoc: