epom 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +28 -0
- data/config/application.yml +41 -0
- data/lib/epom.rb +22 -0
- data/lib/epom/ad_unit_size.rb +15 -0
- data/lib/epom/advertiser.rb +45 -0
- data/lib/epom/auth.rb +31 -0
- data/lib/epom/banner.rb +525 -0
- data/lib/epom/banner_type.rb +15 -0
- data/lib/epom/campaign.rb +508 -0
- data/lib/epom/day_of_week.rb +11 -0
- data/lib/epom/epom_element.rb +61 -0
- data/lib/epom/limit_counters.rb +10 -0
- data/lib/epom/payment_model.rb +9 -0
- data/lib/epom/period_type.rb +9 -0
- data/lib/epom/placement.rb +56 -0
- data/lib/epom/placement_type.rb +7 -0
- data/lib/epom/publisher.rb +6 -0
- data/lib/epom/relation.rb +9 -0
- data/lib/epom/site.rb +84 -0
- data/lib/epom/version.rb +3 -0
- data/lib/epom/zone.rb +38 -0
- data/lib/tasks/epom_tasks.rake +4 -0
- data/test/IMG_5457-128x128.JPG +0 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +16 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +4 -0
- data/test/dummy/log/test.log +17350 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/epom/advertiser_test.rb +85 -0
- data/test/epom/auth_test.rb +50 -0
- data/test/epom/banner_test.rb +194 -0
- data/test/epom/campaign_test.rb +65 -0
- data/test/epom/placement_test.rb +53 -0
- data/test/epom/site_test.rb +136 -0
- data/test/epom/zone_test.rb +67 -0
- data/test/epom_test.rb +38 -0
- data/test/logo-128x128.png +0 -0
- data/test/test.php +51 -0
- data/test/test.rb +21 -0
- data/test/test_helper.rb +55 -0
- metadata +256 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/404.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'epom/advertiser'
|
3
|
+
|
4
|
+
class AdvertiserTest < ActiveSupport::TestCase
|
5
|
+
test "truth" do
|
6
|
+
assert_kind_of Class, Epom::Advertiser
|
7
|
+
end
|
8
|
+
|
9
|
+
test "delete_advertiser" do
|
10
|
+
advertiser_id = test_create_advertiser()
|
11
|
+
|
12
|
+
timestamp = Time.now.to_i * 1000
|
13
|
+
body_params = {
|
14
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
15
|
+
:timestamp => timestamp,
|
16
|
+
:username => ENV['username']
|
17
|
+
}
|
18
|
+
url_params = {
|
19
|
+
:advertiserId => advertiser_id
|
20
|
+
}
|
21
|
+
|
22
|
+
response = Epom::Advertiser.delete_advertiser(url_params, body_params)
|
23
|
+
assert_instance_of Hash, response
|
24
|
+
assert response['success']
|
25
|
+
end
|
26
|
+
|
27
|
+
test "get_advertiser_permissions_for_user" do
|
28
|
+
timestamp = Time.now.to_i * 1000
|
29
|
+
body_params = {
|
30
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
31
|
+
:timestamp => timestamp,
|
32
|
+
:username => ENV['username']
|
33
|
+
}
|
34
|
+
|
35
|
+
response = Epom::Advertiser.get_advertiser_permissions_for_user({}, body_params)
|
36
|
+
assert_instance_of Array, response
|
37
|
+
if response.count > 0
|
38
|
+
first = response[0]
|
39
|
+
assert_instance_of Hash, first
|
40
|
+
assert_instance_of Fixnum, first['id']
|
41
|
+
assert_instance_of String, first['name']
|
42
|
+
assert_instance_of String, first['shareType']
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
test "get_campaigns_for_advertiser" do
|
47
|
+
timestamp = Time.now.to_i * 1000
|
48
|
+
body_params = {
|
49
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
50
|
+
:timestamp => timestamp,
|
51
|
+
:username => ENV['username']
|
52
|
+
}
|
53
|
+
url_params = {
|
54
|
+
:advertiserId => ENV['advertiser_id'],
|
55
|
+
}
|
56
|
+
|
57
|
+
response = Epom::Advertiser.get_campaigns_for_advertiser(url_params, body_params)
|
58
|
+
assert_instance_of Array, response
|
59
|
+
if response.count > 0
|
60
|
+
first = response[0]
|
61
|
+
assert_instance_of Hash, first
|
62
|
+
assert_instance_of Fixnum, first['id']
|
63
|
+
assert_instance_of String, first['name']
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
test "create advertiser" do
|
68
|
+
timestamp = Time.now.to_i * 1000
|
69
|
+
body_params = {
|
70
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
71
|
+
:timestamp => timestamp,
|
72
|
+
:username => ENV['username'],
|
73
|
+
:name => "advertiser #{DateTime.now}",
|
74
|
+
:contactName => "advertiser contactName",
|
75
|
+
:contactEmail => "advertiser@gmail.com",
|
76
|
+
:description => "advertiser description"
|
77
|
+
}
|
78
|
+
|
79
|
+
response = Epom::Advertiser.create_advertiser({}, body_params)
|
80
|
+
assert_instance_of Hash, response
|
81
|
+
assert response['success']
|
82
|
+
assert_instance_of Fixnum, response['id']
|
83
|
+
response['id']
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'epom/auth'
|
3
|
+
|
4
|
+
class AuthTest < ActiveSupport::TestCase
|
5
|
+
ACCOUNTS = [{:username => 'supervisor', :password => 'supervisor'},
|
6
|
+
{:username => 'network', :password => 'network'},
|
7
|
+
{:username => 'publisher', :password => 'publisher'},
|
8
|
+
{:username => 'advertiser', :password => 'advertiser'},
|
9
|
+
{:username => ENV['username'], :password => ENV['password']}]
|
10
|
+
|
11
|
+
test "truth" do
|
12
|
+
assert_kind_of Class, Epom::Auth
|
13
|
+
end
|
14
|
+
|
15
|
+
test "get authentication token" do
|
16
|
+
ACCOUNTS.each do |account|
|
17
|
+
response = Epom::Auth.get_authentication_token({}, account)
|
18
|
+
assert_instance_of Hash, response
|
19
|
+
assert response['success']
|
20
|
+
assert_instance_of String, response['authToken']
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
test "register user" do
|
25
|
+
timestamp = Time.now.to_i * 1000
|
26
|
+
url_params = {
|
27
|
+
:key => ENV['public_key'],
|
28
|
+
:hash => Epom.create_hash("advertiser_#{timestamp}", 'advertiser', "advertiser_#{timestamp}@gmail.com", ENV['private_key'], timestamp),
|
29
|
+
:timestamp => timestamp
|
30
|
+
}
|
31
|
+
body_params = {
|
32
|
+
:username => "advertiser_#{timestamp}",
|
33
|
+
:password => 'advertiser',
|
34
|
+
:email => "advertiser_#{timestamp}@gmail.com",
|
35
|
+
:role => 'ADVERTISER',
|
36
|
+
:phone => '+22(345)7891012',
|
37
|
+
:firstName => 'firstName',
|
38
|
+
:lastName => 'lastName',
|
39
|
+
:websiteUrl => 'http://www.qwe.com',
|
40
|
+
:company => 'company',
|
41
|
+
:country => 'US',
|
42
|
+
:state => 'Florida',
|
43
|
+
:enable_market_integration => true
|
44
|
+
}
|
45
|
+
|
46
|
+
response = Epom::Auth.register_user(url_params, body_params)
|
47
|
+
assert_instance_of Hash, response
|
48
|
+
assert response['success']
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,194 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'epom/banner'
|
3
|
+
|
4
|
+
class BannerTest < ActiveSupport::TestCase
|
5
|
+
test "truth" do
|
6
|
+
assert_kind_of Class, Epom::Banner
|
7
|
+
end
|
8
|
+
|
9
|
+
define_get_tests_auto(Epom::Banner)
|
10
|
+
|
11
|
+
test "get_os_values" do
|
12
|
+
timestamp = Time.now.to_i * 1000
|
13
|
+
url_params = {
|
14
|
+
:bannerId => ENV['banner_id']
|
15
|
+
}
|
16
|
+
body_params = {
|
17
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
18
|
+
:timestamp => timestamp,
|
19
|
+
:username => ENV['username'],
|
20
|
+
}
|
21
|
+
|
22
|
+
response = Epom::Banner.get_os_values(url_params, body_params)
|
23
|
+
assert_instance_of Array, response
|
24
|
+
if response.count > 0
|
25
|
+
first = response[0]
|
26
|
+
assert_instance_of String, first
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
#TODO: create banner with LOCAL_FILE
|
31
|
+
test "create_banner" do
|
32
|
+
timestamp = Time.now.to_i * 1000
|
33
|
+
body_params = {
|
34
|
+
:campaignId => ENV['campaign_id'],
|
35
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
36
|
+
:timestamp => timestamp,
|
37
|
+
:username => ENV['username'],
|
38
|
+
:weight => 1,
|
39
|
+
:imageBannerLink => "http://beachgrooves.com/wp-content/uploads/2014/07/BeachGrooves-Logos-website2.png",
|
40
|
+
:url => "http://www.example.com",
|
41
|
+
:name => "banner #{timestamp}",
|
42
|
+
:bannerType => Epom::BannerType::EXTERNAL_FILE,
|
43
|
+
:adUnitId => 10,
|
44
|
+
:active => '1',
|
45
|
+
:placementType => Epom::PlacementType::SITE_PLACEMENT,
|
46
|
+
:adUnitWidth => 237,#128
|
47
|
+
:adUnitHeight => 100,#114
|
48
|
+
# :imageFile => File.new('test/IMG_5457-128x128.JPG')
|
49
|
+
}
|
50
|
+
|
51
|
+
response = Epom::Banner.create_banner({}, body_params)
|
52
|
+
assert_instance_of Hash, response
|
53
|
+
assert_instance_of Fixnum, response['id']
|
54
|
+
assert_instance_of Fixnum, response['campaignId']
|
55
|
+
assert_equal ENV['campaign_id'].to_i, response['campaignId']
|
56
|
+
end
|
57
|
+
|
58
|
+
test "get_banner_ad_unit_values" do
|
59
|
+
timestamp = Time.now.to_i * 1000
|
60
|
+
body_params = {
|
61
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
62
|
+
:timestamp => timestamp,
|
63
|
+
:username => ENV['username'],
|
64
|
+
:placementType => Epom::PlacementType::SITE_PLACEMENT
|
65
|
+
}
|
66
|
+
|
67
|
+
response = Epom::Banner.get_banner_ad_unit_values({}, body_params)
|
68
|
+
assert_instance_of Array, response
|
69
|
+
if response.count > 0
|
70
|
+
first = response.first
|
71
|
+
assert_instance_of Fixnum, first['id']
|
72
|
+
assert_instance_of Fixnum, first['height']
|
73
|
+
assert_instance_of Fixnum, first['width']
|
74
|
+
assert_instance_of String, first['name']
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
test "get_banner_pricing" do
|
79
|
+
timestamp = Time.now.to_i * 1000
|
80
|
+
body_params = {
|
81
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
82
|
+
:timestamp => timestamp,
|
83
|
+
:username => ENV['username'],
|
84
|
+
}
|
85
|
+
url_params = {
|
86
|
+
:bannerId => ENV['banner_id']
|
87
|
+
}
|
88
|
+
|
89
|
+
response = Epom::Banner.get_banner_pricing(url_params, body_params)
|
90
|
+
assert_instance_of Hash, response
|
91
|
+
assert_instance_of Fixnum, response['id']
|
92
|
+
assert_instance_of String, response['paymentModel']
|
93
|
+
end
|
94
|
+
|
95
|
+
test "get_placements_for_banner" do
|
96
|
+
timestamp = Time.now.to_i * 1000
|
97
|
+
body_params = {
|
98
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
99
|
+
:timestamp => timestamp,
|
100
|
+
:username => ENV['username'],
|
101
|
+
}
|
102
|
+
url_params = {
|
103
|
+
:bannerId => ENV['banner_id']
|
104
|
+
}
|
105
|
+
|
106
|
+
response = Epom::Banner.get_placements_for_banner(url_params, body_params)
|
107
|
+
assert_instance_of Array, response
|
108
|
+
if response.count > 0
|
109
|
+
first = response[0]
|
110
|
+
assert_instance_of Hash, first
|
111
|
+
assert_instance_of Fixnum, first['id']
|
112
|
+
assert_instance_of String, first['name']
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
test "get_targetings" do
|
117
|
+
timestamp = Time.now.to_i * 1000
|
118
|
+
body_params = {
|
119
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
120
|
+
:timestamp => timestamp,
|
121
|
+
:username => ENV['username'],
|
122
|
+
}
|
123
|
+
url_params = {
|
124
|
+
:bannerId => ENV['banner_id']
|
125
|
+
}
|
126
|
+
|
127
|
+
response = Epom::Banner.get_targetings(url_params, body_params)
|
128
|
+
assert_instance_of Array, response
|
129
|
+
if response.count > 0
|
130
|
+
first = response[0]
|
131
|
+
assert_instance_of Hash, first
|
132
|
+
assert_instance_of Fixnum, first['id']
|
133
|
+
assert_instance_of String, first['rule']
|
134
|
+
assert_instance_of String, first['type']
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
test "get_advertising_categories" do
|
139
|
+
timestamp = Time.now.to_i * 1000
|
140
|
+
body_params = {
|
141
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
142
|
+
:timestamp => timestamp,
|
143
|
+
:username => ENV['username'],
|
144
|
+
}
|
145
|
+
|
146
|
+
response = Epom::Banner.get_advertising_categories({}, body_params)
|
147
|
+
assert_instance_of Array, response
|
148
|
+
if response.count > 0
|
149
|
+
first = response[0]
|
150
|
+
assert_instance_of Hash, first
|
151
|
+
assert_instance_of Fixnum, first['id']
|
152
|
+
assert_instance_of String, first['name']
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
test "get_banner" do
|
157
|
+
timestamp = Time.now.to_i * 1000
|
158
|
+
body_params = {
|
159
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
160
|
+
:timestamp => timestamp,
|
161
|
+
:username => ENV['username'],
|
162
|
+
}
|
163
|
+
url_params = {
|
164
|
+
:bannerId => ENV['banner_id']
|
165
|
+
}
|
166
|
+
|
167
|
+
response = Epom::Banner.get_banner(url_params, body_params)
|
168
|
+
assert_instance_of Hash, response
|
169
|
+
assert_instance_of Fixnum, response['campaignId']
|
170
|
+
assert_instance_of String, response['url']
|
171
|
+
assert_instance_of String, response['name']
|
172
|
+
assert_instance_of String, response['bannerType']
|
173
|
+
assert_instance_of Fixnum, response['adUnitId']
|
174
|
+
assert_instance_of String, response['placementType']
|
175
|
+
end
|
176
|
+
|
177
|
+
test "get_publishing_categories" do
|
178
|
+
timestamp = Time.now.to_i * 1000
|
179
|
+
body_params = {
|
180
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
181
|
+
:timestamp => timestamp,
|
182
|
+
:username => ENV['username'],
|
183
|
+
}
|
184
|
+
|
185
|
+
response = Epom::Banner.get_publishing_categories({}, body_params)
|
186
|
+
assert_instance_of Array, response
|
187
|
+
if response.count > 0
|
188
|
+
first = response[0]
|
189
|
+
assert_instance_of Hash, first
|
190
|
+
assert_instance_of Fixnum, first['id']
|
191
|
+
assert_instance_of String, first['name']
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|