Permalink
Browse files

The ProductCatalogSearch service now has its own SOAP::Mapping::Encod…

…edRegistry and SOAP::Mapping::LiteralRegistry objects to avoid class definition clashing.

The rest of the API's search the defaut one.
  • Loading branch information...
1 parent 281f176 commit 6baa63000f270913ea741bcbaeecacea60ef28de Jose Fernandez committed Jul 11, 2008
View
2 lib/cj4r.rb
@@ -19,8 +19,8 @@ module DefaultMappingRegistry
require 'cj4r/daily_publisher_commission_service'
require 'cj4r/real_time_commission_service'
-require 'cj4r/product_catalog_search_service'
require 'cj4r/advertiser_search_service'
+require 'cj4r/product_catalog_search_service'
require 'cj4r/link_search_service'
require 'cj4r/support_service'
View
2 lib/cj4r/drivers/product_catalog_search.rb
@@ -104,7 +104,7 @@ def initialize(adId = nil, advertiserId = nil, advertiserName = nil, buyUrl = ni
# sortOrder - SOAP::SOAPString
# startAt - SOAP::SOAPString
# maxResults - SOAP::SOAPString
-class Search
+class ProductSearchParams
attr_accessor :developerKey
attr_accessor :websiteId
attr_accessor :advertiserIds
View
7 lib/cj4r/drivers/product_catalog_search_driver.rb
@@ -18,8 +18,8 @@ class ProductSearchServiceV2PortType < ::SOAP::RPC::Driver
def initialize(endpoint_url = nil)
endpoint_url ||= DefaultEndpointUrl
super(endpoint_url, nil)
- self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
- self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
+ self.mapping_registry = DefaultMappingRegistry::ProductEncodedRegistry
+ self.literal_mapping_registry = DefaultMappingRegistry::ProductLiteralRegistry
init_methods
end
@@ -42,5 +42,4 @@ def init_methods
end
end
end
-end
-
+end
View
21 lib/cj4r/drivers/product_catalog_search_mapping_registry.rb
@@ -1,8 +1,11 @@
require 'cj4r/drivers/product_catalog_search.rb'
module DefaultMappingRegistry
+
+ ProductEncodedRegistry = ::SOAP::Mapping::EncodedRegistry.new
+ ProductLiteralRegistry = ::SOAP::Mapping::LiteralRegistry.new
- EncodedRegistry.register(
+ ProductEncodedRegistry.register(
:class => ProductResponse,
:schema_type => XSD::QName.new(NsProductServiceCjCom, "ProductResponse"),
:schema_element => [
@@ -13,15 +16,15 @@ module DefaultMappingRegistry
]
)
- EncodedRegistry.register(
+ ProductEncodedRegistry.register(
:class => ArrayOfProduct,
:schema_type => XSD::QName.new(NsProductDomainCjCom, "ArrayOfProduct"),
:schema_element => [
["product", ["Product[]", XSD::QName.new(NsProductDomainCjCom, "Product")], [0, nil]]
]
)
- EncodedRegistry.register(
+ ProductEncodedRegistry.register(
:class => Product,
:schema_type => XSD::QName.new(NsProductDomainCjCom, "Product"),
:schema_element => [
@@ -46,7 +49,7 @@ module DefaultMappingRegistry
]
)
- LiteralRegistry.register(
+ ProductLiteralRegistry.register(
:class => ProductResponse,
:schema_type => XSD::QName.new(NsProductServiceCjCom, "ProductResponse"),
:schema_element => [
@@ -57,15 +60,15 @@ module DefaultMappingRegistry
]
)
- LiteralRegistry.register(
+ ProductLiteralRegistry.register(
:class => ArrayOfProduct,
:schema_type => XSD::QName.new(NsProductDomainCjCom, "ArrayOfProduct"),
:schema_element => [
["product", ["Product[]", XSD::QName.new(NsProductDomainCjCom, "Product")], [0, nil]]
]
)
- LiteralRegistry.register(
+ ProductLiteralRegistry.register(
:class => Product,
:schema_type => XSD::QName.new(NsProductDomainCjCom, "Product"),
:schema_element => [
@@ -90,8 +93,8 @@ module DefaultMappingRegistry
]
)
- LiteralRegistry.register(
- :class => Search,
+ ProductLiteralRegistry.register(
+ :class => ProductSearchParams,
:schema_name => XSD::QName.new(NsApiCjCom, "search"),
:schema_element => [
["developerKey", "SOAP::SOAPString"],
@@ -116,7 +119,7 @@ module DefaultMappingRegistry
]
)
- LiteralRegistry.register(
+ ProductLiteralRegistry.register(
:class => SearchResponse,
:schema_name => XSD::QName.new(NsApiCjCom, "searchResponse"),
:schema_element => [
View
2 lib/cj4r/product_catalog_search_service.rb
@@ -44,7 +44,7 @@ def find_last(options)
end
def find_every(options)
- params = Search.new(
+ params = ProductSearchParams.new(
options[:developer_key],
options[:website_id],
options[:advertiser_ids],

0 comments on commit 6baa630

Please sign in to comment.