epom 0.3 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/epom/version.rb +1 -1
- data/test/epom/advertiser_test.rb +2 -0
- data/test/epom/banner_test.rb +2 -2
- data/test/epom/campaign_test.rb +19 -2
- data/test/epom/placement_test.rb +2 -0
- data/test/epom/site_test.rb +1 -2
- data/test/epom/zone_test.rb +2 -0
- data/test/epom_test.rb +0 -31
- data/test/test_helper.rb +22 -18
- 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: c2f7ff464e113173d1226be61d7f539ee678f5f0
|
4
|
+
data.tar.gz: 2396838f749d1781d4d40efe8ab81ec8db05c19c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e92d8fa8eea1609a637bcd9539189390d864d871b924bb60729ed9721b91a3f2e788582999c195eccad82ac48db630194e564f1eda8f6cd6e5062911f8f21249
|
7
|
+
data.tar.gz: 6df4a1a6e3bb530616907f136411b1b924dec603c530bb1c1a1842d5a02ab78362817a66c288c6d5c6922dd3c9a95419eb7471aaca348db34695566b0265fecd
|
data/lib/epom/version.rb
CHANGED
data/test/epom/banner_test.rb
CHANGED
@@ -6,8 +6,6 @@ class BannerTest < ActiveSupport::TestCase
|
|
6
6
|
assert_kind_of Class, Epom::Banner
|
7
7
|
end
|
8
8
|
|
9
|
-
define_get_tests_auto(Epom::Banner)
|
10
|
-
|
11
9
|
test "get_os_values" do
|
12
10
|
timestamp = Time.now.to_i * 1000
|
13
11
|
url_params = {
|
@@ -191,4 +189,6 @@ class BannerTest < ActiveSupport::TestCase
|
|
191
189
|
assert_instance_of String, first['name']
|
192
190
|
end
|
193
191
|
end
|
192
|
+
|
193
|
+
define_get_tests_auto(Epom::Banner)
|
194
194
|
end
|
data/test/epom/campaign_test.rb
CHANGED
@@ -6,8 +6,6 @@ class CampaignTest < ActiveSupport::TestCase
|
|
6
6
|
assert_kind_of Class, Epom::Campaign
|
7
7
|
end
|
8
8
|
|
9
|
-
define_get_tests_auto(Epom::Campaign)
|
10
|
-
|
11
9
|
test "get_actions" do
|
12
10
|
timestamp = Time.now.to_i * 1000
|
13
11
|
url_params = {
|
@@ -62,4 +60,23 @@ class CampaignTest < ActiveSupport::TestCase
|
|
62
60
|
assert_instance_of Fixnum, response['id']
|
63
61
|
assert_instance_of String, response['name']
|
64
62
|
end
|
63
|
+
|
64
|
+
test "get_targeting" do
|
65
|
+
timestamp = Time.now.to_i * 1000
|
66
|
+
url_params = {
|
67
|
+
:campaignId => ENV['campaign_id'],
|
68
|
+
:targetId => '3929'
|
69
|
+
}
|
70
|
+
body_params = {
|
71
|
+
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
72
|
+
:timestamp => timestamp,
|
73
|
+
:username => ENV['username'],
|
74
|
+
}
|
75
|
+
|
76
|
+
response = Epom::Campaign.get_targeting(url_params, body_params)
|
77
|
+
assert_instance_of Hash, response
|
78
|
+
assert_instance_of Fixnum, response['id']
|
79
|
+
end
|
80
|
+
|
81
|
+
define_get_tests_auto(Epom::Campaign)
|
65
82
|
end
|
data/test/epom/placement_test.rb
CHANGED
data/test/epom/site_test.rb
CHANGED
@@ -6,8 +6,6 @@ class SiteTest < ActiveSupport::TestCase
|
|
6
6
|
assert_kind_of Class, Epom::Site
|
7
7
|
end
|
8
8
|
|
9
|
-
define_get_tests_auto(Epom::Site)
|
10
|
-
|
11
9
|
test "get_sites" do
|
12
10
|
timestamp = Time.now.to_i * 1000
|
13
11
|
body_params = {
|
@@ -133,4 +131,5 @@ class SiteTest < ActiveSupport::TestCase
|
|
133
131
|
end
|
134
132
|
end
|
135
133
|
|
134
|
+
define_get_tests_auto(Epom::Site)
|
136
135
|
end
|
data/test/epom/zone_test.rb
CHANGED
data/test/epom_test.rb
CHANGED
@@ -4,35 +4,4 @@ class EpomTest < ActiveSupport::TestCase
|
|
4
4
|
test "truth" do
|
5
5
|
assert_kind_of Module, Epom
|
6
6
|
end
|
7
|
-
|
8
|
-
test "get_targeting" do
|
9
|
-
timestamp = Time.now.to_i * 1000
|
10
|
-
body_params = {
|
11
|
-
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
12
|
-
:timestamp => timestamp,
|
13
|
-
:username => ENV['username'],
|
14
|
-
}
|
15
|
-
url_params = {
|
16
|
-
:bannerId => ENV['banner_id'],
|
17
|
-
:targetId => ENV['target_id']
|
18
|
-
}
|
19
|
-
|
20
|
-
response = Epom::Banner.get_targeting(url_params, body_params)
|
21
|
-
assert_instance_of Hash, response
|
22
|
-
end
|
23
|
-
|
24
|
-
test "set_site_pricing" do
|
25
|
-
timestamp = Time.now.to_i * 1000
|
26
|
-
url_params = {
|
27
|
-
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
28
|
-
:timestamp => timestamp,
|
29
|
-
:username => ENV['username'],
|
30
|
-
:siteId => ENV['site_id']
|
31
|
-
}
|
32
|
-
body_params = '{"paymentModel":"FIXED_PRICE","pricingType":"CPM","price":4.2}'
|
33
|
-
|
34
|
-
response = Epom::Site.set_site_pricing(url_params, body_params)
|
35
|
-
assert_instance_of Hash, response
|
36
|
-
assert response['success']
|
37
|
-
end
|
38
7
|
end
|
data/test/test_helper.rb
CHANGED
@@ -29,27 +29,31 @@ end
|
|
29
29
|
|
30
30
|
def define_get_tests_auto(klass)
|
31
31
|
klass.extended_methods.keys.grep(/^get_/).each do |extended_method|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
klass_name = klass.name.include?('::') ? klass.name.split('::').last : klass.name
|
33
|
+
klass_test = "#{klass_name}Test".constantize
|
34
|
+
unless klass_test.instance_methods.include?("test_#{extended_method}".to_sym)
|
35
|
+
define_method("test_#{extended_method}_auto") do
|
36
|
+
url_parameters_signature = klass.extended_methods[extended_method][:url_parameters]
|
37
|
+
body_parameters_signature = klass.extended_methods[extended_method][:body_parameters]
|
38
|
+
|
39
|
+
url_params = {}
|
40
|
+
if url_parameters_signature
|
41
|
+
url_parameters_signature.each do |url_parameter|
|
42
|
+
url_params[url_parameter] = ENV[url_parameter.to_s.underscore]
|
43
|
+
end
|
40
44
|
end
|
41
|
-
end
|
42
45
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
body_params = {}
|
47
|
+
body_parameters_signature.each do |body_parameter|
|
48
|
+
body_params[body_parameter] = ENV[body_parameter.to_s.underscore]
|
49
|
+
end
|
50
|
+
timestamp = Time.now.to_i * 1000
|
51
|
+
body_params[:timestamp] = timestamp
|
52
|
+
body_params[:hash] = Epom.create_hash(Epom.create_hash(ENV['password']), timestamp)
|
50
53
|
|
51
|
-
|
52
|
-
|
54
|
+
response = klass.send(extended_method, url_params, body_params)
|
55
|
+
assert_not_instance_of Fixnum, response
|
56
|
+
end
|
53
57
|
end
|
54
58
|
end
|
55
59
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Quintero
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-05-
|
13
|
+
date: 2015-05-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|