Class: FakeChargify::Customer
- Inherits:
-
Object
- Object
- FakeChargify::Customer
- Defined in:
- lib/fake_chargify/customer.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#organization ⇒ Object
Returns the value of attribute organization.
-
#reference ⇒ Object
Returns the value of attribute reference.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/fake_chargify/customer.rb', line 5 def created_at @created_at end |
#email ⇒ Object
Returns the value of attribute email.
5 6 7 |
# File 'lib/fake_chargify/customer.rb', line 5 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
5 6 7 |
# File 'lib/fake_chargify/customer.rb', line 5 def first_name @first_name end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/fake_chargify/customer.rb', line 5 def id @id end |
#last_name ⇒ Object
Returns the value of attribute last_name.
5 6 7 |
# File 'lib/fake_chargify/customer.rb', line 5 def last_name @last_name end |
#organization ⇒ Object
Returns the value of attribute organization.
5 6 7 |
# File 'lib/fake_chargify/customer.rb', line 5 def organization @organization end |
#reference ⇒ Object
Returns the value of attribute reference.
5 6 7 |
# File 'lib/fake_chargify/customer.rb', line 5 def reference @reference end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
5 6 7 |
# File 'lib/fake_chargify/customer.rb', line 5 def updated_at @updated_at end |
Class Method Details
.from_xml(xml) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fake_chargify/customer.rb', line 23 def self.from_xml(xml) customer = Customer.new doc = Nokogiri::XML.parse(xml) doc.xpath('//customer').map do |e| customer.id = e.xpath('id').text.to_i customer.first_name = e.xpath('first_name').text customer.last_name = e.xpath('last_name').text customer.email = e.xpath('email').text customer.organization = e.xpath('organization').text customer.reference = e.xpath('reference').text customer.created_at = Time.parse(e.xpath('created_at').text) customer.updated_at = Time.parse(e.xpath('updated_at').text) end customer end |
Instance Method Details
#to_xml ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fake_chargify/customer.rb', line 7 def to_xml builder = Nokogiri::XML::Builder.new do |xml| xml.customer { xml.id_ id xml.first_name first_name xml.last_name last_name xml.email email xml.organization organization xml.reference reference xml.created_at created_at xml.updated_at updated_at } end builder.to_xml end |