unite_parser 0.0.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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +22 -0
- data/bin/unite_parser +10 -0
- data/lib/unite_parser.rb +28 -0
- data/lib/unite_parser/version.rb +3 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 90108383ce3ef2e928189bcd4dd9b4d66190ff0f
|
4
|
+
data.tar.gz: 59f4ccf4ecef6c4c6457913e829a0d4d198ff65e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ad91d9bc61d4a5fd297b1d0221f1388e57223a3c05079e6e2cc41458af0051ad9c3e29a8d6fe684cf580f792eb156e1d1cd687a9c82a0e84ff74d84b3dad5710
|
7
|
+
data.tar.gz: 2439e5ef8acca1bbfd944bd5e752bede16ebbfe64a3e9b0cfb828b368614e2ec8932341d760308aab631e71bb0e6998f4158cd80c210d83ca7223c3ae1b22a8e
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 Topspin Media Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
What is UniteParser
|
2
|
+
=============
|
3
|
+
|
4
|
+
A parser for the analytics spreadsheet files provided by Unite for Adtag
|
5
|
+
|
6
|
+
How to install
|
7
|
+
==============
|
8
|
+
|
9
|
+
Run `gem install unite_parser`, then use the function `UniteParser.parse`
|
10
|
+
|
11
|
+
UniteParser.parse spec/fixtures/Topspin Report 12_11.xlsx
|
12
|
+
|
13
|
+
# => {"500029"=>{:impressions=>746109.0, :clicks=>653.0},
|
14
|
+
"500030"=>{:impressions=>783779.0, :clicks=>389.0},
|
15
|
+
"500031"=>{:impressions=>541625.0, :clicks=>385.0}, ...}
|
16
|
+
|
17
|
+
How to use from the command line
|
18
|
+
================================
|
19
|
+
|
20
|
+
Install with `gem install unite_parser`, then run `unite_parser [file]`. Example:
|
21
|
+
|
22
|
+
$ unite_parser Topspin Report 12_11.xlsx
|
data/bin/unite_parser
ADDED
data/lib/unite_parser.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'roo'
|
2
|
+
# require 'debugger'
|
3
|
+
|
4
|
+
module UniteParser
|
5
|
+
# Parse impressions and clicks for each valid Adtag campaign in the XLSX file
|
6
|
+
def self.parse(xlsx_file)
|
7
|
+
xlsx = Roo::Excelx.new xlsx_file
|
8
|
+
{}.tap do |campaigns|
|
9
|
+
xlsx.first_row.upto(xlsx.last_row) do |line|
|
10
|
+
name = xlsx.cell line, 'A'
|
11
|
+
if campaign_id = extract_campaign_id_from(name)
|
12
|
+
impressions = xlsx.cell line, 'B'
|
13
|
+
clicks = xlsx.cell line, 'C'
|
14
|
+
campaigns[campaign_id] = {impressions: impressions, clicks: clicks}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
# Return campaign_id if name specifies an Adtag campaign
|
23
|
+
def self.extract_campaign_id_from(name)
|
24
|
+
name.match %r{^Top Spin: (\d+).+} do |match|
|
25
|
+
match[1]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unite_parser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Claudio Baccigalupo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: roo
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Parse the analytics file from Unite for Adtag
|
70
|
+
email:
|
71
|
+
- claudio@topspinmedia.com
|
72
|
+
executables:
|
73
|
+
- unite_parser
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- bin/unite_parser
|
78
|
+
- lib/unite_parser/version.rb
|
79
|
+
- lib/unite_parser.rb
|
80
|
+
- MIT-LICENSE
|
81
|
+
- README.md
|
82
|
+
homepage: https://github.com/topspin/unite_parser
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata: {}
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.9.0
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 2.1.10
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: Parse the analytics file from Unite for Adtag.
|
106
|
+
test_files: []
|