epom 0.6.2 → 0.7
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/lib/epom/epom_element.rb +15 -0
- data/lib/epom/version.rb +1 -1
- data/test/epom/advertiser_test.rb +2 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3fee8ba5c0b34b8cb4bfd75b7d515ea3b7f6ea9
|
4
|
+
data.tar.gz: ad87daee2a63a66bc872cadb40ae6b5ab303b81a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d612e6b3b7d6b11b70c0f4bd16a121f2f5fb73d5863dcc603a39ba5c5306a50bbfd585557420c306e98e338102cca47b10aa00b3ba141c66ef03e024e0c9a990
|
7
|
+
data.tar.gz: ef5418b65af7755c8577bc3cd75468b25d7e016596460d677112c40d6da82056c85e5dc5c931e8a1d0453025d4c22375d16167099d6c7163795c4c963b9fb784
|
data/lib/epom/epom_element.rb
CHANGED
@@ -6,6 +6,11 @@ module Epom
|
|
6
6
|
default_params :output => 'json'
|
7
7
|
debug_output $stderr
|
8
8
|
|
9
|
+
def self.login(username, password)
|
10
|
+
@@username = username
|
11
|
+
@@password = password
|
12
|
+
end
|
13
|
+
|
9
14
|
def self.extended_methods
|
10
15
|
{ }
|
11
16
|
end
|
@@ -38,6 +43,16 @@ module Epom
|
|
38
43
|
format :json
|
39
44
|
end
|
40
45
|
|
46
|
+
timestamp = Time.now.to_i * 1000
|
47
|
+
if body_params_signature.include?(:hash) and not body_params[:hash]
|
48
|
+
body_params[:hash] = Epom.create_hash(Epom.create_hash(@@password), timestamp)
|
49
|
+
end
|
50
|
+
if body_params_signature.include?(:timestamp) and not body_params[:timestamp]
|
51
|
+
body_params[:timestamp] = timestamp
|
52
|
+
end
|
53
|
+
if body_params_signature.include?(:username) and not body_params[:username]
|
54
|
+
body_params[:username] = @@username
|
55
|
+
end
|
41
56
|
|
42
57
|
if params_validation(url_params, url_params_signature) and params_validation(body_params, body_params_signature)
|
43
58
|
http_proxy ENV['proxy_address'], ENV['proxy_port'], ENV['proxy_user'], ENV['proxy_password']
|
data/lib/epom/version.rb
CHANGED
@@ -2,6 +2,8 @@ require 'test_helper'
|
|
2
2
|
require 'epom/advertiser'
|
3
3
|
|
4
4
|
class AdvertiserTest < ActiveSupport::TestCase
|
5
|
+
Epom::EpomElement.login(ENV['username'], ENV['password'])
|
6
|
+
|
5
7
|
test "truth" do
|
6
8
|
assert_kind_of Class, Epom::Advertiser
|
7
9
|
end
|
@@ -12,7 +14,6 @@ class AdvertiserTest < ActiveSupport::TestCase
|
|
12
14
|
timestamp = Time.now.to_i * 1000
|
13
15
|
body_params = {
|
14
16
|
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
15
|
-
:timestamp => timestamp,
|
16
17
|
:username => ENV['username']
|
17
18
|
}
|
18
19
|
url_params = {
|
@@ -29,7 +30,6 @@ class AdvertiserTest < ActiveSupport::TestCase
|
|
29
30
|
body_params = {
|
30
31
|
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
31
32
|
:timestamp => timestamp,
|
32
|
-
:username => ENV['username']
|
33
33
|
}
|
34
34
|
|
35
35
|
response = Epom::Advertiser.get_advertiser_permissions_for_user({}, body_params)
|
@@ -46,7 +46,6 @@ class AdvertiserTest < ActiveSupport::TestCase
|
|
46
46
|
test "get_campaigns_for_advertiser" do
|
47
47
|
timestamp = Time.now.to_i * 1000
|
48
48
|
body_params = {
|
49
|
-
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
50
49
|
:timestamp => timestamp,
|
51
50
|
:username => ENV['username']
|
52
51
|
}
|
@@ -67,9 +66,6 @@ class AdvertiserTest < ActiveSupport::TestCase
|
|
67
66
|
test "create advertiser" do
|
68
67
|
timestamp = Time.now.to_i * 1000
|
69
68
|
body_params = {
|
70
|
-
:hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
|
71
|
-
:timestamp => timestamp,
|
72
|
-
:username => ENV['username'],
|
73
69
|
:name => "advertiser #{DateTime.now}",
|
74
70
|
:contactName => "advertiser contactName",
|
75
71
|
:contactEmail => "advertiser@gmail.com",
|