linkshare-oauth2-api 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/linkshare/custom_reports.rb +18 -18
- data/lib/linkshare/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13b9df35964ecdb298c3d5a1c83a075d89d15187
|
4
|
+
data.tar.gz: cf05cd12fe2ea068de5be0c1ca0df34338547366
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 350ab8f384bfce70f67934931982c18626e95317f766a1ba6d06508ce49f5285680cd5e790901029d01ce6f4ab63ae0af531f2683a2e794b67a9ab0a9565e47e
|
7
|
+
data.tar.gz: 1bcebfc2cb2a248562b7ce2403bd6eed1ec4f8cbd8562a64c34c64f102850e9454368d615a0762bfe96a339cd1c076600e7c2ef146f19c8c1a5d50f1233d45a3
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "open-uri"
|
2
|
+
require 'csv'
|
2
3
|
module Linkshare
|
3
4
|
class CustomReports
|
4
5
|
def initilize()
|
@@ -6,9 +7,7 @@ module Linkshare
|
|
6
7
|
@reportsRows = []
|
7
8
|
@cols = []
|
8
9
|
end
|
9
|
-
|
10
|
-
@reportsCSV
|
11
|
-
end
|
10
|
+
|
12
11
|
|
13
12
|
def getReports
|
14
13
|
@reportsRows
|
@@ -17,21 +16,22 @@ module Linkshare
|
|
17
16
|
token = Linkshare.custom_report_token
|
18
17
|
url = Linkshare::API_URIS[:custom_reports]+'/'+reportname+'/filters?start_date='+bdate+'&end_date='+edate+'&include_summary='+include_summary+'&network='+network.to_s+'&tz='+tz+'&date_type='+date_type+'&token='+token
|
19
18
|
@reportsRows = []
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
19
|
+
|
20
|
+
filename = "linkshare_custom_report_#{reportname}_#{bdate}_#{edate}"
|
21
|
+
|
22
|
+
path = "#{Rails.root.join('tmp')}/#{filename}.csv"
|
23
|
+
file = Tempfile.new(["#{filename}", '.csv'])
|
24
|
+
file.binmode
|
25
|
+
file << open(url).read
|
26
|
+
file.close
|
27
|
+
|
28
|
+
CSV.open(path, 'w', headers: :first_row, col_sep: ',', row_sep: "\n", encoding: 'utf-8') do |csv|
|
29
|
+
CSV.open(file.path, 'r:bom|utf-8', headers: :first_row, col_sep: ',', quote_char: "\"", row_sep: "\n").each_with_index do |line, index|
|
30
|
+
@reportsRows.push(line)
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
35
|
@reportsRows
|
36
36
|
end
|
37
37
|
end
|
data/lib/linkshare/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linkshare-oauth2-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rudie Shahinian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|