farleyknight-commission_junction 1.0.0 → 1.0.1
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/README.txt +11 -12
- data/commission_junction.gemspec +4 -2
- data/examples/based_on_website.rb +49 -0
- data/lib/commission_junction.rb +83 -10
- data/lib/commission_junction/ext.rb +0 -8
- metadata +2 -1
data/README.txt
CHANGED
@@ -1,25 +1,24 @@
|
|
1
1
|
= commission_junction
|
2
2
|
|
3
|
-
|
3
|
+
== What?
|
4
4
|
|
5
|
-
|
5
|
+
A Soap API for CommissionJunction
|
6
6
|
|
7
|
-
|
7
|
+
== Where?
|
8
8
|
|
9
|
-
|
9
|
+
http://github.com/farleyknight/commission_junction/
|
10
10
|
|
11
|
-
|
11
|
+
== How?
|
12
12
|
|
13
|
-
|
13
|
+
This API is mostly based on the Symfony plugin: http://trac.symfony-project.org/wiki/sfCommissionJunctionPlugin
|
14
14
|
|
15
|
-
|
15
|
+
== Git it:
|
16
16
|
|
17
|
-
|
17
|
+
$ gem sources -a http://gems.github.com
|
18
18
|
|
19
|
-
|
20
|
-
* $ sudo gem install farleyknight-commission_junction
|
19
|
+
$ sudo gem install farleyknight-commission_junction
|
21
20
|
|
22
|
-
==
|
21
|
+
== License:
|
23
22
|
|
24
23
|
(The MIT License)
|
25
24
|
|
@@ -42,4 +41,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
42
41
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
43
42
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
44
43
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
45
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
44
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/commission_junction.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "commission_junction"
|
3
|
-
s.version = "1.0.
|
3
|
+
s.version = "1.0.1"
|
4
4
|
s.date = "2008-07-24"
|
5
5
|
s.summary = "Commission Junction SOAP API"
|
6
6
|
s.email = "farleyknight@gmail.com"
|
@@ -8,7 +8,9 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.description = "Commission Junction SOAP API"
|
9
9
|
s.has_rdoc = true
|
10
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"]
|
11
|
+
s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "commission_junction.gemspec", "lib/commission_junction.rb", "lib/commission_junction/ext.rb", "examples/based_on_website.rb"]
|
12
12
|
s.rdoc_options = ["--main", "README.txt"]
|
13
13
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
14
14
|
end
|
15
|
+
|
16
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
# A fairly simple example of the library
|
3
|
+
|
4
|
+
require 'commission_junction'
|
5
|
+
|
6
|
+
# Your developer key
|
7
|
+
developerKey = "1234567890abc...."
|
8
|
+
|
9
|
+
# Your Web site ID (PID)
|
10
|
+
websiteId = "1234567"
|
11
|
+
|
12
|
+
# A new instance of the Commission Junction service API
|
13
|
+
cj = CommissionJunction.new(developerKey, websiteId)
|
14
|
+
|
15
|
+
# A minimal search, using the keywords parameter
|
16
|
+
result = cj.searchLinks(:keywords => "kitchen sink")
|
17
|
+
|
18
|
+
# All CJ results are hashes.. I found this to be easier to
|
19
|
+
# use than objects because hashes are more transparent:
|
20
|
+
|
21
|
+
pp results
|
22
|
+
# =>
|
23
|
+
# {"totalResults"=>"1200",
|
24
|
+
# "count"=>"10",
|
25
|
+
# "links"=>
|
26
|
+
# {"LinkDetail"=>
|
27
|
+
# [{"threeMonthEPC"=>"-9999999.0",
|
28
|
+
# "sevenDayEPC"=>"-9999999.0",
|
29
|
+
# "promotionType"=>{},
|
30
|
+
# "linkDestination"=>
|
31
|
+
|
32
|
+
# Another example, using 'sortBy', shown in the web services documentation
|
33
|
+
results = cj.searchLinks(:keywords => "kitchen sink", :sortBy => "linkId")
|
34
|
+
|
35
|
+
pp results
|
36
|
+
# =>
|
37
|
+
# {"totalResults"=>"1200",
|
38
|
+
# "count"=>"10",
|
39
|
+
# "links"=>
|
40
|
+
# {"LinkDetail"=>
|
41
|
+
# [{"threeMonthEPC"=>"-9999999.0",
|
42
|
+
# "sevenDayEPC"=>"-9999999.0",
|
43
|
+
# "promotionType"=>{},
|
44
|
+
# "linkDestination"=>
|
45
|
+
# "http://www.vintagetub.com/asp/sinks.asp?utm_id=ID2001",
|
46
|
+
# "relationshipStatus"=>"notjoined",
|
47
|
+
# "linkId"=>"10411673",
|
48
|
+
# "category"=>"bed & bath",
|
49
|
+
# "linkCodeJavascript"=>{},
|
data/lib/commission_junction.rb
CHANGED
@@ -4,7 +4,67 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
4
4
|
require 'soap/wsdlDriver'
|
5
5
|
require 'commission_junction/ext'
|
6
6
|
|
7
|
+
#
|
8
|
+
# A fairly simple example of the library
|
9
|
+
# require 'commission_junction'
|
10
|
+
#
|
11
|
+
# Your developer key
|
12
|
+
# developerKey = "1234567890abc...."
|
13
|
+
#
|
14
|
+
# Your Web site ID (PID)
|
15
|
+
# websiteId = "1234567"
|
16
|
+
#
|
17
|
+
# A new instance of the Commission Junction service API
|
18
|
+
# cj = CommissionJunction.new(developerKey, websiteId)
|
19
|
+
#
|
20
|
+
# A minimal search, using the keywords parameter
|
21
|
+
# result = cj.searchLinks(:keywords => "kitchen sink")
|
22
|
+
#
|
23
|
+
# All CJ results are hashes.. I found this to be easier to
|
24
|
+
# use than objects because hashes are more transparent:
|
25
|
+
#
|
26
|
+
# pp results
|
27
|
+
#
|
28
|
+
# Outputs:
|
29
|
+
# # {"totalResults"=>"1200",
|
30
|
+
# # "count"=>"10",
|
31
|
+
# # "links"=>
|
32
|
+
# # {"LinkDetail"=>
|
33
|
+
# # [{"threeMonthEPC"=>"-9999999.0",
|
34
|
+
# # "sevenDayEPC"=>"-9999999.0",
|
35
|
+
# # "promotionType"=>{},
|
36
|
+
# # "linkDestination"=>
|
37
|
+
#
|
38
|
+
# Another example, using 'sortBy', shown in the web services documentation
|
39
|
+
# results = cj.searchLinks(:keywords => "kitchen sink", :sortBy => "linkId")
|
40
|
+
#
|
41
|
+
# pp results
|
42
|
+
#
|
43
|
+
# Outputs:
|
44
|
+
# # {"totalResults"=>"1200",
|
45
|
+
# # "count"=>"10",
|
46
|
+
# # "links"=>
|
47
|
+
# # {"LinkDetail"=>
|
48
|
+
# # [{"threeMonthEPC"=>"-9999999.0",
|
49
|
+
# # "sevenDayEPC"=>"-9999999.0",
|
50
|
+
# # "promotionType"=>{},
|
51
|
+
# # "linkDestination"=>
|
52
|
+
# # "http://www.vintagetub.com/asp/sinks.asp?utm_id=ID2001",
|
53
|
+
# # "relationshipStatus"=>"notjoined",
|
54
|
+
# # "linkId"=>"10411673",
|
55
|
+
# # "category"=>"bed & bath",
|
56
|
+
# # "linkCodeJavascript"=>{},
|
57
|
+
#
|
58
|
+
|
7
59
|
class CommissionJunction
|
60
|
+
module VERSION
|
61
|
+
MAJOR = 1
|
62
|
+
MINOR = 0
|
63
|
+
TINY = 2
|
64
|
+
|
65
|
+
STRING = [MAJOR, MINOR, TINY].join('.')
|
66
|
+
end
|
67
|
+
|
8
68
|
@@wsdls = {
|
9
69
|
'ProductSearch' => 'https://product.api.cj.com/wsdl/version2/productSearchServiceV2.wsdl',
|
10
70
|
'LinkSearch' => 'https://product.api.cj.com/wsdl/version2/linkSearchServiceV2.wsdl',
|
@@ -20,6 +80,7 @@ class CommissionJunction
|
|
20
80
|
end
|
21
81
|
|
22
82
|
#
|
83
|
+
# For a list of possible params (where applicable) or more information, go to:
|
23
84
|
# http://help.cj.com/en/web_services/Product_Catalog_Search_Service_v.2.htm
|
24
85
|
#
|
25
86
|
def productSearch(params = {})
|
@@ -27,34 +88,39 @@ class CommissionJunction
|
|
27
88
|
end
|
28
89
|
|
29
90
|
#
|
91
|
+
# For a list of possible params (where applicable) or more information, go to:
|
30
92
|
# http://help.cj.com/en/web_services/Link_Search_Service_v.2.htm
|
31
93
|
#
|
32
94
|
def searchLinks(params = {})
|
33
|
-
doOperation('LinkSearch',
|
95
|
+
doOperation('LinkSearch', 'searchLinks', self.instance_variables_hash.merge(params))
|
34
96
|
end
|
35
97
|
|
36
98
|
#
|
99
|
+
# For a list of possible params (where applicable) or more information, go to:
|
37
100
|
# http://help.cj.com/en/web_services/Publisher_Commission_Service.htm
|
38
101
|
#
|
39
102
|
def findPublisherCommissions(params = {})
|
40
|
-
doOperation('PublisherCommission',
|
103
|
+
doOperation('PublisherCommission', 'findPublisherCommissions', self.instance_variables_hash.merge(params))
|
41
104
|
end
|
42
105
|
|
43
106
|
#
|
107
|
+
# For a list of possible params (where applicable) or more information, go to:
|
44
108
|
# http://help.cj.com/en/web_services/Publisher_Commission_Service.htm
|
45
109
|
#
|
46
110
|
def findPublisherCommissionDetails(params = {})
|
47
|
-
doOperation('PublisherCommission',
|
111
|
+
doOperation('PublisherCommission', 'findPublisherCommissionDetails', self.instance_variables_hash.merge(params))
|
48
112
|
end
|
49
113
|
|
50
114
|
#
|
115
|
+
# For a list of possible params (where applicable) or more information, go to:
|
51
116
|
# http://help.cj.com/en/web_services/Real_Time_Commission_Service.htm
|
52
117
|
#
|
53
118
|
def retrieveLatestTransactions(params = {})
|
54
|
-
doOperation('RealTimeCommission',
|
119
|
+
doOperation('RealTimeCommission', 'retrieveLatestTransactions', self.instance_variables_hash.merge(params))
|
55
120
|
end
|
56
121
|
|
57
122
|
#
|
123
|
+
# For a list of possible params (where applicable) or more information, go to:
|
58
124
|
# http://help.cj.com/en/web_services/Advertiser_Search_Service_v.2.htm
|
59
125
|
#
|
60
126
|
def advertiserSearch(params = {})
|
@@ -64,47 +130,54 @@ class CommissionJunction
|
|
64
130
|
end
|
65
131
|
|
66
132
|
#
|
133
|
+
# For a list of possible params (where applicable) or more information, go to:
|
67
134
|
# http://help.cj.com/en/web_services/Publisher_Lookup_Service.htm
|
68
135
|
#
|
69
136
|
def publisherLookup(token)
|
70
|
-
doOperation('PublisherLookup',
|
137
|
+
doOperation('PublisherLookup', 'publisherLookup', self.instance_variables_hash.merge({:token => token}))
|
71
138
|
end
|
72
139
|
|
73
140
|
#
|
141
|
+
# For a list of possible params (where applicable) or more information, go to:
|
74
142
|
# http://help.cj.com/en/web_services/Support_Services.htm
|
75
143
|
#
|
76
144
|
def getCategories(locale = 'US')
|
77
|
-
doOperation('FieldTypesSupport',
|
145
|
+
doOperation('FieldTypesSupport', 'getCategories', self.instance_variables_hash.merge({:locale => locale}))
|
78
146
|
end
|
79
147
|
|
80
148
|
#
|
149
|
+
# For a list of possible params (where applicable) or more information, go to:
|
81
150
|
# http://help.cj.com/en/web_services/Support_Services.htm
|
82
151
|
#
|
83
152
|
def getLinkTypes
|
84
|
-
doOperation('FieldTypesSupport',
|
153
|
+
doOperation('FieldTypesSupport', 'getLinkTypes', self.instance_variables_hash)
|
85
154
|
end
|
86
155
|
|
87
156
|
#
|
157
|
+
# For a list of possible params (where applicable) or more information, go to:
|
88
158
|
# http://help.cj.com/en/web_services/Support_Services.htm
|
89
159
|
#
|
90
160
|
def getLinkSizes
|
91
|
-
doOperation('FieldTypesSupport',
|
161
|
+
doOperation('FieldTypesSupport', 'getLinkSizes', self.instance_variables_hash)
|
92
162
|
end
|
93
163
|
|
94
164
|
#
|
165
|
+
# For a list of possible params (where applicable) or more information, go to:
|
95
166
|
# http://help.cj.com/en/web_services/Support_Services.htm
|
96
167
|
#
|
97
168
|
def getCountries(locale = 'US')
|
98
|
-
doOperation('FieldTypesSupport',
|
169
|
+
doOperation('FieldTypesSupport', 'getCountries', self.instance_variables_hash.merge({:locale => locale}))
|
99
170
|
end
|
100
171
|
|
101
172
|
#
|
173
|
+
# For a list of possible params (where applicable) or more information, go to:
|
102
174
|
# http://help.cj.com/en/web_services/Support_Services.htm
|
103
175
|
#
|
104
176
|
def getLanguages
|
105
|
-
doOperation('FieldTypesSupport',
|
177
|
+
doOperation('FieldTypesSupport', 'getLanguages', self.instance_variables_hash)
|
106
178
|
end
|
107
179
|
|
180
|
+
protected
|
108
181
|
def doOperation(service, method, params)
|
109
182
|
factory = SOAP::WSDLDriverFactory.new(@@wsdls[service])
|
110
183
|
driver = factory.create_rpc_driver
|
@@ -8,14 +8,6 @@ Array.class_eval do
|
|
8
8
|
end
|
9
9
|
end
|
10
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
11
|
Object.class_eval do
|
20
12
|
def instance_variables_hash
|
21
13
|
instance_variables.inject({}) do |hash, name|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: farleyknight-commission_junction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Farley Knight
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- commission_junction.gemspec
|
32
32
|
- lib/commission_junction.rb
|
33
33
|
- lib/commission_junction/ext.rb
|
34
|
+
- examples/based_on_website.rb
|
34
35
|
has_rdoc: true
|
35
36
|
homepage: http://github.com/farleyknight/commission_junction/
|
36
37
|
post_install_message:
|