class Quickbooks::Model::ChangeDataCapture

Constants

TYPES

Attributes

xml[RW]

Public Instance Methods

all_types() click to toggle source
# File lib/quickbooks/model/change_data_capture.rb, line 12
def all_types
   data = {}
   TYPES.each do |entity|
     if xml.css(entity).first != nil
       data[entity] = all_of_type(entity)
     end
   end
   data
end
time() click to toggle source

time when refresh was requests from cdc/ endpoiint more information @here - developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/change-data-capture#using-change-data-capture

# File lib/quickbooks/model/change_data_capture.rb, line 25
def time
  attribute = xml.root.attribute('time')
  attribute.value if attribute
end

Private Instance Methods

all_of_type(entity) click to toggle source
# File lib/quickbooks/model/change_data_capture.rb, line 32
def all_of_type(entity)
  parse_block(xml.css(entity).first.parent, entity)
end
parse_block(node, entity) click to toggle source
# File lib/quickbooks/model/change_data_capture.rb, line 36
def parse_block(node, entity)
  model = "Quickbooks::Model::#{entity}".constantize
  models = []
  all_items = node.css(entity).map do |item|
    if item.attribute("status").try(:value) == "Deleted"
      Quickbooks::Model::ChangeModel.from_xml(item)
    else
      model.from_xml(item)
    end
  end
end