touchlocal-openx 1.1.1 → 1.1.2
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.
- data/History.txt +18 -0
- data/{README.txt → README.rdoc} +48 -18
- data/VERSION +1 -1
- data/lib/openx/invocation.rb +1 -0
- data/lib/openx/services/banner.rb +1 -1
- data/lib/openx/services/base.rb +3 -1
- data/php/openx-2.8.1-keywords.diff +110 -0
- data/touchlocal-openx.gemspec +5 -4
- metadata +5 -4
data/History.txt
CHANGED
@@ -4,3 +4,21 @@
|
|
4
4
|
|
5
5
|
* Birthday!
|
6
6
|
|
7
|
+
=== 1.1.0 / 2009-10-26
|
8
|
+
|
9
|
+
* 2 major enhancements
|
10
|
+
|
11
|
+
* OpenX API Version 2 Support added
|
12
|
+
* OpenX Invocation API Support added
|
13
|
+
|
14
|
+
* 1 minor enhancement
|
15
|
+
|
16
|
+
* Ruby on Rails documentation support added
|
17
|
+
|
18
|
+
=== 1.1.1 / 2009-11-06
|
19
|
+
|
20
|
+
* Minor bugfix to environment handling for Win32 users
|
21
|
+
|
22
|
+
=== 1.1.2 / 2009-11-19
|
23
|
+
|
24
|
+
* Documentation updates and patch to enable banner support on the OpenX Server
|
data/{README.txt → README.rdoc}
RENAMED
@@ -1,12 +1,13 @@
|
|
1
|
-
=
|
1
|
+
= OpenX
|
2
2
|
|
3
|
-
* http://
|
3
|
+
* http://gemcutter.org/gems/touchlocal-openx
|
4
|
+
* http://github.com/touchlocal/openx
|
4
5
|
|
5
|
-
==
|
6
|
+
== Description
|
6
7
|
|
7
8
|
A Ruby interface to the OpenX XML-RPC API.
|
8
9
|
|
9
|
-
==
|
10
|
+
== Synopsis
|
10
11
|
|
11
12
|
OpenX::Services::Base.configuration = {
|
12
13
|
'username' => 'admin',
|
@@ -26,35 +27,35 @@ A Ruby interface to the OpenX XML-RPC API.
|
|
26
27
|
Publisher.create!(
|
27
28
|
:agency => agency,
|
28
29
|
:name => 'My Test Publisher',
|
29
|
-
:contact_name => '
|
30
|
-
:email => '
|
30
|
+
:contact_name => 'My Contact',
|
31
|
+
:email => 'agency@example.com',
|
31
32
|
:username => 'user',
|
32
33
|
:password => 'password'
|
33
34
|
)
|
34
35
|
end
|
35
36
|
|
36
|
-
==
|
37
|
+
== Requirements
|
37
38
|
|
38
39
|
* ruby
|
39
40
|
|
40
|
-
==
|
41
|
+
== Install
|
41
42
|
|
42
|
-
* sudo gem install openx
|
43
|
+
* sudo gem install touchlocal-openx --source "http://gemcutter.org"
|
44
|
+
* add "require 'openx'" to your code
|
43
45
|
* Update your $HOME/.openx/credentials.yml file. Here is a sample:
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
invocation_url: http://www.example.com/www/delivery/axmlrpc.php
|
47
|
+
production:
|
48
|
+
username: admin
|
49
|
+
password: admin
|
50
|
+
url: http://www.example.com/www/api/v2/xmlrpc/
|
51
|
+
invocation_url: http://www.example.com/www/delivery/axmlrpc.php
|
51
52
|
|
52
53
|
The YAML file lists configuration for each environment. The gem uses the
|
53
54
|
'production' environment by default. Trailing slash is required on the 'url'.
|
54
55
|
'invocation_url' is only used by the OpenX::Invocation methods to serve
|
55
56
|
advertisements over XML-RPC
|
56
57
|
|
57
|
-
==
|
58
|
+
== Ruby on Rails Integration
|
58
59
|
|
59
60
|
As common deployment scenarios for RoR projects dictates that you manage all
|
60
61
|
of your dependent files from within your project, storing your credentials.yml
|
@@ -73,13 +74,42 @@ Then, add your gem require line to the initialize block of the environment.rb:
|
|
73
74
|
You will of course need to install the gem, either manually or via
|
74
75
|
rake gems:install
|
75
76
|
|
76
|
-
Finally, create a config/initializers/openx.rb and include the following
|
77
|
+
Finally, create a config/initializers/openx.rb and include the following:
|
77
78
|
|
79
|
+
require 'yaml'
|
78
80
|
OpenX::Services::Base.configuration =
|
79
81
|
YAML.load_file(File.join(Rails.root, 'config', 'credentials.yml'))[Rails.env]
|
80
82
|
|
81
83
|
|
82
|
-
==
|
84
|
+
== Banner Keyword Support
|
85
|
+
|
86
|
+
Not all attributes of OpenX objects that can be set in the web interface are
|
87
|
+
accessible via the API. A notable case of this is the ability to access
|
88
|
+
Banner Keywords. While it seems to be a case of "We'll add them as people
|
89
|
+
need them," this process is slower than one might expect;
|
90
|
+
https://developer.openx.org/jira/browse/OX-4779 has been an open ticket since
|
91
|
+
January 2009.
|
92
|
+
|
93
|
+
As TouchLocal required the ability to access Banner Keywords, the
|
94
|
+
OpenX::Services::Banner object has the support for this attribute. If the
|
95
|
+
server does not support the attribute, then setting it will have no effect,
|
96
|
+
and it will return nil when retrieving it. To enable support on the server,
|
97
|
+
you will need access to the server source, and the included
|
98
|
+
php/openx-2.8.1-keywords.diff
|
99
|
+
|
100
|
+
Copy the openx-2.8.1-keywords.diff file to the root of the OpenX distribution
|
101
|
+
on your server, and execute:
|
102
|
+
|
103
|
+
patch -p0 < openx-2.8.1-keywords.diff
|
104
|
+
|
105
|
+
This will patch the relevant OpenX API to allow access to the keyword
|
106
|
+
attribute, meaning that now both your client and server support it. Happy days.
|
107
|
+
|
108
|
+
This patch has been tested on OpenX Server versions 2.8.1 and 2.8.2 at the
|
109
|
+
time of writing.
|
110
|
+
|
111
|
+
|
112
|
+
== License
|
83
113
|
|
84
114
|
(The MIT License)
|
85
115
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.2
|
data/lib/openx/invocation.rb
CHANGED
@@ -25,6 +25,7 @@ module OpenX
|
|
25
25
|
|
26
26
|
url = OpenX::Services::Base.configuration['invocation_url']
|
27
27
|
|
28
|
+
# Basic requirement as per /lib/max/Delivery/XML-RPC.php in OpenX
|
28
29
|
settings = {:cookies => [], :remote_addr => 'localhost'}
|
29
30
|
|
30
31
|
context = [] # used by reference after initial use
|
@@ -59,7 +59,7 @@ module OpenX
|
|
59
59
|
:image => :aImage,
|
60
60
|
:backup_image => :aBackupImage,
|
61
61
|
# 'keyword' only supported by patched server
|
62
|
-
# as per
|
62
|
+
# as per README.rdoc
|
63
63
|
# No averse effect when unsupported by server (returns nil)
|
64
64
|
:keyword => :keyword
|
65
65
|
|
data/lib/openx/services/base.rb
CHANGED
@@ -12,7 +12,9 @@ module OpenX
|
|
12
12
|
# YAML.load_file(File.join(Rails.root, 'config', 'credentials.yml'))[Rails.env]
|
13
13
|
#
|
14
14
|
# Rescue nil is there for Rails sites that are monitored by Monit,
|
15
|
-
# which does not set the environment variables as expected
|
15
|
+
# which does not set the environment variables as expected.
|
16
|
+
# Note that the configuration can be set explicitly (as above),
|
17
|
+
# in which case this constant is not used and can safely be nil.
|
16
18
|
CONFIGURATION_YAML = File.join((ENV['HOME'] || ENV['HOMEPATH']), '.openx', 'credentials.yml') rescue nil
|
17
19
|
|
18
20
|
@@connection = nil
|
@@ -0,0 +1,110 @@
|
|
1
|
+
Index: www/api/v2/xmlrpc/BannerXmlRpcService.php
|
2
|
+
===================================================================
|
3
|
+
--- www/api/v2/xmlrpc/BannerXmlRpcService.php (revision 44144)
|
4
|
+
+++ www/api/v2/xmlrpc/BannerXmlRpcService.php (working copy)
|
5
|
+
@@ -86,7 +86,7 @@
|
6
|
+
1, array('campaignId', 'bannerName', 'storageType', 'fileName',
|
7
|
+
'imageURL', 'htmlTemplate', 'width', 'height', 'weight',
|
8
|
+
'target', 'url', 'bannerText', 'status', 'adserver', 'transparent',
|
9
|
+
- 'capping', 'sessionCapping', 'block', 'comments'),
|
10
|
+
+ 'capping', 'sessionCapping', 'block', 'comments', 'keyword'),
|
11
|
+
array('aImage', 'aBackupImage'), $oResponseWithError)) {
|
12
|
+
|
13
|
+
return $oResponseWithError;
|
14
|
+
@@ -121,7 +121,7 @@
|
15
|
+
1, array('bannerId', 'campaignId', 'bannerName', 'storageType', 'fileName',
|
16
|
+
'imageURL', 'htmlTemplate', 'width', 'height', 'weight',
|
17
|
+
'target', 'url', 'bannerText', 'status', 'adserver', 'transparent',
|
18
|
+
- 'capping', 'sessionCapping', 'block', 'comments'),
|
19
|
+
+ 'capping', 'sessionCapping', 'block', 'comments', 'keyword'),
|
20
|
+
array('aImage', 'aBackupImage'), $oResponseWithError)) {
|
21
|
+
|
22
|
+
return $oResponseWithError;
|
23
|
+
Index: lib/OA/Dll/Banner.php
|
24
|
+
===================================================================
|
25
|
+
--- lib/OA/Dll/Banner.php (revision 44144)
|
26
|
+
+++ lib/OA/Dll/Banner.php (working copy)
|
27
|
+
@@ -203,7 +203,8 @@
|
28
|
+
!$this->checkStructureNotRequiredIntegerField($oBanner, 'capping') ||
|
29
|
+
!$this->checkStructureNotRequiredIntegerField($oBanner, 'sessionCapping') ||
|
30
|
+
!$this->checkStructureNotRequiredIntegerField($oBanner, 'block') ||
|
31
|
+
- !$this->checkStructureNotRequiredStringField($oBanner, 'comments')
|
32
|
+
+ !$this->checkStructureNotRequiredStringField($oBanner, 'comments') ||
|
33
|
+
+ !$this->checkStructureNotRequiredStringField($oBanner, 'keyword')
|
34
|
+
) {
|
35
|
+
return false;
|
36
|
+
}
|
37
|
+
Index: lib/OA/Dll/BannerInfo.php
|
38
|
+
===================================================================
|
39
|
+
--- lib/OA/Dll/BannerInfo.php (revision 44144)
|
40
|
+
+++ lib/OA/Dll/BannerInfo.php (working copy)
|
41
|
+
@@ -210,6 +210,13 @@
|
42
|
+
var $comments;
|
43
|
+
|
44
|
+
/**
|
45
|
+
+ * This field provides keywords to be stored.
|
46
|
+
+ *
|
47
|
+
+ * @var string $keyword
|
48
|
+
+ */
|
49
|
+
+ var $keyword;
|
50
|
+
+
|
51
|
+
+ /**
|
52
|
+
* This method sets all default values when adding a new banner.
|
53
|
+
*
|
54
|
+
* @access public
|
55
|
+
@@ -251,6 +258,10 @@
|
56
|
+
if (is_null($this->block)) {
|
57
|
+
// Leave null
|
58
|
+
}
|
59
|
+
+
|
60
|
+
+ if (is_null($this->keyword)) {
|
61
|
+
+ // Leave null
|
62
|
+
+ }
|
63
|
+
}
|
64
|
+
|
65
|
+
function encodeImage($aImage)
|
66
|
+
@@ -305,6 +316,7 @@
|
67
|
+
'aImage' => 'custom',
|
68
|
+
'aBackupImage' => 'custom',
|
69
|
+
'comments' => 'string',
|
70
|
+
+ 'keyword' => 'string',
|
71
|
+
);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
Index: lib/xmlrpc/php/BannerInfo.php
|
75
|
+
===================================================================
|
76
|
+
--- lib/xmlrpc/php/BannerInfo.php (revision 44144)
|
77
|
+
+++ lib/xmlrpc/php/BannerInfo.php (working copy)
|
78
|
+
@@ -210,6 +210,13 @@
|
79
|
+
var $comments;
|
80
|
+
|
81
|
+
/**
|
82
|
+
+ * This field provides keywords to be stored.
|
83
|
+
+ *
|
84
|
+
+ * @var string $keyword
|
85
|
+
+ */
|
86
|
+
+ var $keyword;
|
87
|
+
+
|
88
|
+
+ /**
|
89
|
+
* This method sets all default values when adding a new banner.
|
90
|
+
*
|
91
|
+
* @access public
|
92
|
+
@@ -251,6 +258,10 @@
|
93
|
+
if (is_null($this->block)) {
|
94
|
+
// Leave null
|
95
|
+
}
|
96
|
+
+
|
97
|
+
+ if (is_null($this->keyword)) {
|
98
|
+
+ // Leave null
|
99
|
+
+ }
|
100
|
+
}
|
101
|
+
|
102
|
+
function encodeImage($aImage)
|
103
|
+
@@ -305,6 +316,7 @@
|
104
|
+
'aImage' => 'custom',
|
105
|
+
'aBackupImage' => 'custom',
|
106
|
+
'comments' => 'string',
|
107
|
+
+ 'keyword' => 'string',
|
108
|
+
);
|
109
|
+
}
|
110
|
+
}
|
data/touchlocal-openx.gemspec
CHANGED
@@ -5,21 +5,21 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{touchlocal-openx}
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Aaron Patterson", "Andy Smith", "TouchLocal Plc"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-19}
|
13
13
|
s.description = %q{A Ruby interface to the OpenX XML-RPC API}
|
14
14
|
s.email = %q{info@touchlocal.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
|
-
"README.
|
16
|
+
"README.rdoc"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
19
|
".gitignore",
|
20
20
|
"History.txt",
|
21
21
|
"Manifest.txt",
|
22
|
-
"README.
|
22
|
+
"README.rdoc",
|
23
23
|
"Rakefile",
|
24
24
|
"VERSION",
|
25
25
|
"lib/openx.rb",
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/openx/services/session.rb",
|
36
36
|
"lib/openx/services/zone.rb",
|
37
37
|
"lib/openx/xmlrpc_client.rb",
|
38
|
+
"php/openx-2.8.1-keywords.diff",
|
38
39
|
"test/assets/300x250.jpg",
|
39
40
|
"test/assets/cat.swf",
|
40
41
|
"test/helper.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: touchlocal-openx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-11-
|
14
|
+
date: 2009-11-19 00:00:00 +10:00
|
15
15
|
default_executable:
|
16
16
|
dependencies: []
|
17
17
|
|
@@ -22,12 +22,12 @@ executables: []
|
|
22
22
|
extensions: []
|
23
23
|
|
24
24
|
extra_rdoc_files:
|
25
|
-
- README.
|
25
|
+
- README.rdoc
|
26
26
|
files:
|
27
27
|
- .gitignore
|
28
28
|
- History.txt
|
29
29
|
- Manifest.txt
|
30
|
-
- README.
|
30
|
+
- README.rdoc
|
31
31
|
- Rakefile
|
32
32
|
- VERSION
|
33
33
|
- lib/openx.rb
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- lib/openx/services/session.rb
|
44
44
|
- lib/openx/services/zone.rb
|
45
45
|
- lib/openx/xmlrpc_client.rb
|
46
|
+
- php/openx-2.8.1-keywords.diff
|
46
47
|
- test/assets/300x250.jpg
|
47
48
|
- test/assets/cat.swf
|
48
49
|
- test/helper.rb
|