titlepage 0.9.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/testtask'
6
6
  require "rake/gempackagetask"
7
7
  require 'spec/rake/spectask'
8
8
 
9
- PKG_VERSION = "0.9.6"
9
+ PKG_VERSION = "1.0.0"
10
10
  PKG_NAME = "titlepage"
11
11
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
12
  RUBYFORGE_PROJECT = 'rbook'
@@ -70,7 +70,8 @@ spec = Gem::Specification.new do |spec|
70
70
  spec.extra_rdoc_files = %w{README COPYING LICENSE}
71
71
  spec.rdoc_options << '--title' << 'titlepage Documentation' << '--main' << 'README' << '-q'
72
72
  spec.add_dependency('rbook-isbn', '>= 1.0')
73
- spec.add_dependency('soap4r', '>= 1.5.8')
73
+ spec.add_dependency('andand', '1.3.1')
74
+ spec.add_dependency('troelskn-handsoap', '0.1.2')
74
75
  spec.author = "James Healy"
75
76
  spec.email = "jimmy@deefa.com"
76
77
  spec.rubyforge_project = "rbook"
@@ -1,15 +1,14 @@
1
- # assuming you have rbook installed via rubygems,
2
- # in a regular script, replace the following require
3
- # line with these 2 lines:
4
- # require 'rubygems'
5
- # require 'rbook/titlepage'
6
- require "rubygems"
7
- require File.dirname(__FILE__) + '/../lib/titlepage'
8
-
9
- TitlePage::Client.open("username", "password") do |tp|
10
-
11
- puts tp.find("0091835135").inspect
12
- sleep 3
13
- puts tp.find("1741146712").inspect
14
-
15
- end
1
+ # assuming you have titlepage installed via rubygems,
2
+ # in a regular script, replace the following require
3
+ # line with these 2 lines:
4
+ # require 'rubygems'
5
+ # require 'titlepage'
6
+ require File.dirname(__FILE__) + '/../lib/titlepage'
7
+
8
+ TitlePage::Client.open("username", "password") do |tp|
9
+
10
+ puts tp.find("0091835135").inspect
11
+ sleep 3
12
+ puts tp.find("1741146712").inspect
13
+
14
+ end
@@ -1,4 +1,8 @@
1
- require 'rubygems'
1
+ # assuming you have titlepage installed via rubygems,
2
+ # in a regular script, replace the following require
3
+ # line with these 2 lines:
4
+ # require 'rubygems'
5
+ # require 'titlepage'
2
6
  require File.dirname(__FILE__) + '/../lib/titlepage'
3
7
 
4
8
  client = TitlePage::WWWClient.new
data/lib/titlepage.rb CHANGED
@@ -1,21 +1,18 @@
1
- $LOAD_PATH.unshift("/../")
2
-
3
- # the soap4r gem is often a little better than the version that lives in
4
- # the ruby standard library, so if the local system has the gem installed
5
- # use that
6
- begin
7
- gem 'soap4r'
8
- rescue LoadError => e
9
- # do nothing
10
- end
1
+ # encoding: utf-8
11
2
 
3
+ require 'bigdecimal'
4
+ require 'net/http'
12
5
  require 'rubygems'
6
+ gem 'troelskn-handsoap', '0.1.2'
7
+ gem 'andand', '1.3.1'
8
+ require "handsoap"
9
+ require "andand"
10
+
13
11
  require 'rbook/isbn'
14
- require File.dirname(__FILE__) + '/titlepage/titlepage_driver'
15
- require File.dirname(__FILE__) + '/titlepage/titlepage_utils'
16
- require File.dirname(__FILE__) + '/titlepage/mapping_registry'
17
- require File.dirname(__FILE__) + '/titlepage/client'
18
- require File.dirname(__FILE__) + '/titlepage/wwwclient'
12
+
13
+ if RUBY_VERSION < "1.9"
14
+ require 'iconv'
15
+ end
19
16
 
20
17
  # a convenience module for accessing the SOAP API for http://www.titlepage.com.
21
18
  # Uses boilerplate code generated by soap4r.
@@ -42,6 +39,14 @@ require File.dirname(__FILE__) + '/titlepage/wwwclient'
42
39
  # puts tp.find("9780672327568").inspect
43
40
  # end
44
41
  module TitlePage
45
- class InvalidRubyVersionError < RuntimeError;end;
42
+ SERVICE_ENDPOINT = {
43
+ :uri => "http://www.titlepage.com.au/ws/TitleQuery.php",
44
+ :version => 1
45
+ }
46
46
  class NotLoggedInError < RuntimeError;end;
47
47
  end
48
+
49
+ require File.dirname(__FILE__) + '/titlepage/driver'
50
+ require File.dirname(__FILE__) + '/titlepage/utils'
51
+ require File.dirname(__FILE__) + '/titlepage/client'
52
+ require File.dirname(__FILE__) + '/titlepage/wwwclient'
@@ -1,4 +1,4 @@
1
- require 'drb'
1
+ # encoding: utf-8
2
2
 
3
3
  module TitlePage
4
4
 
@@ -14,13 +14,13 @@ module TitlePage
14
14
  # Optional driver parameter allows an alternative SOAP driver to the default to be specified.
15
15
  # This is primarily for testing purposes and probably isn't useful to anyone in the real world.
16
16
  def initialize
17
- @driver = TitleQueryPortType.new
17
+ @driver = TitlePage::Driver.new
18
18
  @token = nil
19
19
  end
20
20
 
21
21
  # login to the titlepage API.
22
+ #
22
23
  def login(username, password)
23
- raise InvalidRubyVersionError, 'Ruby 1.8.3 or higher is required to use this class' unless RUBY_VERSION >= "1.8.3"
24
24
  logout if @token
25
25
  @token = @driver.login(username, password)
26
26
  if @token
@@ -31,6 +31,7 @@ module TitlePage
31
31
  end
32
32
 
33
33
  # logout from the titlepage API
34
+ #
34
35
  def logout
35
36
  if @token
36
37
  @driver.logout(@token)
@@ -38,29 +39,31 @@ module TitlePage
38
39
  end
39
40
  end
40
41
 
41
- # retrieve information on a specified ISBN
42
+ # Retrieve information on a specified ISBN. Can be an ISBN10 or ISBN13.
43
+ #
42
44
  def find(isbn)
43
45
  return NotLoggedInError, 'You must login to titlepage API before performing a search' unless @token
44
46
  isbn = RBook::ISBN::convert_to_isbn13(isbn)
45
47
  return nil if isbn.nil?
