Sha256: d5bb64bdfe48d1155791686203b2be6c10dfc6436a81cf6ee8d826a713633035

Contents?: true

Size: 750 Bytes

Versions: 2

Compression:

Stored size: 750 Bytes

Contents

module XeroGateway
  class Report

    # Adds #attributes to the cells we're grabbing, since Xero Report Cells use XML like:
    # <Cell>
    #   <Value>Interest Income (270)</Value>
    #   <Attributes>
    #     <Attribute>
    #       <Value>e9482110-7245-4a76-bfe2-14500495a076</Value>
    #       <Id>account</Id>
    #     </Attribute>
    #   </Attributes>
    # </Cell>
    #
    # We delegate to the topmost "<Value>" class and decorate with an "attributes" hash
    # for the "attribute: value" pairs
    class Cell < SimpleDelegator
      attr_reader :attributes, :value

      def initialize(value, new_attributes = {})
        @value        = value
        @attributes   = new_attributes
        super(value)
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xero_gateway-2.7.0 lib/xero_gateway/report/cell.rb
xero_gateway-2.6.0 lib/xero_gateway/report/cell.rb