epom 0.3 → 0.3.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3aeb28ba07e0ddd305b208f7d656993e7d11630b
4
- data.tar.gz: fc272687605ab4dec74807861b387867f6674230
3
+ metadata.gz: c2f7ff464e113173d1226be61d7f539ee678f5f0
4
+ data.tar.gz: 2396838f749d1781d4d40efe8ab81ec8db05c19c
5
5
  SHA512:
6
- metadata.gz: 04c22949fe245bdb3d50a03f73a90126b2cec7f98ab4fee0175d5ca4e7dce406614a1b7d416098e3c553aa11e56b5a7de2560bec1573893543e306ea110c44eb
7
- data.tar.gz: fd46af6b37a94018e479f78d29ebc3ab980d4c6fda1ce03e5dab66a8c668b9b388af7141245a34e8bb8bc92ad9ed788ca88c1d9ff42b9e6ee7373380c2890d58
6
+ metadata.gz: e92d8fa8eea1609a637bcd9539189390d864d871b924bb60729ed9721b91a3f2e788582999c195eccad82ac48db630194e564f1eda8f6cd6e5062911f8f21249
7
+ data.tar.gz: 6df4a1a6e3bb530616907f136411b1b924dec603c530bb1c1a1842d5a02ab78362817a66c288c6d5c6922dd3c9a95419eb7471aaca348db34695566b0265fecd
@@ -1,3 +1,3 @@
1
1
  module Epom
2
- VERSION = '0.3'
2
+ VERSION = '0.3.3'
3
3
  end
@@ -82,4 +82,6 @@ class AdvertiserTest < ActiveSupport::TestCase
82
82
  assert_instance_of Fixnum, response['id']
83
83
  response['id']
84
84
  end
85
+
86
+ define_get_tests_auto(Epom::Advertiser)
85
87
  end
@@ -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
@@ -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
@@ -50,4 +50,6 @@ class PlacementTest < ActiveSupport::TestCase
50
50
  assert_instance_of Fixnum, response['id']
51
51
  assert response['success']
52
52
  end
53
+
54
+ define_get_tests_auto(Epom::Placement)
53
55
  end
@@ -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
@@ -64,4 +64,6 @@ class ZoneTest < ActiveSupport::TestCase
64
64
  assert_instance_of String, first['name']
65
65
  end
66
66
  end
67
+
68
+ define_get_tests_auto(Epom::Zone)
67
69
  end
@@ -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
@@ -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
- define_method("test_#{extended_method}_auto") do
33
- url_parameters_signature = klass.extended_methods[extended_method][:url_parameters]
34
- body_parameters_signature = klass.extended_methods[extended_method][:body_parameters]
35
-
36
- url_params = {}
37
- if url_parameters_signature
38
- url_parameters_signature.each do |url_parameter|
39
- url_params[url_parameter] = ENV[url_parameter.to_s.underscore]
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
- body_params = {}
44
- body_parameters_signature.each do |body_parameter|
45
- body_params[body_parameter] = ENV[body_parameter.to_s.underscore]
46
- end
47
- timestamp = Time.now.to_i * 1000
48
- body_params[:timestamp] = timestamp
49
- body_params[:hash] = Epom.create_hash(Epom.create_hash(ENV['password']), timestamp)
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
- response = klass.send(extended_method, url_params, body_params)
52
- assert_not_instance_of Fixnum, response
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: '0.3'
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-26 00:00:00.000000000 Z
13
+ date: 2015-05-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails