Class: TitlePage::SupplyDetail
- Defined in:
- lib/titlepage/utils.rb
Instance Attribute Summary collapse
-
#expected_ship_date ⇒ Object
Returns the value of attribute expected_ship_date.
-
#pack_quantity ⇒ Object
Returns the value of attribute pack_quantity.
-
#price ⇒ Object
Returns the value of attribute price.
-
#product_availability ⇒ Object
Returns the value of attribute product_availability.
-
#stock ⇒ Object
Returns the value of attribute stock.
-
#supplier_name ⇒ Object
Returns the value of attribute supplier_name.
-
#supplier_role ⇒ Object
Returns the value of attribute supplier_role.
Class Method Summary collapse
-
.from_xml(node) ⇒ Object
convert a nokogiri node to a TitlePage::SupplyDetail object.
Instance Attribute Details
#expected_ship_date ⇒ Object
Returns the value of attribute expected_ship_date.
145 146 147 |
# File 'lib/titlepage/utils.rb', line 145 def expected_ship_date @expected_ship_date end |
#pack_quantity ⇒ Object
Returns the value of attribute pack_quantity.
147 148 149 |
# File 'lib/titlepage/utils.rb', line 147 def pack_quantity @pack_quantity end |
#price ⇒ Object
Returns the value of attribute price.
148 149 150 |
# File 'lib/titlepage/utils.rb', line 148 def price @price end |
#product_availability ⇒ Object
Returns the value of attribute product_availability.
144 145 146 |
# File 'lib/titlepage/utils.rb', line 144 def product_availability @product_availability end |
#stock ⇒ Object
Returns the value of attribute stock.
146 147 148 |
# File 'lib/titlepage/utils.rb', line 146 def stock @stock end |
#supplier_name ⇒ Object
Returns the value of attribute supplier_name.
142 143 144 |
# File 'lib/titlepage/utils.rb', line 142 def supplier_name @supplier_name end |
#supplier_role ⇒ Object
Returns the value of attribute supplier_role.
143 144 145 |
# File 'lib/titlepage/utils.rb', line 143 def supplier_role @supplier_role end |
Class Method Details
.from_xml(node) ⇒ Object
convert a nokogiri node to a TitlePage::SupplyDetail object
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/titlepage/utils.rb', line 152 def self.from_xml(node) return nil if node.nil? #<SupplyDetail xsi:type="tns:SupplyDetail"> # <SupplierName xsi:type="xsd:string">Random House Australia</SupplierName> # <ProductAvailability xsi:type="xsd:string">20</ProductAvailability> # <Stock xsi:type="tns:Stock"> # <OnHand xsi:type="xsd:string">Out Of Stock</OnHand> # <OnOrder xsi:type="xsd:string">Yes</OnOrder> # </Stock> # <PackQuantity xsi:type="xsd:integer">28</PackQuantity> # <Price xsi:type="tns:Price"> # <PriceAmount xsi:type="xsd:decimal">24.95</PriceAmount> # </Price> #</SupplyDetail> sd = self.new sd.supplier_name = node.xpath("//SupplyDetail/SupplierName/text()").first.andand.to_s sd.supplier_role = node.xpath("//SupplyDetail/SupplierRole/text()").first.andand.to_s sd.product_availability = node.xpath("//SupplyDetail/ProductAvailability/text()").first.andand.to_s sd.expected_ship_date = node.xpath("//SupplyDetail/ExpectedShipDate/text()").first.andand.to_s sd.stock = TitlePage::Stock.from_xml(node.xpath("//SupplyDetail/Stock").first) sd.pack_quantity = node.xpath("//SupplyDetail/PackQuantity/text()").first.andand.to_s.andand.to_i sd.price = TitlePage::Price.from_xml(node.xpath("//SupplyDetail/Price").first) sd end |