appnexusapi 0.0.8 → 0.0.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9452846eac609ebf220d9403476aab1e6bb610ae
4
- data.tar.gz: e70c3055a6079d72e5ab00d04b85a53be9900347
3
+ metadata.gz: 7969421f4404cb5d0af083544387927a493d2ccb
4
+ data.tar.gz: fdf085dd9a11e7ca9877300f25d271e7e74a4a3d
5
5
  SHA512:
6
- metadata.gz: 9095dd8260f73ca926eace6b3f3daa6be0bb8db821b015983b53d21e2a092114bba8bb6eb16aed0f061c36a8c295a3c0991d2fb5745ad45c615e37730653a895
7
- data.tar.gz: c857fbd279a89ee0ffbb58485045b35cc0f3af6056c472640a4b1c75288a947ecfc509b1ef8b26691c009f3e22b52e8384405ac18780b42c0eea35c0061c0688
6
+ metadata.gz: c2f9db3645266be119063ef0bb5c3944ebab0cb036b74c78c99fc9e5abfc4ad105b7a8d0ade59c80bc95ed9c18619305f383ee9034a98ff95373d75e111f4c8e
7
+ data.tar.gz: e786a842d258682287651a46d8fcb32f00f41519d7cf53c1ab9dbf4b4f173778409c0cebc22686da3937b12808b4d3d860ef7106a9c63543017e2b2128ec2a72
@@ -2,19 +2,18 @@ class AppnexusApi::LogLevelDataResource < AppnexusApi::Resource
2
2
  # Extract an array of hashes of params to pass to the LogLevelDownloadService
3
3
  def download_params
4
4
  fail 'Missing necessaray information!' unless name && hour && timestamp && splits
5
+
5
6
  splits.map do |split_part|
6
- if split_part['checksum'].blank?
7
- # In the case of regenerated files, there can be no checksum. These replaced hourly files should not be downloaded.
8
- nil
9
- else
10
- {
11
- split_part: split_part['part'],
12
- siphon_name: name,
13
- timestamp: timestamp,
14
- hour: hour,
15
- checksum: split_part['checksum']
16
- }
17
- end
7
+ # In the case of regenerated files, there should be no checksum. These replaced hourly files should not be downloaded.
8
+ next nil if split_part['checksum'].blank?
9
+
10
+ {
11
+ split_part: split_part['part'],
12
+ siphon_name: name,
13
+ timestamp: timestamp,
14
+ hour: hour,
15
+ checksum: split_part['checksum']
16
+ }
18
17
  end.compact
19
18
  end
20
19
  end
@@ -11,7 +11,13 @@ class AppnexusApi::LogLevelDataService < AppnexusApi::Service
11
11
  params[:siphon_name] = @siphon_name if @siphon_name
12
12
  params[:updated_since] = time.strftime('%Y_%m_%d_%H') if time
13
13
 
14
- get(params)
14
+ # Anything with the same name and hour but with a newer timestamp is a republished replacement for an older file
15
+ # When this happens appnexus is supposed to set the checksum for the old file to null but they do not always
16
+ # actually do this.
17
+ siphons = get(params)
18
+ siphons.reject do |siphon|
19
+ (siphons - [siphon]).any? { |s| s.name == siphon.name && s.hour == siphon.hour && s.timestamp > siphon.timestamp }
20
+ end
15
21
  end
16
22
 
17
23
  def uri_name
@@ -1,3 +1,3 @@
1
1
  module AppnexusApi
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appnexusapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Aaron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-29 00:00:00.000000000 Z
11
+ date: 2016-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday