ppc 2.0.0 → 2.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 +4 -4
- data/README.md +2 -0
- data/lib/ppc.rb +1 -1
- data/lib/ppc/api/qihu/report.rb +1 -0
- data/lib/ppc/api/sogou/bulk.rb +14 -0
- data/lib/ppc/api/sogou/report.rb +3 -6
- data/lib/ppc/operation/report.rb +8 -4
- data/ppc.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bc06d2e73e1d498cbf369c743fd5fdcb7015114
|
4
|
+
data.tar.gz: 0cef07098f06fc77cd474a38629d759094463ef7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 793f672f0b5e77ce0ed4fda22c5bbb0b3155616f9e37d0b34b23431a6e7b33f2e72d9717de3c489283639d248998250c0c66d14a3911406de1e8c0e326990454
|
7
|
+
data.tar.gz: 5990ce108ac0dc8b29d0a73e7bffb4be9f891dd13aba13e86d7655e2f70f8c7111b4986eb6a60bfaad27ca9b7313bf55b4fa1473972e8c63e10fb9a285325e16
|
data/README.md
CHANGED
data/lib/ppc.rb
CHANGED
data/lib/ppc/api/qihu/report.rb
CHANGED
data/lib/ppc/api/sogou/bulk.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# -*- coding:utf-8 -*-
|
2
|
+
require "open-uri"
|
3
|
+
require "zip"
|
2
4
|
module PPC
|
3
5
|
module API
|
4
6
|
class Sogou
|
@@ -63,6 +65,18 @@ module PPC
|
|
63
65
|
end
|
64
66
|
end
|
65
67
|
|
68
|
+
def self.rank_report(auth, device = 0, debug)
|
69
|
+
url = download_cpc_rank(auth, device)[:result]
|
70
|
+
file = "sogou_rank_#{Time.now.to_i}.zip"
|
71
|
+
File.open(file, "w"){|f| f.puts open(url).read}
|
72
|
+
content = Zip::File.open(file) do |zip_file|
|
73
|
+
entry = zip_file.glob('*.csv').first
|
74
|
+
content = entry.get_input_stream.read.force_encoding('gb18030').encode('utf-8')
|
75
|
+
end
|
76
|
+
File.delete(file)
|
77
|
+
content
|
78
|
+
end
|
79
|
+
|
66
80
|
end
|
67
81
|
end
|
68
82
|
end
|
data/lib/ppc/api/sogou/report.rb
CHANGED
@@ -81,8 +81,7 @@ module PPC
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
def self.query_report( auth, param =
|
85
|
-
param = {} if not param
|
84
|
+
def self.query_report( auth, param = {}, debug = false )
|
86
85
|
param[:type] ||= 'query'
|
87
86
|
param[:fields] ||= %w(click)
|
88
87
|
param[:range] ||= 'account'
|
@@ -90,16 +89,14 @@ module PPC
|
|
90
89
|
download_report( auth, param, debug )
|
91
90
|
end
|
92
91
|
|
93
|
-
def self.creative_report( auth, param =
|
94
|
-
param = {} if not param
|
92
|
+
def self.creative_report( auth, param = {}, debug = false )
|
95
93
|
param[:type] ||= 'creative'
|
96
94
|
param[:fields] ||= %w( cost cpc click impression ctr )
|
97
95
|
param[:range] ||= 'account'
|
98
96
|
download_report( auth, param, debug )
|
99
97
|
end
|
100
98
|
|
101
|
-
def self.keyword_report( auth, param =
|
102
|
-
param = {} if not param
|
99
|
+
def self.keyword_report( auth, param = {}, debug = false )
|
103
100
|
param[:type] ||= 'keyword'
|
104
101
|
param[:fields] ||= %w( cost cpc click impression ctr )
|
105
102
|
param[:range] ||= 'account'
|
data/lib/ppc/operation/report.rb
CHANGED
@@ -2,22 +2,26 @@ module PPC
|
|
2
2
|
module Operation
|
3
3
|
module Report
|
4
4
|
|
5
|
-
def download_report( param =
|
5
|
+
def download_report( param = {}, debug = false )
|
6
6
|
call( "report" ).download_report( @auth, param, debug )
|
7
7
|
end
|
8
8
|
|
9
|
-
def query_report( param =
|
9
|
+
def query_report( param = {}, debug = false )
|
10
10
|
call( "report" ).query_report( @auth, param, debug )
|
11
11
|
end
|
12
12
|
|
13
|
-
def creative_report( param =
|
13
|
+
def creative_report( param = {}, debug = false )
|
14
14
|
call( "report" ).creative_report( @auth, param, debug )
|
15
15
|
end
|
16
16
|
|
17
|
-
def keyword_report( param =
|
17
|
+
def keyword_report( param = {}, debug = false )
|
18
18
|
call( "report" ).keyword_report( @auth, param, debug )
|
19
19
|
end
|
20
20
|
|
21
|
+
def rank_report( device = 0, debug = false )
|
22
|
+
call( "bulk" ).rank_report( @auth, device, debug)
|
23
|
+
end
|
24
|
+
|
21
25
|
end
|
22
26
|
end
|
23
27
|
end
|
data/ppc.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ppc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chienli Ma
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-08-
|
14
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: httparty
|
@@ -67,6 +67,20 @@ dependencies:
|
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rubyzip
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
70
84
|
description: ppc api for baidu qihu sogou sm
|
71
85
|
email:
|
72
86
|
- maqianlie@gmail.com
|