46
48
  begin
47
- result = @driver.SearchByISBN13(@token, isbn)
49
+ results = @driver.search_by_isbn13(@token, isbn)
48
50
 
49
- if result.product.nil?
51
+ if results.size == 0
50
52
  return nil
51
53
  else
52
- return result
54
+ return results.first
53
55
  end
54
56
  end
55
57
  end
56
58
 
57
59
  # a convenience method to make single queries to title page a little cleaner.
58
60
  #
59
- # result = RBook::TitlePage.find("username","password","9780091835132")
61
+ # result = TitlePage.find("username","password","9780091835132")
60
62
  # puts result.inspect
63
+ #
61
64
  def self.find(username, password, isbn)
62
65
  result = nil
63
- RBook::TitlePage::Client.open(username, password) do |tp|
66
+ TitlePage::Client.open(username, password) do |tp|
64
67
  result = tp.find(isbn)
65
68
  end
66
69
  return result
@@ -69,7 +72,7 @@ module TitlePage
69
72
  # a convenience method to make queries to title page a little cleaner. This function
70
73
  # essentially calls the login and logout functions for you automatically.
71
74
  #
72
- # RBook::TitlePage.open("username","password") do |tp|
75
+ # TitlePage.open("username","password") do |tp|
73
76
  # result = tp.find("9780091835132")
74
77
  # end
75
78
  def self.open(username, password)
