dsp 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 04065820abd2deee12f8f9f9c375f319ad169a29
4
+ data.tar.gz: 0ef26c26ac603c1a954753becf3edcd54daa411c
5
+ SHA512:
6
+ metadata.gz: 94a84935757a4a04ec76661737df7f1f867c1e1d2fb49a11e48da7ab311754094fb4ed0ee2035cf3501842bf95fe0f1c668bd67171da9dfef43a38cade5b2c80
7
+ data.tar.gz: 86a24c65a9134207074f27fdbf739a3e01e385ae2f8a7be013791606ff6043e0c81193d0d99098d0a3838ff85c5a61298de417e018dcf1a6d1c8f4cfa5fe1186
@@ -0,0 +1 @@
1
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/README ADDED
File without changes
@@ -0,0 +1,23 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require 'dsp'
5
+
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "dsp"
9
+ spec.version = DSP::VERSION
10
+ spec.authors = ["姚露"]
11
+ spec.email = ["y1150264176@163.com"]
12
+ spec.summary = %q{dsp}
13
+ spec.description = %q{dsp}
14
+ spec.homepage = ""
15
+ spec.license = "GNU"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency 'httparty' , '>= 0.13.7'
23
+ end
@@ -0,0 +1,13 @@
1
+
2
+ require 'httparty'
3
+ require 'json'
4
+
5
+ module DSP
6
+ autoload :API , 'dsp/api'
7
+ autoload :BID , 'dsp/bid'
8
+
9
+ VERSION='0.0.1'
10
+
11
+ AUTH = {dsp_id: 190, token: '73553e669b7270a4934706f76a99ad36'}
12
+ ADX_URL = 'http://opentest.adx.qq.com'
13
+ end
@@ -0,0 +1,15 @@
1
+ # Dir.glob("*.rb").each do |ss|
2
+ # p ss
3
+ # end
4
+ require 'dsp/api/account'
5
+ require 'dsp/api/upload_ads_info'
6
+ require 'dsp/api/ads_info_sync'
7
+ require 'dsp/api/illegal_ads'
8
+ require 'dsp/api/ads_status'
9
+ require 'dsp/api/report'
10
+
11
+ module DSP
12
+ module API
13
+
14
+ end
15
+ end
@@ -0,0 +1,46 @@
1
+
2
+ module DSP
3
+ module API
4
+ class Account
5
+ @@target_url = "#{DSP::ADX_URL}/config/set"
6
+
7
+ class << self
8
+ def set_mapping_url(url)
9
+ body = {mapping_url: url}.merge(DSP::AUTH)
10
+ req = HTTParty.post(@@target_url, body: body).body
11
+ JSON.parse(req)
12
+ end
13
+
14
+ def set_bid_url(url)
15
+ body = {bid_url: url}.merge(DSP::AUTH)
16
+ req = HTTParty.post(@@target_url, body: body).body
17
+ JSON.parse(req)
18
+ end
19
+
20
+ def set_win_notice_url(url)
21
+ body = {win_notice_url: url}.merge(DSP::AUTH)
22
+ req = HTTParty.post(@@target_url, body: body).body
23
+ JSON.parse(req)
24
+ end
25
+
26
+ def set_qps(qps)
27
+ body = {qps: qps}.merge(DSP::AUTH)
28
+ req = HTTParty.post(@@target_url, body: body).body
29
+ JSON.parse(req)
30
+ end
31
+
32
+ def set_no_cm_response(bool = true)
33
+ body = {no_cm_response: bool == true ? 'Y' : 'N'}.merge(DSP::AUTH)
34
+ req = HTTParty.post(@@target_url, body: body).body
35
+ JSON.parse(req)
36
+ end
37
+
38
+ def set_use_tuserinfo(bool = true)
39
+ body = {use_tuserinfo: bool == true ? 'Y' : 'N'}.merge(DSP::AUTH)
40
+ req = HTTParty.post(@@target_url, body: body).body
41
+ JSON.parse(req)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,16 @@
1
+
2
+ module DSP
3
+ module API
4
+ class AdsInfoSync
5
+ @@target_url = "#{DSP::ADX_URL}/location/list"
6
+ class << self
7
+ #date format YYYY-MM-DD
8
+ def download(date = '')
9
+ body = {date: date}.merge(DSP::AUTH)
10
+ req = HTTParty.post(@@target_url, body: body).body
11
+ JSON.parse(req)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+
2
+ module DSP
3
+ module API
4
+ class AdsStatus
5
+ @@target_url = "#{DSP::ADX_URL}/order/getstatus"
6
+ class << self
7
+ #date format YYYY-MM-DD
8
+ def download(*dsp_order_id_info)
9
+ body = {dsp_order_id_info: dsp_order_id_info.to_s}.merge(DSP::AUTH)
10
+ req = HTTParty.post(@@target_url, body: body).body
11
+ JSON.parse(req)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+
2
+ module DSP
3
+ module API
4
+ class IllegalAds
5
+ @@target_url = "#{DSP::ADX_URL}/file/denylist"
6
+ class << self
7
+ #date format YYYY-MM-DD
8
+ def download(date = '')
9
+ body = {date: date}.merge(DSP::AUTH)
10
+ req = HTTParty.post(@@target_url, body: body).body
11
+ JSON.parse(req)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+
2
+ module DSP
3
+ module API
4
+ class Report
5
+ @@target_url = "#{DSP::ADX_URL}/order/report"
6
+ class << self
7
+ #date format YYYY-MM-DD
8
+ def download(start_date = '', end_date = '')
9
+ raise '请输入开始日期和结束日期!!格式:YYYY-MM-DD, 相差在7天之内' if start_date.empty? or end_date.empty?
10
+ body = {start_date: start_date, end_date: end_date}.merge(DSP::AUTH)
11
+ req = HTTParty.post(@@target_url, body: body).body
12
+ JSON.parse(req)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,28 @@
1
+
2
+ module DSP
3
+ module API
4
+ class UploadAdsInfo
5
+ @@target_url = "#{DSP::ADX_URL}/order/sync"
6
+ class << self
7
+ def upload(file_url = '', dsp_order_id = Time.now.to_i)
8
+ order_info = [{
9
+ "dsp_order_id"=> "#{dsp_order_id}",
10
+ "client_name"=> "浩趣互动",
11
+ "file_info"=> [{
12
+ "file_url"=> "#{file_url}"
13
+ }],
14
+ "targeting_url"=> "http://#{URI(file_url).host}" ,
15
+ "monitor_url"=> []
16
+ }].to_json
17
+ body = {order_info: order_info}.merge(DSP::AUTH)
18
+ req = HTTParty.post(@@target_url, body: body).body
19
+ JSON.parse(req)
20
+ end
21
+
22
+ # def uploads()
23
+
24
+ # end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,7 @@
1
+ # require 'dsp/api/account'
2
+
3
+ module DSP
4
+ module BID
5
+
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+
4
+ describe ::DSP::API::AdsInfoSync do
5
+ before :all do
6
+ auth = @auth
7
+ end
8
+
9
+ context '#download' do
10
+ it 'download ads info and return ret_code == 0 if success' do
11
+ res = ::DSP::API::AdsInfoSync.download()
12
+ expect(res["ret_code"]).to eq 0
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+
4
+ describe ::DSP::API::AdsStatus do
5
+ before :all do
6
+ auth = @auth
7
+ end
8
+
9
+ context '#download' do
10
+ it 'download ads status and return ret_code == 0 if success' do
11
+ res = ::DSP::API::AdsStatus.download(123)
12
+ expect(res["ret_code"]).to eq 0
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+
4
+ describe ::DSP::API::Account do
5
+ before :all do
6
+ auth = @auth
7
+ end
8
+
9
+ context '#set_mapping_url' do
10
+ it 'set mapping url and return ret_code == 0 if success' do
11
+ res = ::DSP::API::Account.set_mapping_url('http://www.baidu.com')
12
+ expect(res["ret_code"]).to eq 0
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+
4
+ describe ::DSP::API::IllegalAds do
5
+ before :all do
6
+ auth = @auth
7
+ end
8
+
9
+ context '#download' do
10
+ it 'download illegal ads and return ret_code == 0 if success' do
11
+ res = ::DSP::API::IllegalAds.download
12
+ expect(res["ret_code"]).to eq 0
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+
4
+ describe ::DSP::API::Report do
5
+ before :all do
6
+ auth = @auth
7
+ end
8
+
9
+ context '#download' do
10
+ it 'download reports and return ret_code == 0 if success' do
11
+ res = ::DSP::API::Report.download('2015-10-01', '2015-10-06')
12
+ expect(res["ret_code"]).to eq 0
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+
4
+ describe ::DSP::API::UploadAdsInfo do
5
+ before :all do
6
+ auth = @auth
7
+ end
8
+
9
+ context '#upload' do
10
+ it 'upload ads info and return ret_code == 0 if success' do
11
+ res = ::DSP::API::UploadAdsInfo.upload('http://dsp.hogic.cn/Public/Uploads/201508/55e00f321ba3c.flv', 123)
12
+ expect(res["ret_code"]).to eq 0
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ RSpec.configure do |config|
2
+
3
+ end
4
+
5
+ require 'dsp'
6
+
7
+
8
+ $auth = {dsp_id: 190, token: '73553e669b7270a4934706f76a99ad36'}
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dsp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - "姚露"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.13.7
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.13.7
27
+ description: dsp
28
+ email:
29
+ - y1150264176@163.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - ".rspec"
36
+ - README
37
+ - dsp.gemspec
38
+ - lib/dsp.rb
39
+ - lib/dsp/api.rb
40
+ - lib/dsp/api/account.rb
41
+ - lib/dsp/api/ads_info_sync.rb
42
+ - lib/dsp/api/ads_status.rb
43
+ - lib/dsp/api/illegal_ads.rb
44
+ - lib/dsp/api/report.rb
45
+ - lib/dsp/api/upload_ads_info.rb
46
+ - lib/dsp/bid.rb
47
+ - spec/api/ads_info_sync_spec.rb
48
+ - spec/api/ads_stauts_spec.rb
49
+ - spec/api/api_account_spec.rb
50
+ - spec/api/illegal_ads_spec.rb
51
+ - spec/api/report_spec.rb
52
+ - spec/api/upload_ads_info_spec.rb
53
+ - spec/spec_helper.rb
54
+ homepage: ''
55
+ licenses:
56
+ - GNU
57
+ metadata: {}
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 2.4.5.1
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: dsp
78
+ test_files:
79
+ - spec/api/ads_info_sync_spec.rb
80
+ - spec/api/ads_stauts_spec.rb
81
+ - spec/api/api_account_spec.rb
82
+ - spec/api/illegal_ads_spec.rb
83
+ - spec/api/report_spec.rb
84
+ - spec/api/upload_ads_info_spec.rb
85
+ - spec/spec_helper.rb