farleyknight-commission_junction 1.0.0
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 +4 -0
- data/Manifest.txt +25 -0
- data/README.txt +45 -0
- data/Rakefile +4 -0
- data/commission_junction.gemspec +14 -0
- data/lib/commission_junction.rb +113 -0
- data/lib/commission_junction/ext.rb +42 -0
- metadata +62 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
History.txt
|
2
|
+
License.txt
|
3
|
+
Manifest.txt
|
4
|
+
PostInstall.txt
|
5
|
+
README.txt
|
6
|
+
Rakefile
|
7
|
+
config/hoe.rb
|
8
|
+
config/requirements.rb
|
9
|
+
lib/commission_junction.rb
|
10
|
+
lib/commission_junction/version.rb
|
11
|
+
script/console
|
12
|
+
script/destroy
|
13
|
+
script/generate
|
14
|
+
script/txt2html
|
15
|
+
setup.rb
|
16
|
+
tasks/deployment.rake
|
17
|
+
tasks/environment.rake
|
18
|
+
tasks/website.rake
|
19
|
+
test/test_commission_junction.rb
|
20
|
+
test/test_helper.rb
|
21
|
+
website/index.html
|
22
|
+
website/index.txt
|
23
|
+
website/javascripts/rounded_corners_lite.inc.js
|
24
|
+
website/stylesheets/screen.css
|
25
|
+
website/template.html.erb
|
data/README.txt
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
= commission_junction
|
2
|
+
|
3
|
+
* http://github.com/farleyknight/commission_junction/
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
A Soap API for Commission Junction
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* http://webservices.cj.com/
|
12
|
+
|
13
|
+
== SYNOPSIS:
|
14
|
+
|
15
|
+
* This API is mostly based on the Symfony plugin: http://trac.symfony-project.org/wiki/sfCommissionJunctionPlugin
|
16
|
+
|
17
|
+
== INSTALL:
|
18
|
+
|
19
|
+
* $ gem sources -a http://gems.github.com # add github to your sources
|
20
|
+
* $ sudo gem install farleyknight-commission_junction
|
21
|
+
|
22
|
+
== LICENSE:
|
23
|
+
|
24
|
+
(The MIT License)
|
25
|
+
|
26
|
+
Copyright (c) 2008 Farley Knight
|
27
|
+
|
28
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
29
|
+
a copy of this software and associated documentation files (the
|
30
|
+
'Software'), to deal in the Software without restriction, including
|
31
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
32
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
33
|
+
permit persons to whom the Software is furnished to do so, subject to
|
34
|
+
the following conditions:
|
35
|
+
|
36
|
+
The above copyright notice and this permission notice shall be
|
37
|
+
included in all copies or substantial portions of the Software.
|
38
|
+
|
39
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
40
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
41
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
42
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
43
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
44
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
45
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "commission_junction"
|
3
|
+
s.version = "1.0.0"
|
4
|
+
s.date = "2008-07-24"
|
5
|
+
s.summary = "Commission Junction SOAP API"
|
6
|
+
s.email = "farleyknight@gmail.com"
|
7
|
+
s.homepage = "http://github.com/farleyknight/commission_junction/"
|
8
|
+
s.description = "Commission Junction SOAP API"
|
9
|
+
s.has_rdoc = true
|
10
|
+
s.authors = ["Farley Knight"]
|
11
|
+
s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "commission_junction.gemspec", "lib/commission_junction.rb", "lib/commission_junction/ext.rb"]
|
12
|
+
s.rdoc_options = ["--main", "README.txt"]
|
13
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
14
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
+
|
4
|
+
require 'soap/wsdlDriver'
|
5
|
+
require 'commission_junction/ext'
|
6
|
+
|
7
|
+
class CommissionJunction
|
8
|
+
@@wsdls = {
|
9
|
+
'ProductSearch' => 'https://product.api.cj.com/wsdl/version2/productSearchServiceV2.wsdl',
|
10
|
+
'LinkSearch' => 'https://product.api.cj.com/wsdl/version2/linkSearchServiceV2.wsdl',
|
11
|
+
'PublisherCommission' => 'https://product.api.cj.com/wsdl/version2/publisherCommissionService.wsdl',
|
12
|
+
'RealTimeCommission' => 'https://product.api.cj.com/wsdl/version2/realtimeCommissionService.wsdl',
|
13
|
+
'AdvertiserSearch' => 'https://product.api.cj.com/wsdl/version2/advertiserSearchServiceV2.wsdl',
|
14
|
+
'PublisherLookup' => 'https://product.api.cj.com/wsdl/version2/publisherLookupService.wsdl',
|
15
|
+
'FieldTypesSupport' => 'https://product.api.cj.com/wsdl/version2/supportServiceV2.wsdl'
|
16
|
+
}
|
17
|
+
|
18
|
+
def initialize(developerKey, websiteId)
|
19
|
+
@developerKey, @websiteId = developerKey, websiteId
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# http://help.cj.com/en/web_services/Product_Catalog_Search_Service_v.2.htm
|
24
|
+
#
|
25
|
+
def productSearch(params = {})
|
26
|
+
doOperation('ProductSearch', 'search', self.instance_variables_hash.merge(params))
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# http://help.cj.com/en/web_services/Link_Search_Service_v.2.htm
|
31
|
+
#
|
32
|
+
def searchLinks(params = {})
|
33
|
+
doOperation('LinkSearch', __method__, self.instance_variables_hash.merge(params))
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# http://help.cj.com/en/web_services/Publisher_Commission_Service.htm
|
38
|
+
#
|
39
|
+
def findPublisherCommissions(params = {})
|
40
|
+
doOperation('PublisherCommission', __method__, self.instance_variables_hash.merge(params))
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# http://help.cj.com/en/web_services/Publisher_Commission_Service.htm
|
45
|
+
#
|
46
|
+
def findPublisherCommissionDetails(params = {})
|
47
|
+
doOperation('PublisherCommission', __method__, self.instance_variables_hash.merge(params))
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# http://help.cj.com/en/web_services/Real_Time_Commission_Service.htm
|
52
|
+
#
|
53
|
+
def retrieveLatestTransactions(params = {})
|
54
|
+
doOperation('RealTimeCommission', __method__, self.instance_variables_hash.merge(params))
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# http://help.cj.com/en/web_services/Advertiser_Search_Service_v.2.htm
|
59
|
+
#
|
60
|
+
def advertiserSearch(params = {})
|
61
|
+
params[:startAt] ||= 0
|
62
|
+
params[:maxResults] ||= 10
|
63
|
+
doOperation('AdvertiserSearch', 'search', self.instance_variables_hash.merge(params))
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# http://help.cj.com/en/web_services/Publisher_Lookup_Service.htm
|
68
|
+
#
|
69
|
+
def publisherLookup(token)
|
70
|
+
doOperation('PublisherLookup', __method__, self.instance_variables_hash.merge({:token => token}))
|
71
|
+
end
|
72
|
+
|
73
|
+
#
|
74
|
+
# http://help.cj.com/en/web_services/Support_Services.htm
|
75
|
+
#
|
76
|
+
def getCategories(locale = 'US')
|
77
|
+
doOperation('FieldTypesSupport', __method__, self.instance_variables_hash.merge({:locale => locale}))
|
78
|
+
end
|
79
|
+
|
80
|
+
#
|
81
|
+
# http://help.cj.com/en/web_services/Support_Services.htm
|
82
|
+
#
|
83
|
+
def getLinkTypes
|
84
|
+
doOperation('FieldTypesSupport', __method__, self.instance_variables_hash)
|
85
|
+
end
|
86
|
+
|
87
|
+
#
|
88
|
+
# http://help.cj.com/en/web_services/Support_Services.htm
|
89
|
+
#
|
90
|
+
def getLinkSizes
|
91
|
+
doOperation('FieldTypesSupport', __method__, self.instance_variables_hash)
|
92
|
+
end
|
93
|
+
|
94
|
+
#
|
95
|
+
# http://help.cj.com/en/web_services/Support_Services.htm
|
96
|
+
#
|
97
|
+
def getCountries(locale = 'US')
|
98
|
+
doOperation('FieldTypesSupport', __method__, self.instance_variables_hash.merge({:locale => locale}))
|
99
|
+
end
|
100
|
+
|
101
|
+
#
|
102
|
+
# http://help.cj.com/en/web_services/Support_Services.htm
|
103
|
+
#
|
104
|
+
def getLanguages
|
105
|
+
doOperation('FieldTypesSupport', __method__, self.instance_variables_hash)
|
106
|
+
end
|
107
|
+
|
108
|
+
def doOperation(service, method, params)
|
109
|
+
factory = SOAP::WSDLDriverFactory.new(@@wsdls[service])
|
110
|
+
driver = factory.create_rpc_driver
|
111
|
+
driver.send(method, params).to_hash["out"]
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
Array.class_eval do
|
3
|
+
def to_hash
|
4
|
+
self.inject({}) do |hash, pair|
|
5
|
+
hash[pair[0]] = pair[1]
|
6
|
+
hash
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# Hash.class_eval do
|
12
|
+
# def to_struct
|
13
|
+
# return {} if empty?
|
14
|
+
# keys = self.keys.map {|k| k.to_sym }
|
15
|
+
# Struct.new(*keys).new(*(self.values))
|
16
|
+
# end
|
17
|
+
# end
|
18
|
+
|
19
|
+
Object.class_eval do
|
20
|
+
def instance_variables_hash
|
21
|
+
instance_variables.inject({}) do |hash, name|
|
22
|
+
hash[name.gsub("@", "")] = instance_variable_get(name)
|
23
|
+
hash
|
24
|
+
end
|
25
|
+
end
|
26
|
+
alias :to_hash :instance_variables_hash
|
27
|
+
end
|
28
|
+
|
29
|
+
SOAP::Mapping::Object.class_eval do
|
30
|
+
def to_hash
|
31
|
+
__xmlele.map do |qname, value|
|
32
|
+
value = if value.is_a? SOAP::Mapping::Object
|
33
|
+
value.to_hash
|
34
|
+
elsif value.is_a? Array
|
35
|
+
value.map {|v| v.is_a?(SOAP::Mapping::Object) ? v.to_hash : v }
|
36
|
+
else
|
37
|
+
value
|
38
|
+
end
|
39
|
+
[qname.name, value]
|
40
|
+
end.to_hash
|
41
|
+
end
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: farleyknight-commission_junction
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Farley Knight
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-07-24 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Commission Junction SOAP API
|
17
|
+
email: farleyknight@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- History.txt
|
24
|
+
- Manifest.txt
|
25
|
+
- README.txt
|
26
|
+
files:
|
27
|
+
- History.txt
|
28
|
+
- Manifest.txt
|
29
|
+
- README.txt
|
30
|
+
- Rakefile
|
31
|
+
- commission_junction.gemspec
|
32
|
+
- lib/commission_junction.rb
|
33
|
+
- lib/commission_junction/ext.rb
|
34
|
+
has_rdoc: true
|
35
|
+
homepage: http://github.com/farleyknight/commission_junction/
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options:
|
38
|
+
- --main
|
39
|
+
- README.txt
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
version:
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "0"
|
53
|
+
version:
|
54
|
+
requirements: []
|
55
|
+
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 1.2.0
|
58
|
+
signing_key:
|
59
|
+
specification_version: 2
|
60
|
+
summary: Commission Junction SOAP API
|
61
|
+
test_files: []
|
62
|
+
|