Class: Quickbooks::Model::Preferences

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/quickbooks/model/preferences.rb

Constant Summary collapse

XML_COLLECTION_NODE =
"Preferences"
XML_NODE =
"Preferences"
REST_RESOURCE =
'preferences'
PREFERENCE_SECTIONS =
{
  :accounting_info      => %w(TrackDepartments DepartmentTerminology ClassTrackingPerTxnLine? ClassTrackingPerTxn? CustomerTerminology),
  :product_and_services => %w(ForSales? ForPurchase? QuantityWithPriceAndRate? QuantityOnHand?),
  :sales_forms          => %w(CustomTxnNumbers? AllowDeposit? AllowDiscount? DefaultDiscountAccount? AllowEstimates? EstimateMessage? 
                                          ETransactionEnabledStatus? ETransactionAttachPDF? ETransactionPaymentEnabled? IPNSupportEnabled? 
                                          AllowServiceDate? AllowShipping? DefaultShippingAccount? DefaultTerms DefaultCustomerMessage),
  :vendor_and_purchase  => %w(TrackingByCustomer? BillableExpenseTracking? DefaultTerms? DefaultMarkup? POCustomField),
  :time_tracking        => %w(UseServices? BillCustomers? ShowBillRateToAll WorkWeekStartDate MarkTimeEntiresBillable?),
  :tax                  => %w(UsingSalesTax?),
  :currency             => %w(MultiCurrencyEnabled? HomeCurrency),
  :report               => %w(ReportBasis)
}
EmailMessage =
create_preference_class("Subject", "Message")
EmailMessageContainer =
create_preference_class do
  %w(InvoiceMessage EstimateMessage SalesReceiptMessage StatementMessage).each do |msg|
    xml_reader msg.underscore, :from => msg, :as => EmailMessage
  end
end

Class Method Summary collapse

Methods inherited from BaseModel

#as_json, attribute_names, #attributes, attrs_with_types, #initialize, inspect, #inspect, reference_attrs, reference_setters, resource_for_collection, resource_for_singular, to_xml_big_decimal, #to_xml_inject_ns, #to_xml_ns

Methods included from Validator

#line_item_size

Methods included from Definition

included, #is_name_list_entity?, #is_transaction_entity?

Constructor Details

This class inherits a constructor from Quickbooks::Model::BaseModel

Class Method Details

.create_preference_class(*attrs, &block) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/quickbooks/model/preferences.rb', line 10

def self.create_preference_class(*attrs, &block)
  ::Class.new(BaseModel) do
    attrs.each do |a|
      xml_reader(a.underscore, :from => a.gsub("?", ""))
    end
    instance_eval(&block) if block_given?
  end
end