Class: ONIX::APAProduct
- Inherits:
-
SimpleProduct
- Object
- SimpleProduct
- ONIX::APAProduct
- Defined in:
- lib/onix/apa_product.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#add_bic_subject(code) ⇒ Object
add a BIC subject code to the product.
-
#add_bisac_subject(code) ⇒ Object
add a BISAC subject code to the product.
-
#add_contributor(str, role = "A01") ⇒ Object
set a new contributor to this product str should be the contributors name inverted (Healy, James).
- #agent_name ⇒ Object
- #agent_name=(value) ⇒ Object
-
#bic_subjects ⇒ Object
return an array of BIC subjects for this title could be version 1 or version 2, most ONIX files don’t specifiy.
-
#bisac_subjects ⇒ Object
return an array of BISAC subjects for this title.
-
#contributors ⇒ Object
retrieve an array of all contributors.
-
#cover_url ⇒ Object
retrieve the url to the product cover image.
-
#cover_url=(url) ⇒ Object
set the url to the product cover image.
-
#cover_url_hq ⇒ Object
retrieve the url to the high quality product cover image.
-
#cover_url_hq=(url) ⇒ Object
set the url to the high quality product cover image.
-
#ean ⇒ Object
retrieve the current EAN.
-
#ean=(isbn) ⇒ Object
set a new EAN.
-
#height ⇒ Object
retrieve the height of the product.
-
#height=(value) ⇒ Object
set the height of the book.
-
#imprint ⇒ Object
retrieve the imprint.
-
#imprint=(str) ⇒ Object
set a new imprint.
-
#isbn10 ⇒ Object
retrieve the current ISBN 10.
-
#isbn10=(isbn) ⇒ Object
set a new ISBN 10.
-
#isbn13 ⇒ Object
retrieve the current ISBN 13.
-
#isbn13=(isbn) ⇒ Object
set a new ISBN 13.
-
#long_description ⇒ Object
retrieve the long description.
-
#long_description=(t) ⇒ Object
set the long description.
-
#main_description ⇒ Object
retrieve the main description.
-
#main_description=(t) ⇒ Object
set the main description.
- #market_country ⇒ Object
- #market_country=(value) ⇒ Object
- #market_publishing_status ⇒ Object
- #market_publishing_status=(value) ⇒ Object
- #measurement_system ⇒ Object
- #measurement_system=(value) ⇒ Object
-
#on_hand ⇒ Object
retrieve the number in stock.
-
#on_hand=(num) ⇒ Object
set a new in stock quantity.
-
#on_order ⇒ Object
retrieve the number on order.
-
#on_order=(num) ⇒ Object
set a new on order quantity.
-
#pack_quantity ⇒ Object
retrieve the supplier phone number.
-
#pack_quantity=(val) ⇒ Object
set a new supplier phone number.
-
#price ⇒ Object
just get the first price we can find, regardless of the type.
-
#product_availability ⇒ Object
retrieve the product availability code.
-
#product_availability=(num) ⇒ Object
set a new product availability.
-
#proprietary_id ⇒ Object
retrieve the proprietary ID.
-
#proprietary_id=(isbn) ⇒ Object
set a new proprietary ID.
-
#publisher ⇒ Object
retrieve the publisher.
-
#publisher=(str) ⇒ Object
set a new publisher.
-
#publisher_website ⇒ Object
retrieve the current publisher website for this particular product.
-
#publisher_website=(str) ⇒ Object
set a new publisher website for this particular product.
-
#rrp_exc_sales_tax ⇒ Object
retrieve the rrp excluding any sales tax.
-
#rrp_exc_sales_tax=(num) ⇒ Object
set the rrp excluding any sales tax.
-
#rrp_inc_sales_tax ⇒ Object
retrieve the rrp including any sales tax.
-
#rrp_inc_sales_tax=(num) ⇒ Object
set the rrp including any sales tax.
-
#sales_restriction_type ⇒ Object
retrieve the sales restriction type.
-
#sales_restriction_type=(type) ⇒ Object
set a new sales restriction type.
- #series ⇒ Object
- #series=(val) ⇒ Object
-
#short_description ⇒ Object
retrieve the short description.
-
#short_description=(t) ⇒ Object
set the short description.
-
#subtitle ⇒ Object
retrieve the current subtitle.
-
#subtitle=(str) ⇒ Object
set a new subtitle.
-
#supplier_email ⇒ Object
retrieve the supplier email address.
-
#supplier_email=(str) ⇒ Object
set a new supplier email address.
-
#supplier_fax ⇒ Object
retrieve the supplier fax number.
-
#supplier_fax=(str) ⇒ Object
set a new supplier fax number.
-
#supplier_name ⇒ Object
retrieve the supplier name.
-
#supplier_name=(str) ⇒ Object
set a new supplier name.
-
#supplier_phone ⇒ Object
retrieve the supplier phone number.
-
#supplier_phone=(str) ⇒ Object
set a new supplier phone number.
-
#supplier_website ⇒ Object
retrieve the current supplier website for this particular product.
-
#supplier_website=(str) ⇒ Object
set a new supplier website for this particular product.
-
#supply_country ⇒ Object
retrieve the supply country code.
-
#supply_country=(str) ⇒ Object
set a new supply country code.
-
#thickness ⇒ Object
retrieve the thickness of the product.
-
#thickness=(value) ⇒ Object
set the thickness of the product.
-
#thumbnail_url ⇒ Object
retrieve the url to the product thumbnail.
-
#thumbnail_url=(url) ⇒ Object
set the url to the product cover image.
-
#title ⇒ Object
retrieve the current title.
-
#title=(str) ⇒ Object
set a new title.
-
#weight ⇒ Object
retrieve the weight of the product.
-
#weight=(value) ⇒ Object
set the weight of the product.
-
#width ⇒ Object
retrieve the width of the product.
-
#width=(value) ⇒ Object
set the width of the product.
Methods inherited from SimpleProduct
from_xml, #initialize, parse, parse_file, #product, #to_xml
Constructor Details
This class inherits a constructor from ONIX::SimpleProduct
Instance Method Details
#add_bic_subject(code) ⇒ Object
add a BIC subject code to the product
167 168 169 |
# File 'lib/onix/apa_product.rb', line 167 def add_bic_subject(code) add_subject code, "12" end |
#add_bisac_subject(code) ⇒ Object
add a BISAC subject code to the product
178 179 180 |
# File 'lib/onix/apa_product.rb', line 178 def add_bisac_subject(code) add_subject code, "10" end |
#add_contributor(str, role = "A01") ⇒ Object
set a new contributor to this product str should be the contributors name inverted (Healy, James)
150 151 152 153 154 155 156 |
# File 'lib/onix/apa_product.rb', line 150 def add_contributor(str, role = "A01") contrib = ::ONIX::Contributor.new contrib.sequence_number = product.contributors.size + 1 contrib.contributor_role = role contrib.person_name_inverted = str product.contributors << contrib end |
#agent_name ⇒ Object
536 537 538 539 540 |
# File 'lib/onix/apa_product.rb', line 536 def agent_name reps = product.market_representations.first return nil if reps.nil? reps.agent_name end |
#agent_name=(value) ⇒ Object
542 543 544 545 546 547 548 549 |
# File 'lib/onix/apa_product.rb', line 542 def agent_name=(value) reps = product.market_representations.first if reps.nil? reps = ONIX::MarketRepresentation.new product.market_representations << reps end reps.agent_name = value.to_s end |
#bic_subjects ⇒ Object
return an array of BIC subjects for this title could be version 1 or version 2, most ONIX files don’t specifiy
161 162 163 164 |
# File 'lib/onix/apa_product.rb', line 161 def bic_subjects subjects = product.subjects.select { |sub| sub.subject_scheme_id.to_i == 12 } subjects.collect { |sub| sub.subject_code} end |
#bisac_subjects ⇒ Object
return an array of BISAC subjects for this title
172 173 174 175 |
# File 'lib/onix/apa_product.rb', line 172 def bisac_subjects subjects = product.subjects.select { |sub| sub.subject_scheme_id.to_i == 10 } subjects.collect { |sub| sub.subject_code} end |
#contributors ⇒ Object
retrieve an array of all contributors
144 145 146 |
# File 'lib/onix/apa_product.rb', line 144 def contributors product.contributors.collect { |contrib| contrib.person_name_inverted || contrib.person_name} end |
#cover_url ⇒ Object
retrieve the url to the product cover image
183 184 185 |
# File 'lib/onix/apa_product.rb', line 183 def cover_url media_file(4).try(:media_file_link) end |
#cover_url=(url) ⇒ Object
set the url to the product cover image
188 189 190 191 192 |
# File 'lib/onix/apa_product.rb', line 188 def cover_url=(url) # 4 - cover image # 1 - URI media_file_set(4,1,url) end |
#cover_url_hq ⇒ Object
retrieve the url to the high quality product cover image
195 196 197 |
# File 'lib/onix/apa_product.rb', line 195 def cover_url_hq media_file(6).try(:media_file_link) end |
#cover_url_hq=(url) ⇒ Object
set the url to the high quality product cover image
200 201 202 203 204 |
# File 'lib/onix/apa_product.rb', line 200 def cover_url_hq=(url) # 6 - hq cover image # 1 - URI media_file_set(6,1,url) end |
#ean ⇒ Object
retrieve the current EAN
28 29 30 |
# File 'lib/onix/apa_product.rb', line 28 def ean identifier(3).try(:id_value) end |
#ean=(isbn) ⇒ Object
set a new EAN
33 34 35 |
# File 'lib/onix/apa_product.rb', line 33 def ean=(isbn) identifier_set(3, isbn) end |
#height ⇒ Object
retrieve the height of the product
If APAProduct#measurement_system is metric, these will be in mm, otherwise they will be in inches.
449 450 451 452 |
# File 'lib/onix/apa_product.rb', line 449 def height # TODO: auto unit conversion measurement(1).try(:measurement) end |
#height=(value) ⇒ Object
set the height of the book
If APAProduct#measurement_system is metric, this should be in mm, otherwise it will be in inches.
459 460 461 462 463 464 465 |
# File 'lib/onix/apa_product.rb', line 459 def height=(value) if measurement_system == :metric measurement_set(1,value, "mm") elsif measurement_system == :imperial measurement_set(1,value, "in") end end |
#imprint ⇒ Object
retrieve the imprint
249 250 251 252 |
# File 'lib/onix/apa_product.rb', line 249 def imprint composite = product.imprints.first composite ? composite.imprint_name : nil end |
#imprint=(str) ⇒ Object
set a new imprint
255 256 257 258 259 260 261 262 |
# File 'lib/onix/apa_product.rb', line 255 def imprint=(str) composite = product.imprints.first if composite.nil? composite = ONIX::Imprint.new product.imprints << composite end composite.imprint_name = str end |
#isbn10 ⇒ Object
retrieve the current ISBN 10
48 49 50 |
# File 'lib/onix/apa_product.rb', line 48 def isbn10 identifier(2).try(:id_value) end |
#isbn10=(isbn) ⇒ Object
set a new ISBN 10
53 54 55 |
# File 'lib/onix/apa_product.rb', line 53 def isbn10=(isbn) identifier_set(2, isbn) end |
#isbn13 ⇒ Object
retrieve the current ISBN 13
58 59 60 |
# File 'lib/onix/apa_product.rb', line 58 def isbn13 identifier(15).try(:id_value) end |
#isbn13=(isbn) ⇒ Object
set a new ISBN 13
63 64 65 |
# File 'lib/onix/apa_product.rb', line 63 def isbn13=(isbn) identifier_set(15, isbn) end |
#long_description ⇒ Object
retrieve the long description
239 240 241 |
# File 'lib/onix/apa_product.rb', line 239 def long_description other_text(3).try(:text) end |
#long_description=(t) ⇒ Object
set the long description
244 245 246 |
# File 'lib/onix/apa_product.rb', line 244 def long_description=(t) other_text_set(3,t) end |
#main_description ⇒ Object
retrieve the main description
219 220 221 |
# File 'lib/onix/apa_product.rb', line 219 def main_description other_text(1).try(:text) end |
#main_description=(t) ⇒ Object
set the main description
224 225 226 |
# File 'lib/onix/apa_product.rb', line 224 def main_description=(t) other_text_set(1,t) end |
#market_country ⇒ Object
551 552 553 554 555 |
# File 'lib/onix/apa_product.rb', line 551 def market_country reps = product.market_representations.first return nil if reps.nil? reps.market_country end |
#market_country=(value) ⇒ Object
557 558 559 560 561 562 563 564 |
# File 'lib/onix/apa_product.rb', line 557 def market_country=(value) reps = product.market_representations.first if reps.nil? reps = ONIX::MarketRepresentation.new product.market_representations << reps end reps.market_country = value.to_s end |
#market_publishing_status ⇒ Object
566 567 568 569 570 |
# File 'lib/onix/apa_product.rb', line 566 def market_publishing_status reps = product.market_representations.first return nil if reps.nil? reps.market_publishing_status end |
#market_publishing_status=(value) ⇒ Object
572 573 574 575 576 577 578 579 |
# File 'lib/onix/apa_product.rb', line 572 def market_publishing_status=(value) reps = product.market_representations.first if reps.nil? reps = ONIX::MarketRepresentation.new product.market_representations << reps end reps.market_publishing_status = value.to_i end |
#measurement_system ⇒ Object
15 16 17 |
# File 'lib/onix/apa_product.rb', line 15 def measurement_system @measurement_system ||= :metric end |
#measurement_system=(value) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/onix/apa_product.rb', line 19 def measurement_system=(value) if value == :metric || value == :imperial @measurement_system = value else raise ArgumentError, "#{value} is not a recognised measurement system" end end |
#on_hand ⇒ Object
retrieve the number in stock
363 364 365 366 367 368 369 370 371 |
# File 'lib/onix/apa_product.rb', line 363 def on_hand supply = find_or_create_supply_detail composite = supply.stock.first if composite.nil? composite = ONIX::Stock.new supply.stock << composite end composite.on_hand end |
#on_hand=(num) ⇒ Object
set a new in stock quantity
374 375 376 377 378 379 380 381 382 |
# File 'lib/onix/apa_product.rb', line 374 def on_hand=(num) supply = find_or_create_supply_detail composite = supply.stock.first if composite.nil? composite = ONIX::Stock.new supply.stock << composite end composite.on_hand = num end |
#on_order ⇒ Object
retrieve the number on order
385 386 387 388 389 390 391 392 393 |
# File 'lib/onix/apa_product.rb', line 385 def on_order supply = find_or_create_supply_detail composite = supply.stock.first if composite.nil? composite = ONIX::Stock.new supply.stock << composite end composite.on_order end |
#on_order=(num) ⇒ Object
set a new on order quantity
396 397 398 399 400 401 402 403 404 |
# File 'lib/onix/apa_product.rb', line 396 def on_order=(num) supply = find_or_create_supply_detail composite = supply.stock.first if composite.nil? composite = ONIX::Stock.new supply.stock << composite end composite.on_order = num end |
#pack_quantity ⇒ Object
retrieve the supplier phone number
407 408 409 410 |
# File 'lib/onix/apa_product.rb', line 407 def pack_quantity composite = product.supply_details.first composite.nil? ? nil : composite.pack_quantity end |
#pack_quantity=(val) ⇒ Object
set a new supplier phone number
413 414 415 416 |
# File 'lib/onix/apa_product.rb', line 413 def pack_quantity=(val) composite = find_or_create_supply_detail composite.pack_quantity = val.to_i end |
#price ⇒ Object
just get the first price we can find, regardless of the type. useful as a backup for reading files from that don’t contain a type
440 441 442 |
# File 'lib/onix/apa_product.rb', line 440 def price price_get(nil).try(:price_amount) end |
#product_availability ⇒ Object
retrieve the product availability code
351 352 353 354 |
# File 'lib/onix/apa_product.rb', line 351 def product_availability composite = product.supply_details.first composite.nil? ? nil : composite.product_availability end |
#product_availability=(num) ⇒ Object
set a new product availability
357 358 359 360 |
# File 'lib/onix/apa_product.rb', line 357 def product_availability=(num) composite = find_or_create_supply_detail composite.product_availability = num end |
#proprietary_id ⇒ Object
retrieve the proprietary ID
38 39 40 |
# File 'lib/onix/apa_product.rb', line 38 def proprietary_id identifier(1).try(:id_value) end |
#proprietary_id=(isbn) ⇒ Object
set a new proprietary ID
43 44 45 |
# File 'lib/onix/apa_product.rb', line 43 def proprietary_id=(isbn) identifier_set(1, isbn) end |
#publisher ⇒ Object
retrieve the publisher
265 266 267 |
# File 'lib/onix/apa_product.rb', line 265 def publisher publisher_get(1).try(:publisher_name) end |
#publisher=(str) ⇒ Object
set a new publisher
270 271 272 |
# File 'lib/onix/apa_product.rb', line 270 def publisher=(str) publisher_set(1, str) end |
#publisher_website ⇒ Object
retrieve the current publisher website for this particular product
124 125 126 |
# File 'lib/onix/apa_product.rb', line 124 def publisher_website website(2).try(:website_link) end |
#publisher_website=(str) ⇒ Object
set a new publisher website for this particular product
129 130 131 |
# File 'lib/onix/apa_product.rb', line 129 def publisher_website=(str) website_set(2, str) end |
#rrp_exc_sales_tax ⇒ Object
retrieve the rrp excluding any sales tax
419 420 421 |
# File 'lib/onix/apa_product.rb', line 419 def rrp_exc_sales_tax price_get(1).try(:price_amount) end |
#rrp_exc_sales_tax=(num) ⇒ Object
set the rrp excluding any sales tax
424 425 426 |
# File 'lib/onix/apa_product.rb', line 424 def rrp_exc_sales_tax=(num) price_set(1, num) end |
#rrp_inc_sales_tax ⇒ Object
retrieve the rrp including any sales tax
429 430 431 |
# File 'lib/onix/apa_product.rb', line 429 def rrp_inc_sales_tax price_get(2).try(:price_amount) end |
#rrp_inc_sales_tax=(num) ⇒ Object
set the rrp including any sales tax
434 435 436 |
# File 'lib/onix/apa_product.rb', line 434 def rrp_inc_sales_tax=(num) price_set(2, num) end |
#sales_restriction_type ⇒ Object
retrieve the sales restriction type
275 276 277 278 |
# File 'lib/onix/apa_product.rb', line 275 def sales_restriction_type composite = product.sales_restrictions.first composite.nil? ? nil : composite.imprint_name end |
#sales_restriction_type=(type) ⇒ Object
set a new sales restriction type
281 282 283 284 285 286 287 288 |
# File 'lib/onix/apa_product.rb', line 281 def sales_restriction_type=(type) composite = product.sales_restrictions.first if composite.nil? composite = ONIX::SalesRestriction.new product.sales_restrictions << composite end composite.sales_restriction_type = type end |
#series ⇒ Object
109 110 111 112 |
# File 'lib/onix/apa_product.rb', line 109 def series composite = product.series.first composite.try(:title_of_series) end |
#series=(val) ⇒ Object
114 115 116 117 118 119 120 121 |
# File 'lib/onix/apa_product.rb', line 114 def series=(val) composite = product.series.first if composite.nil? composite = ONIX::Series.new product.series << composite end composite.title_of_series = val.to_s end |
#short_description ⇒ Object
retrieve the short description
229 230 231 |
# File 'lib/onix/apa_product.rb', line 229 def short_description other_text(2).try(:text) end |
#short_description=(t) ⇒ Object
set the short description
234 235 236 |
# File 'lib/onix/apa_product.rb', line 234 def short_description=(t) other_text_set(2,t) end |
#subtitle ⇒ Object
retrieve the current subtitle
89 90 91 92 93 94 95 96 |
# File 'lib/onix/apa_product.rb', line 89 def subtitle composite = product.titles.first if composite.nil? nil else composite.subtitle end end |
#subtitle=(str) ⇒ Object
set a new subtitle
99 100 101 102 103 104 105 106 107 |
# File 'lib/onix/apa_product.rb', line 99 def subtitle=(str) composite = product.titles.first if composite.nil? composite = ONIX::Title.new composite.title_type = 1 product.titles << composite end composite.subtitle = str end |
#supplier_email ⇒ Object
retrieve the supplier email address
327 328 329 330 |
# File 'lib/onix/apa_product.rb', line 327 def supplier_email composite = product.supply_details.first composite.nil? ? nil : composite.email_address end |
#supplier_email=(str) ⇒ Object
set a new supplier email address
333 334 335 336 |
# File 'lib/onix/apa_product.rb', line 333 def supplier_email=(str) composite = find_or_create_supply_detail composite.email_address = str end |
#supplier_fax ⇒ Object
retrieve the supplier fax number
315 316 317 318 |
# File 'lib/onix/apa_product.rb', line 315 def supplier_fax composite = product.supply_details.first composite.nil? ? nil : composite.fax_number end |
#supplier_fax=(str) ⇒ Object
set a new supplier fax number
321 322 323 324 |
# File 'lib/onix/apa_product.rb', line 321 def supplier_fax=(str) composite = find_or_create_supply_detail composite.fax_number = str end |
#supplier_name ⇒ Object
retrieve the supplier name
291 292 293 294 |
# File 'lib/onix/apa_product.rb', line 291 def supplier_name composite = product.supply_details.first composite.nil? ? nil : composite.supplier_name end |
#supplier_name=(str) ⇒ Object
set a new supplier name
297 298 299 300 |
# File 'lib/onix/apa_product.rb', line 297 def supplier_name=(str) composite = find_or_create_supply_detail composite.supplier_name = str end |
#supplier_phone ⇒ Object
retrieve the supplier phone number
303 304 305 306 |
# File 'lib/onix/apa_product.rb', line 303 def supplier_phone composite = product.supply_details.first composite.nil? ? nil : composite.telephone_number end |
#supplier_phone=(str) ⇒ Object
set a new supplier phone number
309 310 311 312 |
# File 'lib/onix/apa_product.rb', line 309 def supplier_phone=(str) composite = find_or_create_supply_detail composite.telephone_number = str end |
#supplier_website ⇒ Object
retrieve the current supplier website for this particular product
134 135 136 |
# File 'lib/onix/apa_product.rb', line 134 def supplier_website website(12).try(:website_link) end |
#supplier_website=(str) ⇒ Object
set a new supplier website for this particular product
139 140 141 |
# File 'lib/onix/apa_product.rb', line 139 def supplier_website=(str) website_set(12, str) end |
#supply_country ⇒ Object
retrieve the supply country code
339 340 341 342 |
# File 'lib/onix/apa_product.rb', line 339 def supply_country composite = product.supply_details.first composite.nil? ? nil : composite.supply_to_country end |
#supply_country=(str) ⇒ Object
set a new supply country code
345 346 347 348 |
# File 'lib/onix/apa_product.rb', line 345 def supply_country=(str) composite = find_or_create_supply_detail composite.supply_to_country = str end |
#thickness ⇒ Object
retrieve the thickness of the product
If APAProduct#measurement_system is metric, these will be in mm, otherwise they will be in inches.
518 519 520 521 |
# File 'lib/onix/apa_product.rb', line 518 def thickness # TODO: auto unit conversion measurement(3).try(:measurement) end |
#thickness=(value) ⇒ Object
set the thickness of the product
If APAProduct#measurement_system is metric, this should be in mm, otherwise it will be in inches.
528 529 530 531 532 533 534 |
# File 'lib/onix/apa_product.rb', line 528 def thickness=(value) if measurement_system == :metric measurement_set(3,value, "mm") elsif measurement_system == :imperial measurement_set(3,value, "in") end end |
#thumbnail_url ⇒ Object
retrieve the url to the product thumbnail
207 208 209 |
# File 'lib/onix/apa_product.rb', line 207 def thumbnail_url media_file(7).try(:media_file_link) end |
#thumbnail_url=(url) ⇒ Object
set the url to the product cover image
212 213 214 215 216 |
# File 'lib/onix/apa_product.rb', line 212 def thumbnail_url=(url) # 7 - thumbnail image # 1 - URI media_file_set(7,1,url) end |
#title ⇒ Object
retrieve the current title
68 69 70 71 72 73 74 75 |
# File 'lib/onix/apa_product.rb', line 68 def title composite = product.titles.first if composite.nil? nil else composite.title_text || composite.title_without_prefix end end |
#title=(str) ⇒ Object
set a new title
78 79 80 81 82 83 84 85 86 |
# File 'lib/onix/apa_product.rb', line 78 def title=(str) composite = product.titles.first if composite.nil? composite = ONIX::Title.new composite.title_type = 1 product.titles << composite end composite.title_text = str end |
#weight ⇒ Object
retrieve the weight of the product
If APAProduct#measurement_system is metric, these will be in grams, otherwise they will be in ounces.
495 496 497 498 |
# File 'lib/onix/apa_product.rb', line 495 def weight # TODO: auto unit conversion measurement(8).try(:measurement) end |
#weight=(value) ⇒ Object
set the weight of the product
If APAProduct#measurement_system is metric, this should be in grams, otherwise it will be in ounces.
505 506 507 508 509 510 511 |
# File 'lib/onix/apa_product.rb', line 505 def weight=(value) if measurement_system == :metric measurement_set(8,value, "gr") elsif measurement_system == :imperial measurement_set(8,value, "oz") end end |
#width ⇒ Object
retrieve the width of the product
If APAProduct#measurement_system is metric, these will be in mm, otherwise they will be in inches.
472 473 474 475 |
# File 'lib/onix/apa_product.rb', line 472 def width # TODO: auto unit conversion measurement(2).try(:measurement) end |
#width=(value) ⇒ Object
set the width of the product
If APAProduct#measurement_system is metric, this should be in mm, otherwise it will be in inches.
482 483 484 485 486 487 488 |
# File 'lib/onix/apa_product.rb', line 482 def width=(value) if measurement_system == :metric measurement_set(2,value, "mm") elsif measurement_system == :imperial measurement_set(2,value, "in") end end |