class Blinksale::Invoice
Attributes
currency[RW]
due_amount[RW]
due_on[RW]
id[RW]
issued_on[RW]
number[RW]
total_amount[RW]
Public Class Methods
from_node(node)
click to toggle source
# File lib/invoices.rb, line 7 def self.from_node(node) self.new.tap do |i| i.id = node.attributes["uri"].content[/\d+$/].to_i i.number = node.xpath('xmlns:number').first.content i.total_amount = node.attributes["total"].content.to_f i.due_amount = node.attributes["total_due"].content.to_f i.issued_on = Date.strptime(node.xpath('xmlns:date').first.content, "%Y-%m-%d") i.due_on = Date.strptime(node.xpath('xmlns:terms').first.attributes["due_date"].content, "%Y-%m-%d") i.currency = node.xpath('xmlns:currency').first.content end end