@@ -0,0 +1,84 @@
1
+ # encoding: utf-8
2
+
3
+ module TitlePage
4
+ class Driver < Handsoap::Service
5
+ endpoint TitlePage::SERVICE_ENDPOINT
6
+
7
+ # Login to the webservice. Accepts a username and password.
8
+ #
9
+ # Note that you can use the standard same username and password,
10
+ # but the account needs to have API access activated first.
11
+ #
12
+ # Returns a string token that must be passed to all other methods.
13
+ #
14
+ def login(username, password)
15
+ response = invoke("Login") do |message|
16
+ message.add "UserName", username
17
+ message.add "Password", password
18
+ end
19
+ response.document.xpath("//Token/text()").to_s
20
+ end
21
+
22
+ # logout from the webservice. The standard authentication token must be
23
+ # provided.
24
+ #
25
+ # There is no useful return value
26
+ #
27
+ def logout(token)
28
+ response = invoke("Logout") do |message|
29
+ message.add "token", token
30
+ end
31
+ true
32
+ end
33
+
34
+ # search for products by ISBN10. The standard authentication token must be
35
+ # provided along with the ISBN.
36
+ #
37
+ # Returns an array of results.
38
+ #
39
+ def search_by_isbn(token, isbn)
40
+ response = invoke("SearchByISBN") do |message|
41
+ message.add "Token", token
42
+ message.add "ISBN", isbn
43
+ end
44
+ response.document.xpath("//SearchResults/Product").collect do |node|
45
+ TitlePage::Product.from_xml(node)
46
+ end
47
+ end
48
+
49
+ # search for products by ISBN13. The standard authentication token must be
50
+ # provided along with the ISBN.
51
+ #
52
+ # Returns an array of results.
53
+ #
54
+ def search_by_isbn13(token, isbn)
55
+ response = invoke("SearchByISBN13") do |message|
56
+ message.add "Token", token
57
+ message.add "ISBN13", isbn
58
+ end
59
+ response.document.xpath("//SearchResults/Product").collect do |node|
60
+ TitlePage::Product.from_xml(node)
61
+ end
62
+ end
63
+
64
+ # search for products by EAN. The standard authentication token must be
65
+ # provided along with the ISBN.
66
+ #
67
+ # Returns an array of results.
68
+ #
69
+ # Note that although in theory EAN and ISBN13 are the same, many suppliers
70
+ # don't include an explicit EAN in the ONIX files they provide Titlepage,
71
+ # so it is nearly always preferable to search by ISBN13.
72
+ #
73
+ def search_by_ean(token, ean)
74
+ response = invoke("SearchByEAN") do |message|
75
+ message.add "Token", token
76
+ message.add "EAN", ean
77
+ end
78
+ response.document.xpath("//SearchResults/Product").collect do |node|
79
+ TitlePage::Product.from_xml(node)
80
+ end
81
+ end
82
+
83
+ end
84
+ end
@@ -0,0 +1,273 @@
1
+ # encoding: utf-8
2
+
3
+ #
4
+ # A set of classes to hold results from the API.
5
+ # Based on the classes generated by soap4r, with attributes
6
+ # changed to use ruby conventions
7
+ #
8
+
9
+ module TitlePage
10
+
11
+ class Response
12
+
13
+ private
14
+
15
+ # ensure all specified attributes are encoded as UTF-8. At this stage the
16
+ # Titlepage API is encoded in ISO-8859-1, but this *should* continue to
17
+ # work if they change that.
18
+ #
19
+ def normalise_attrib_encodings!(current_enc, attributes)
20
+ return if current_enc.downcase == "utf-8"
21
+
22
+ if RUBY_VERSION < "1.9"
23
+ attributes.each do |attrib|
24
+ if self.__send__(attrib)
25
+ new_val = Iconv.conv("utf-8",current_enc, self.__send__(attrib))
26
+ self.__send__("#{attrib}=", new_val)
27
+ end
28
+ end
29
+ else
30
+ current_enc = Encoding.find(current_enc)
31
+ attributes.each do |attrib|
32
+ if self.__send__(attrib)
33
+ self.__send__(attrib).force_encoding(current_enc)
34
+ self.__send__(attrib).encode!("utf-8")
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ class ProductIdentifier < TitlePage::Response
42
+ attr_accessor :product_id_type
43
+ attr_accessor :id_value
44
+
45
+ # convert a nokogiri node to a TitlePage::ProductIdentifier object
46
+ #
47
+ def self.from_xml(node)
48
+ return nil if node.nil?
49
+ #<ProductIdentifiers xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:ProductIdentifier[1]">
50
+ # <item xsi:type="tns:ProductIdentifier">
51
+ # <ProductIDType xsi:type="xsd:string">15</ProductIDType>
52
+ # <IDValue xsi:type="xsd:string">9780091835132</IDValue>
53
+ # </item>
54
+ #</ProductIdentifiers>
55
+ id = self.new
56
+ id.product_id_type = node.xpath("//item/ProductIDType/text()").to_s
57
+ id.id_value = node.xpath("//item/IDValue/text()").to_s
58
+ id.normalise_encodings!(node.document.encoding)
59
+ id
60
+ end
61
+
62
+ # ensure all string attributes are UTF-8 encoded
63
+ #
64
+ def normalise_encodings!(current_enc)
65
+ attribs = [:product_id_type, :id_value]
66
+ normalise_attrib_encodings!(current_enc, attribs)
67
+ end
68
+ end
69
+
70
+ class Title < TitlePage::Response
71
+ attr_accessor :title_type
72
+ attr_accessor :title_text
73
+ attr_accessor :title_prefix
74
+ attr_accessor :title_without_prefix
75
+ attr_accessor :subtitle
76
+
77
+ # convert a nokogiri node to a TitlePage::Title object
78
+ #
79
+ def self.from_xml(node)
80
+ return nil if node.nil?
81
+ #<Title xsi:type="tns:Title">
82
+ # <TitleType xsi:type="xsd:string">01</TitleType>
83
+ # <TitleText xsi:type="xsd:string">Fight Club</TitleText>
84
+ #</Title>
85
+ title = self.new
86
+ title.title_type = node.xpath("//Title/TitleType/text()").first.andand.to_s
87
+ title.title_text = node.xpath("//Title/TitleText/text()").first.andand.to_s
88
+ title.title_prefix = node.xpath("//Title/TitlePrefix/text()").first.andand.to_s
89
+ title.title_without_prefix = node.xpath("//Title/TitleWithoutPrefix/text()").first.andand.to_s
90
+ title.subtitle = node.xpath("//Title/Subtitle/text()").first.andand.to_s
91
+
92
+ # normalise encodings to utf-8
93
+ title.normalise_encodings!(node.document.encoding)
94
+ title
95
+ end
96
+
97
+ # ensure all string attributes are UTF-8 encoded
98
+ #
99
+ def normalise_encodings!(current_enc)
100
+ attribs = [:title_type, :title_text, :title_prefix, :title_without_prefix, :subtitle]
101
+ normalise_attrib_encodings!(current_enc, attribs)
102
+ end
103
+
104
+ end
105
+
106
+ class Contributor < TitlePage::Response
107
+ attr_accessor :sequence_number
108
+ attr_accessor :contributor_role
109
+ attr_accessor :person_name
110
+ attr_accessor :person_name_inverted
111
+ attr_accessor :titles_before_names
112
+ attr_accessor :key_names
113
+
114
+ # convert a nokogiri node to a TitlePage::Contributor object
115
+ #
116
+ def self.from_xml(node)
117
+ return nil if node.nil?
118
+ #<Contributors xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:Contributor[1]">
119
+ # <item xsi:type="tns:Contributor">
120
+ # <SequenceNumber xsi:type="xsd:integer">1</SequenceNumber>
121
+ # <ContributorRole xsi:type="xsd:string">A01</ContributorRole>
122
+ # <PersonNameInverted xsi:type="xsd:string">Palahniuk, Chuck</PersonNameInverted>
123
+ # </item>
124
+ #</Contributors>
125
+ contrib = self.new
126
+ contrib.sequence_number = node.xpath("//item/SequenceNumber/text()").first.andand.to_s.andand.to_i
127
+ contrib.contributor_role = node.xpath("//item/ContributorRole/text()").first.andand.to_s
128
+ contrib.person_name = node.xpath("//item/PersonName/text()").first.andand.to_s
129
+ contrib.person_name_inverted = node.xpath("//item/PersonNameInverted/text()").first.andand.to_s
130
+ contrib.titles_before_names = node.xpath("//item/TitlesBeforeNames/text()").first.andand.to_s
131
+ contrib.key_names = node.xpath("//item/KeyNames/text()").first.andand.to_s
132
+ contrib.normalise_encodings!(node.document.encoding)
133
+ contrib
134
+ end
135
+
136
+ # ensure all string attributes are UTF-8 encoded
137
+ #
138
+ def normalise_encodings!(current_enc)
139
+ attribs = [:contributor_role, :person_name, :person_name_inverted, :titles_before_names, :key_names]
140
+ normalise_attrib_encodings!(current_enc, attribs)
141
+ end
142
+
143
+ end
144
+
145
+ class Stock < TitlePage::Response
146
+ attr_accessor :on_hand
147
+ attr_accessor :on_order
148
+
149
+ # convert a nokogiri node to a TitlePage::Stock object
150
+ #
151
+ def self.from_xml(node)
152
+ return nil if node.nil?
153
+ #<Stock xsi:type="tns:Stock">
154
+ # <OnHand xsi:type="xsd:string">Out Of Stock</OnHand>
155
+ # <OnOrder xsi:type="xsd:string">Yes</OnOrder>
156
+ #</Stock>
157
+ stock = self.new
158
+ stock.on_hand = node.xpath("//Stock/OnHand/text()").first.andand.to_s
159
+ stock.on_order = node.xpath("//Stock/OnOrder/text()").first.andand.to_s
160
+ stock.normalise_encodings!(node.document.encoding)
161
+ stock
162
+ end
163
+
164
+ # ensure all string attributes are UTF-8 encoded
165
+ #
166
+ def normalise_encodings!(current_enc)
167
+ attribs = [:on_hand, :on_order]
168
+ normalise_attrib_encodings!(current_enc, attribs)
169
+ end
170
+ end
171
+
172
+ class Price < TitlePage::Response
173
+ attr_accessor :price_type_code
174
+ attr_accessor :price_amount
175
+
176
+ # convert a nokogiri node to a TitlePage::Price object
177
+ #
178
+ def self.from_xml(node)
179
+ return nil if node.nil?
180
+ #<Price xsi:type="tns:Price">
181
+ # <PriceAmount xsi:type="xsd:decimal">24.95</PriceAmount>
182
+ #</Price>
183
+ price = self.new
184
+ price.price_type_code = node.xpath("//Price/PriceTypeCode/text()").first.andand.to_s
185
+ val = node.xpath("//Price/PriceAmount/text()").first.andand.to_s
186
+ price.price_amount = BigDecimal.new(val) if val.size > 0
187
+ price.normalise_encodings!(node.document.encoding)
188
+ price
189
+ end
190
+
191
+ # ensure all string attributes are UTF-8 encoded
192
+ #
193
+ def normalise_encodings!(current_enc)
194
+ attribs = [:price_type_code]
195
+ normalise_attrib_encodings!(current_enc, attribs)
196
+ end
197
+ end
198
+
199
+ class SupplyDetail < TitlePage::Response
200
+ attr_accessor :supplier_name
201
+ attr_accessor :supplier_role
202
+ attr_accessor :product_availability
203
+ attr_accessor :expected_ship_date
204
+ attr_accessor :stock
205
+ attr_accessor :pack_quantity
206
+ attr_accessor :price
207
+
208
+ # convert a nokogiri node to a TitlePage::SupplyDetail object
209
+ #
210
+ def self.from_xml(node)
211
+ return nil if node.nil?
212
+ #<SupplyDetail xsi:type="tns:SupplyDetail">
213
+ # <SupplierName xsi:type="xsd:string">Random House Australia</SupplierName>
214
+ # <ProductAvailability xsi:type="xsd:string">20</ProductAvailability>
215
+ # <Stock xsi:type="tns:Stock">
216
+ # <OnHand xsi:type="xsd:string">Out Of Stock</OnHand>
217
+ # <OnOrder xsi:type="xsd:string">Yes</OnOrder>
218
+ # </Stock>
219
+ # <PackQuantity xsi:type="xsd:integer">28</PackQuantity>
220
+ # <Price xsi:type="tns:Price">
221
+ # <PriceAmount xsi:type="xsd:decimal">24.95</PriceAmount>
222
+ # </Price>
223
+ #</SupplyDetail>
224
+
225
+ sd = self.new
226
+ sd.supplier_name = node.xpath("//SupplyDetail/SupplierName/text()").first.andand.to_s
227
+ sd.supplier_role = node.xpath("//SupplyDetail/SupplierRole/text()").first.andand.to_s
228
+ sd.product_availability = node.xpath("//SupplyDetail/ProductAvailability/text()").first.andand.to_s
229
+ sd.expected_ship_date = node.xpath("//SupplyDetail/ExpectedShipDate/text()").first.andand.to_s
230
+ sd.stock = TitlePage::Stock.from_xml(node.xpath("//SupplyDetail/Stock").first)
231
+ sd.pack_quantity = node.xpath("//SupplyDetail/PackQuantity/text()").first.andand.to_s.andand.to_i
232
+ sd.price = TitlePage::Price.from_xml(node.xpath("//SupplyDetail/Price").first)
233
+ sd.normalise_encodings!(node.document.encoding)
234
+ sd
235
+ end
236
+
237
+ # ensure all string attributes are UTF-8 encoded
238
+ #
239
+ def normalise_encodings!(current_enc)
240
+ attribs = [:supplier_name, :supplier_role, :product_availability, :expected_ship_date]
241
+ normalise_attrib_encodings!(current_enc, attribs)
242
+ end
243
+ end
244
+
245
+ class Product
246
+ attr_accessor :product_identifiers
247
+ attr_accessor :title
248
+ attr_accessor :contributors
249
+ attr_accessor :supply_detail
250
+
251
+ def self.from_xml(node)
252
+ return nil if node.nil?
253
+
254
+ product = self.new
255
+
256
+ product.product_identifiers = node.xpath("//Product/ProductIdentifiers/item").map do |node|
257
+ TitlePage::ProductIdentifier.from_xml(node)
258
+ end
259
+
260
+ title_node = node.xpath("//Product/Title")
261
+ product.title = TitlePage::Title.from_xml(title_node)
262
+
263
+ product.contributors = node.xpath("//Product/Contributors/item").map do |node|
264
+ TitlePage::Contributor.from_xml(node)
265
+ end
266
+
267
+ sd_node = node.xpath("//Product/SupplyDetail")
268
+ product.supply_detail = TitlePage::SupplyDetail.from_xml(sd_node)
269
+
270
+ product
271
+ end
272
+ end
273
+ end
@@ -1,7 +1,4 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__) + "/../")
2
-
3
- require 'rbook/isbn'
4
- require 'net/http'
1
+ # encoding: utf-8
5
2
 
