Class: FakeChargify::Product

Inherits:
Object
  • Object
show all
Defined in:
lib/fake_chargify/product.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#accounting_codeObject

Returns the value of attribute accounting_code.



5
6
7
# File 'lib/fake_chargify/product.rb', line 5

def accounting_code
  @accounting_code
end

#familyObject

Returns the value of attribute family.



5
6
7
# File 'lib/fake_chargify/product.rb', line 5

def family
  @family
end

#handleObject

Returns the value of attribute handle.



5
6
7
# File 'lib/fake_chargify/product.rb', line 5

def handle
  @handle
end

#intervalObject

Returns the value of attribute interval.



5
6
7
# File 'lib/fake_chargify/product.rb', line 5

def interval
  @interval
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/fake_chargify/product.rb', line 5

def name
  @name
end

#price_in_centsObject

Returns the value of attribute price_in_cents.



5
6
7
# File 'lib/fake_chargify/product.rb', line 5

def price_in_cents
  @price_in_cents
end

Instance Method Details

#to_xmlObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fake_chargify/product.rb', line 7

def to_xml
  builder = Nokogiri::XML::Builder.new do |xml|
    xml.product {
      xml.accounting_code accounting_code
      xml.handle handle
      xml.interval interval
      xml.name name
      xml.price_in_cents price_in_cents
      xml << Nokogiri.XML(family.to_xml).root.to_xml unless family.nil?
    }
  end
  builder.to_xml
end