6
3
  module TitlePage
7
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: titlepage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Healy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-14 00:00:00 +11:00
12
+ date: 2009-05-27 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -23,14 +23,24 @@ dependencies:
23
23
  version: "1.0"
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
- name: soap4r
26
+ name: andand
27
27
  type: :runtime
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.3.1
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: troelskn-handsoap
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "="
32
42
  - !ruby/object:Gem::Version
33
- version: 1.5.8
43
+ version: 0.1.2
34
44
  version:
35
45
  description: This library is designed to assist with using the titlepage.com SOAP API.
36
46
  email: jimmy@deefa.com
@@ -47,10 +57,9 @@ files:
47
57
  - examples/titlepage_www.rb
48
58
  - lib/titlepage
49
59
  - lib/titlepage/client.rb
50
- - lib/titlepage/titlepage_driver.rb
51
- - lib/titlepage/titlepage_utils.rb
60
+ - lib/titlepage/driver.rb
61
+ - lib/titlepage/utils.rb
52
62
  - lib/titlepage/wwwclient.rb
53
- - lib/titlepage/mapping_registry.rb
54
63
  - lib/titlepage.rb
55
64
  - Rakefile
56
65
  - README
@@ -1,201 +0,0 @@
1
- require 'soap/mapping'
2
-
3
- module TitlePage
4
-
5
- module DefaultMappingRegistry
6
- EncodedRegistry = ::SOAP::Mapping::EncodedRegistry.new
7
- LiteralRegistry = ::SOAP::Mapping::LiteralRegistry.new
8
- NsTitleQuery = "urn:TitleQuery"
9
-
10
- EncodedRegistry.register(
11
- :class => TitlePage::ProductIdentifier,
12
- :schema_type => XSD::QName.new(NsTitleQuery, "ProductIdentifier"),
13
- :schema_element => [
14
- ["productIDType", ["SOAP::SOAPString", XSD::QName.new(nil, "ProductIDType")]],
15
- ["iDValue", ["SOAP::SOAPString", XSD::QName.new(nil, "IDValue")]]
16
- ]
17
- )
18
-
19
- EncodedRegistry.register(
20
- :class => TitlePage::Title,
21
- :schema_type => XSD::QName.new(NsTitleQuery, "Title"),
22
- :schema_element => [
23
- ["titleType", ["SOAP::SOAPString", XSD::QName.new(nil, "TitleType")]],
24
- ["titleText", ["SOAP::SOAPString", XSD::QName.new(nil, "TitleText")]],
25
- ["titlePrefix", ["SOAP::SOAPString", XSD::QName.new(nil, "TitlePrefix")]],
26
- ["titleWithoutPrefix", ["SOAP::SOAPString", XSD::QName.new(nil, "TitleWithoutPrefix")]],
27
- ["subtitle", ["SOAP::SOAPString", XSD::QName.new(nil, "Subtitle")]]
28
- ]
29
- )
30
-
31
- EncodedRegistry.register(
32
- :class => TitlePage::Contributor,
33
- :schema_type => XSD::QName.new(NsTitleQuery, "Contributor"),
34
- :schema_element => [
35
- ["sequenceNumber", ["SOAP::SOAPInteger", XSD::QName.new(nil, "SequenceNumber")]],
36
- ["contributorRole", ["SOAP::SOAPString", XSD::QName.new(nil, "ContributorRole")]],
37
- ["personName", ["SOAP::SOAPString", XSD::QName.new(nil, "PersonName")]],
38
- ["personNameInverted", ["SOAP::SOAPString", XSD::QName.new(nil, "PersonNameInverted")]],
39
- ["titlesBeforeNames", ["SOAP::SOAPString", XSD::QName.new(nil, "TitlesBeforeNames")]],
40
- ["keyNames", ["SOAP::SOAPString", XSD::QName.new(nil, "KeyNames")]]
41
- ]
42
- )
43
-
44
- EncodedRegistry.register(
45
- :class => TitlePage::Stock,
46
- :schema_type => XSD::QName.new(NsTitleQuery, "Stock"),
47
- :schema_element => [
48
- ["onHand", ["SOAP::SOAPString", XSD::QName.new(nil, "OnHand")]],
49
- ["onOrder", ["SOAP::SOAPString", XSD::QName.new(nil, "OnOrder")]]
50
- ]
51
- )
52
-
53
- EncodedRegistry.register(
54
- :class => TitlePage::Price,
55
- :schema_type => XSD::QName.new(NsTitleQuery, "Price"),
56
- :schema_element => [
57
- ["priceTypeCode", ["SOAP::SOAPString", XSD::QName.new(nil, "PriceTypeCode")]],
58
- ["priceAmount", ["SOAP::SOAPDecimal", XSD::QName.new(nil, "PriceAmount")]]
59
- ]
60
- )
61
-
62
- EncodedRegistry.register(
63
- :class => TitlePage::SupplyDetail,
64
- :schema_type => XSD::QName.new(NsTitleQuery, "SupplyDetail"),
65
- :schema_element => [
66
- ["supplierName", ["SOAP::SOAPString", XSD::QName.new(nil, "SupplierName")]],
67
- ["supplierRole", ["SOAP::SOAPString", XSD::QName.new(nil, "SupplierRole")]],
68
- ["productAvailability", ["SOAP::SOAPString", XSD::QName.new(nil, "ProductAvailability")]],
69
- ["expectedShipDate", ["SOAP::SOAPString", XSD::QName.new(nil, "ExpectedShipDate")]],
70
- ["stock", ["TitlePage::Stock", XSD::QName.new(nil, "Stock")]],
71
- ["packQuantity", ["SOAP::SOAPInteger", XSD::QName.new(nil, "PackQuantity")]],
72
- ["price", ["TitlePage::Price", XSD::QName.new(nil, "Price")]]
73
- ]
74
- )
75
-
76
- EncodedRegistry.set(
77
- TitlePage::ArrayOfContributor,
78
- ::SOAP::SOAPArray,
79
- ::SOAP::Mapping::EncodedRegistry::TypedArrayFactory,
80
- { :type => XSD::QName.new(NsTitleQuery, "Contributor") }
81
- )
82
-
83
- EncodedRegistry.set(
84
- TitlePage::ArrayOfProductIdentifier,
85
- ::SOAP::SOAPArray,
86
- ::SOAP::Mapping::EncodedRegistry::TypedArrayFactory,
87
- { :type => XSD::QName.new(NsTitleQuery, "ProductIdentifier") }
88
- )
89
-
90
- EncodedRegistry.register(
91
- :class => TitlePage::Product,
92
- :schema_type => XSD::QName.new(NsTitleQuery, "Product"),
93
- :schema_element => [
94
- ["productIdentifiers", ["TitlePage::ArrayOfProductIdentifier", XSD::QName.new(nil, "ProductIdentifiers")]],
95
- ["title", ["TitlePage::Title", XSD::QName.new(nil, "Title")]],
96
- ["contributors", ["TitlePage::ArrayOfContributor", XSD::QName.new(nil, "Contributors")]],
97
- ["supplyDetail", ["TitlePage::SupplyDetail", XSD::QName.new(nil, "SupplyDetail")]]
98
- ]
99
- )
100
-
101
- EncodedRegistry.register(
102
- :class => TitlePage::SearchResults,
103
- :schema_type => XSD::QName.new(NsTitleQuery, "SearchResults"),
104
- :schema_element => [
105
- ["iSBN", ["SOAP::SOAPString", XSD::QName.new(nil, "ISBN")]],
106
- ["eAN", ["SOAP::SOAPString", XSD::QName.new(nil, "EAN")]],
107
- ["iSBN13", ["SOAP::SOAPString", XSD::QName.new(nil, "ISBN13")]],
108
- ["product", ["TitlePage::Product", XSD::QName.new(nil, "Product")]]
109
- ]
110
- )
111
-
112
- LiteralRegistry.register(
113
- :class => TitlePage::ProductIdentifier,
114
- :schema_type => XSD::QName.new(NsTitleQuery, "ProductIdentifier"),
115
- :schema_element => [
116
- ["productIDType", ["SOAP::SOAPString", XSD::QName.new(nil, "ProductIDType")]],
117
- ["iDValue", ["SOAP::SOAPString", XSD::QName.new(nil, "IDValue")]]
118
- ]
119
- )
120
-
121
- LiteralRegistry.register(
122
- :class => TitlePage::Title,
123
- :schema_type => XSD::QName.new(NsTitleQuery, "Title"),
124
- :schema_element => [
125
- ["titleType", ["SOAP::SOAPString", XSD::QName.new(nil, "TitleType")]],
126
- ["titleText", ["SOAP::SOAPString", XSD::QName.new(nil, "TitleText")]],
127
- ["titlePrefix", ["SOAP::SOAPString", XSD::QName.new(nil, "TitlePrefix")]],
128
- ["titleWithoutPrefix", ["SOAP::SOAPString", XSD::QName.new(nil, "TitleWithoutPrefix")]],
129
- ["subtitle", ["SOAP::SOAPString", XSD::QName.new(nil, "Subtitle")]]
130
- ]
131
- )
132
-
133
- LiteralRegistry.register(
134
- :class => TitlePage::Contributor,
135
- :schema_type => XSD::QName.new(NsTitleQuery, "Contributor"),
136
- :schema_element => [
137
- ["sequenceNumber", ["SOAP::SOAPInteger", XSD::QName.new(nil, "SequenceNumber")]],
138
- ["contributorRole", ["SOAP::SOAPString", XSD::QName.new(nil, "ContributorRole")]],
139
- ["personName", ["SOAP::SOAPString", XSD::QName.new(nil, "PersonName")]],
140
- ["personNameInverted", ["SOAP::SOAPString", XSD::QName.new(nil, "PersonNameInverted")]],
141
- ["titlesBeforeNames", ["SOAP::SOAPString", XSD::QName.new(nil, "TitlesBeforeNames")]],
142
- ["keyNames", ["SOAP::SOAPString", XSD::QName.new(nil, "KeyNames")]]
143
- ]
144
- )
145
-
146
- LiteralRegistry.register(
147
- :class => TitlePage::Stock,
148
- :schema_type => XSD::QName.new(NsTitleQuery, "Stock"),
149
- :schema_element => [
150
- ["onHand", ["SOAP::SOAPString", XSD::QName.new(nil, "OnHand")]],
151
- ["onOrder", ["SOAP::SOAPString", XSD::QName.new(nil, "OnOrder")]]
152
- ]
153
- )
154
-
155
- LiteralRegistry.register(
156
- :class => TitlePage::Price,
157
- :schema_type => XSD::QName.new(NsTitleQuery, "Price"),
158
- :schema_element => [
159
- ["priceTypeCode", ["SOAP::SOAPString", XSD::QName.new(nil, "PriceTypeCode")]],
160
- ["priceAmount", ["SOAP::SOAPDecimal", XSD::QName.new(nil, "PriceAmount")]]
161
- ]
162
- )
163
-
164
- LiteralRegistry.register(
165
- :class => TitlePage::SupplyDetail,
166
- :schema_type => XSD::QName.new(NsTitleQuery, "SupplyDetail"),
167
- :schema_element => [
168
- ["supplierName", ["SOAP::SOAPString", XSD::QName.new(nil, "SupplierName")]],
169
- ["supplierRole", ["SOAP::SOAPString", XSD::QName.new(nil, "SupplierRole")]],
170
- ["productAvailability", ["SOAP::SOAPString", XSD::QName.new(nil, "ProductAvailability")]],
171
- ["expectedShipDate", ["SOAP::SOAPString", XSD::QName.new(nil, "ExpectedShipDate")]],
172
- ["stock", ["TitlePage::Stock", XSD::QName.new(nil, "Stock")]],
173
- ["packQuantity", ["SOAP::SOAPInteger", XSD::QName.new(nil, "PackQuantity")]],
174
- ["price", ["TitlePage::Price", XSD::QName.new(nil, "Price")]]
175
- ]
176
- )
177
-
178
- LiteralRegistry.register(
179
- :class => TitlePage::Product,
180
- :schema_type => XSD::QName.new(NsTitleQuery, "Product"),
181
- :schema_element => [
182
- ["productIdentifiers", ["TitlePage::ArrayOfProductIdentifier", XSD::QName.new(nil, "ProductIdentifiers")]],
183
- ["title", ["TitlePage::Title", XSD::QName.new(nil, "Title")]],
184
- ["contributors", ["TitlePage::ArrayOfContributor", XSD::QName.new(nil, "Contributors")]],
185
- ["supplyDetail", ["TitlePage::SupplyDetail", XSD::QName.new(nil, "SupplyDetail")]]
186
- ]
187
- )
188
-
189
- LiteralRegistry.register(
190
- :class => TitlePage::SearchResults,
191
- :schema_type => XSD::QName.new(NsTitleQuery, "SearchResults"),
192
- :schema_element => [
193
- ["iSBN", ["SOAP::SOAPString", XSD::QName.new(nil, "ISBN")]],
194
- ["eAN", ["SOAP::SOAPString", XSD::QName.new(nil, "EAN")]],
195
- ["iSBN13", ["SOAP::SOAPString", XSD::QName.new(nil, "ISBN13")]],
196
- ["product", ["TitlePage::Product", XSD::QName.new(nil, "Product")]]
197
- ]
198
- )
199
- end
200
-
201
- end
@@ -1,87 +0,0 @@
1
- require 'soap/rpc/driver'
2
-
3
- module TitlePage
4
- class TitleQueryPortType < ::SOAP::RPC::Driver
5
- DefaultEndpointUrl = "http://www.titlepage.com.au/ws/TitleQuery.php"
6
- NsWs = "http://www.titlepage.com/ws"
7
-
8
- Methods = [
9
- [ XSD::QName.new(NsWs, "Login"),
10
- "http://www.titlepage.com.au/ws/TitleQuery.php/Login",
11
- "login",
12
- [ ["in", "UserName", ["::SOAP::SOAPString"]],
13
- ["in", "Password", ["::SOAP::SOAPString"]],
14
- ["retval", "Token", ["::SOAP::SOAPString"]] ],
15
- { :request_style => :rpc, :request_use => :encoded,
16
- :response_style => :rpc, :response_use => :encoded,
17
- :faults => {} }
18
- ],
19
- [ XSD::QName.new(NsWs, "SearchByISBN"),
20
- "http://www.titlepage.com.au/ws/TitleQuery.php/SearchByISBN",
21
- "searchByISBN",
22
- [ ["in", "Token", ["::SOAP::SOAPString"]],
23
- ["in", "ISBN", ["::SOAP::SOAPString"]],
24
- ["retval", "SearchResults", ["TitlePage::SearchResults", "urn:TitleQuery", "SearchResults"]] ],
25
- { :request_style => :rpc, :request_use => :encoded,
26
- :response_style => :rpc, :response_use => :encoded,
27
- :faults => {} }
28
- ],
29
- [ XSD::QName.new(NsWs, "SearchByISBN13"),
30
- "http://www.titlepage.com.au/ws/TitleQuery.php/SearchByISBN13",
31
- "searchByISBN13",
32
- [ ["in", "Token", ["::SOAP::SOAPString"]],
33
- ["in", "ISBN13", ["::SOAP::SOAPString"]],
34
- ["retval", "SearchResults", ["TitlePage::SearchResults", "urn:TitleQuery", "SearchResults"]] ],
35
- { :request_style => :rpc, :request_use => :encoded,
36
- :response_style => :rpc, :response_use => :encoded,
37
- :faults => {} }
38
- ],
39
- [ XSD::QName.new(NsWs, "SearchByEAN"),
40
- "http://www.titlepage.com.au/ws/TitleQuery.php/SearchByEAN",
41
- "searchByEAN",
42
- [ ["in", "Token", ["::SOAP::SOAPString"]],
43
- ["in", "EAN", ["::SOAP::SOAPString"]],
44
- ["retval", "SearchResults", ["TitlePage::SearchResults", "urn:TitleQuery", "SearchResults"]] ],
45
- { :request_style => :rpc, :request_use => :encoded,
46
- :response_style => :rpc, :response_use => :encoded,
47
- :faults => {} }
48
- ],
49
- [ XSD::QName.new(NsWs, "Logout"),
50
- "http://www.titlepage.com.au/ws/TitleQuery.php/Logout",
51
- "logout",
52
- [ ["in", "token", ["::SOAP::SOAPString"]] ],
53
- { :request_style => :rpc, :request_use => :encoded,
54
- :response_style => :rpc, :response_use => :encoded,
55
- :faults => {} }
56
- ]
57
- ]
58
-
59
- def initialize(endpoint_url = nil)
60
- endpoint_url ||= DefaultEndpointUrl
61
- super(endpoint_url, nil)
62
- self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
63
- self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
64
- init_methods
65
- end
66
-
67
- private
68
-
69
- def init_methods
70
- Methods.each do |definitions|
71
- opt = definitions.last
72
- if opt[:request_style] == :document
73
- add_document_operation(*definitions)
74
- else
75
- add_rpc_operation(*definitions)
76
- qname = definitions[0]
77
- name = definitions[2]
78
- if qname.name != name and qname.name.capitalize == name.capitalize
79
- ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
80
- __send__(name, *arg)
81
- end
82
- end
83
- end
84
- end
85
- end
86
- end
87
- end
@@ -1,299 +0,0 @@
1
- require 'xsd/qname'
2
-
3
- module TitlePage
4
-
5
- # {urn:TitleQuery}ProductIdentifier
6
- # productIDType - SOAP::SOAPString
7
- # iDValue - SOAP::SOAPString
8
- class ProductIdentifier
9
- attr_accessor :productIDType
10
- attr_accessor :iDValue
11
-
12
- def initialize(productIDType = nil, iDValue = nil)
13
- @productIDType = productIDType
14
- @iDValue = iDValue
15
- end
16
-
17
- # An older version of soap4r that was used to generate boilerplate code
18
- # in versions of this gem <= 0.9.3 created methods that started with
19
- # capitals. Detect when some code calls these old method names and
20
- # print a deprecation warning.
21
- def method_missing(method, *arguments)
22
- new_method = method.to_s[0,1].downcase
23
- new_method << method.to_s[1,20]
24
-
25
- if self.respond_to?(new_method)
26
- $stderr.puts "Warning: #{method} is deprecated. Use #{new_method} instead"
27
- self.send(new_method, *arguments)
28
- else
29
- super
30
- end
31
- end
32
- end
33
-
34
- # {urn:TitleQuery}Title
35
- # titleType - SOAP::SOAPString
36
- # titleText - SOAP::SOAPString
37
- # titlePrefix - SOAP::SOAPString
38
- # titleWithoutPrefix - SOAP::SOAPString
39
- # subtitle - SOAP::SOAPString
40
- class Title
41
- attr_accessor :titleType
42
- attr_accessor :titleText
43
- attr_accessor :titlePrefix
44
- attr_accessor :titleWithoutPrefix
45
- attr_accessor :subtitle
46
-
47
- def initialize(titleType = nil, titleText = nil, titlePrefix = nil, titleWithoutPrefix = nil, subtitle = nil)
48
- @titleType = titleType
49
- @titleText = titleText
50
- @titlePrefix = titlePrefix
51
- @titleWithoutPrefix = titleWithoutPrefix
52
- @subtitle = subtitle
53
- end
54
-
55
- # An older version of soap4r that was used to generate boilerplate code
56
- # in versions of this gem <= 0.9.3 created methods that started with
57
- # capitals. Detect when some code calls these old method names and
58
- # print a deprecation warning.
59
- def method_missing(method, *arguments)
60
- new_method = method.to_s[0,1].downcase
61
- new_method << method.to_s[1,20]
62
-
63
- if self.respond_to?(new_method)
64
- $stderr.puts "Warning: #{method} is deprecated. Use #{new_method} instead"
65
- self.send(new_method, *arguments)
66
- else
67
- super
68
- end
69
- end
70
- end
71
-
72
- # {urn:TitleQuery}Contributor
73
- # sequenceNumber - SOAP::SOAPInteger
74
- # contributorRole - SOAP::SOAPString
75
- # personName - SOAP::SOAPString
76
- # personNameInverted - SOAP::SOAPString
77
- # titlesBeforeNames - SOAP::SOAPString
78
- # keyNames - SOAP::SOAPString
79
- class Contributor
80
- attr_accessor :sequenceNumber
81
- attr_accessor :contributorRole
82
- attr_accessor :personName
83
- attr_accessor :personNameInverted
84
- attr_accessor :titlesBeforeNames
85
- attr_accessor :keyNames
86
-
87
- def initialize(sequenceNumber = nil, contributorRole = nil, personName = nil, personNameInverted = nil, titlesBeforeNames = nil, keyNames = nil)
88
- @sequenceNumber = sequenceNumber
89
- @contributorRole = contributorRole
90
- @personName = personName
91
- @personNameInverted = personNameInverted
92
- @titlesBeforeNames = titlesBeforeNames
93
- @keyNames = keyNames
94
- end
95
-
96
- # An older version of soap4r that was used to generate boilerplate code
97
- # in versions of this gem <= 0.9.3 created methods that started with
98
- # capitals. Detect when some code calls these old method names and
99
- # print a deprecation warning.
100
- def method_missing(method, *arguments)
101
- new_method = method.to_s[0,1].downcase
102
- new_method << method.to_s[1,20]
103
-
104
- if self.respond_to?(new_method)
105
- $stderr.puts "Warning: #{method} is deprecated. Use #{new_method} instead"
106
- self.send(new_method, *arguments)
107
- else
108
- super
109
- end
110
- end
111
- end
112
-
113
- # {urn:TitleQuery}Stock
114
- # onHand - SOAP::SOAPString
115
- # onOrder - SOAP::SOAPString
116
- class Stock
117
- attr_accessor :onHand
118
- attr_accessor :onOrder
119
-
120
- def initialize(onHand = nil, onOrder = nil)
121
- @onHand = onHand
122
- @onOrder = onOrder
123
- end
124
-
125
- # An older version of soap4r that was used to generate boilerplate code
126
- # in versions of this gem <= 0.9.3 created methods that started with
127
- # capitals. Detect when some code calls these old method names and
128
- # print a deprecation warning.
129
- def method_missing(method, *arguments)
130
- new_method = method.to_s[0,1].downcase
131
- new_method << method.to_s[1,20]
132
-
133
- if self.respond_to?(new_method)
134
- $stderr.puts "Warning: #{method} is deprecated. Use #{new_method} instead"
135
- self.send(new_method, *arguments)
136
- else
137
- super
138
- end
139
- end
140
- end
141
-
142
- # {urn:TitleQuery}Price
143
- # priceTypeCode - SOAP::SOAPString
144
- # priceAmount - SOAP::SOAPDecimal
145
- class Price
146
- attr_accessor :priceTypeCode
147
- attr_accessor :priceAmount
148
-
149
- def initialize(priceTypeCode = nil, priceAmount = nil)
150
- @priceTypeCode = priceTypeCode
151
- @priceAmount = priceAmount
152
- end
153
-
154
- # An older version of soap4r that was used to generate boilerplate code
155
- # in versions of this gem <= 0.9.3 created methods that started with
156
- # capitals. Detect when some code calls these old method names and
157
- # print a deprecation warning.
158
- def method_missing(method, *arguments)
159
- new_method = method.to_s[0,1].downcase
160
- new_method << method.to_s[1,20]
161
-
162
- if self.respond_to?(new_method)
163
- $stderr.puts "Warning: #{method} is deprecated. Use #{new_method} instead"
164
- self.send(new_method, *arguments)
165
- else
166
- super
167
- end
168
- end
169
- end
170
-
171
- # {urn:TitleQuery}SupplyDetail
172
- # supplierName - SOAP::SOAPString
173
- # supplierRole - SOAP::SOAPString
174
- # productAvailability - SOAP::SOAPString
175
- # expectedShipDate - SOAP::SOAPString
176
- # stock - TitlePage::Stock
177
- # packQuantity - SOAP::SOAPInteger
178
- # price - TitlePage::Price
179
- class SupplyDetail
180
- attr_accessor :supplierName
181
- attr_accessor :supplierRole
182
- attr_accessor :productAvailability
183
- attr_accessor :expectedShipDate
184
- attr_accessor :stock
185
- attr_accessor :packQuantity
186
- attr_accessor :price
187
-
188
- def initialize(supplierName = nil, supplierRole = nil, productAvailability = nil, expectedShipDate = nil, stock = nil, packQuantity = nil, price = nil)
189
- @supplierName = supplierName
190
- @supplierRole = supplierRole
191
- @productAvailability = productAvailability
192
- @expectedShipDate = expectedShipDate
193
- @stock = stock
194
- @packQuantity = packQuantity
195
- @price = price
196
- end
197
-
198
- # An older version of soap4r that was used to generate boilerplate code
199
- # in versions of this gem <= 0.9.3 created methods that started with
200
- # capitals. Detect when some code calls these old method names and
201
- # print a deprecation warning.
202
- def method_missing(method, *arguments)
203
- new_method = method.to_s[0,1].downcase
204
- new_method << method.to_s[1,20]
205
-
206
- if self.respond_to?(new_method)
207
- $stderr.puts "Warning: #{method} is deprecated. Use #{new_method} instead"
208
- self.send(new_method, *arguments)
209
- else
210
- super
211
- end
212
- end
213
- end
214
-
215
- # {urn:TitleQuery}Product
216
- # productIdentifiers - TitlePage::ArrayOfProductIdentifier
217
- # title - TitlePage::Title
218
- # contributors - TitlePage::ArrayOfContributor
219
- # supplyDetail - TitlePage::SupplyDetail
220
- class Product
221
- attr_accessor :productIdentifiers
222
- attr_accessor :title
223
- attr_accessor :contributors
224
- attr_accessor :supplyDetail
225
-
226
- def initialize(productIdentifiers = nil, title = nil, contributors = nil, supplyDetail = nil)
227
- @productIdentifiers = productIdentifiers
228
- @title = title
229
- @contributors = contributors
230
- @supplyDetail = supplyDetail
231
- end
232
-
233
- # An older version of soap4r that was used to generate boilerplate code
234
- # in versions of this gem <= 0.9.3 created methods that started with
235
- # capitals. Detect when some code calls these old method names and
236
- # print a deprecation warning.
237
- def method_missing(method, *arguments)
238
- new_method = method.to_s[0,1].downcase
239
- new_method << method.to_s[1,20]
240
-
241
- if self.respond_to?(new_method)
242
- $stderr.puts "Warning: #{method} is deprecated. Use #{new_method} instead"
243
- self.send(new_method, *arguments)
244
- else
245
- super
246
- end
247
- end
248
- end
249
-
250
- # {urn:TitleQuery}SearchResults
251
- # iSBN - SOAP::SOAPString
252
- # eAN - SOAP::SOAPString
253
- # iSBN13 - SOAP::SOAPString
254
- # product - TitlePage::Product
255
- class SearchResults
256
- attr_accessor :iSBN
257
- attr_accessor :eAN
258
- attr_accessor :iSBN13
259
- attr_accessor :product
260
-
261
- def initialize(iSBN = nil, eAN = nil, iSBN13 = nil, product = nil)
262
- @iSBN = iSBN
263
- @eAN = eAN
264
- @iSBN13 = iSBN13
265
- @product = product
266
- end
267
-
268
- # convenience method
269
- #
270
- def Product
271
- @product
272
- end
273
-
274
- # An older version of soap4r that was used to generate boilerplate code
275
- # in versions of this gem <= 0.9.3 created methods that started with
276
- # capitals. Detect when some code calls these old method names and
277
- # print a deprecation warning.
278
- def method_missing(method, *arguments)
279
- new_method = method.to_s[0,1].downcase
280
- new_method << method.to_s[1,20]
281
-
282
- if self.respond_to?(new_method)
283
- $stderr.puts "Warning: #{method} is deprecated. Use #{new_method} instead"
284
- self.send(new_method, *arguments)
285
- else
286
- super
287
- end
288
- end
289
- end
290
-
291
- # {urn:TitleQuery}ArrayOfContributor
292
- class ArrayOfContributor < ::Array
293
- end
294
-
295
- # {urn:TitleQuery}ArrayOfProductIdentifier
296
- class ArrayOfProductIdentifier < ::Array
297
- end
298
-
299
- end