Class: QbwcRequests::Base
Direct Known Subclasses
Account::V07::Add, Account::V07::Query, QbwcRequests::Bill::V07::Add, QbwcRequests::Bill::V07::Query, QbwcRequests::BillPaymentCheck::V07::Query, QbwcRequests::BillPaymentCreditCard::V07::Query, CustomDetailReport::V07::Query, Customer::V07::Add, Customer::V07::Query, Estimate::V07::Add, Estimate::V07::Mod, Estimate::V07::Query, GeneralDetailReport::V07::Query, Invoice::V07::Add, Invoice::V07::Query, Item::V07::Query, ItemDiscount::V07::Add, ItemDiscount::V07::Query, ItemGroup::V07::Add, ItemGroup::V07::Query, ItemNonInventory::V07::Add, ItemNonInventory::V07::Query, ItemOtherCharge::V07::Add, ItemOtherCharge::V07::Query, ItemPayment::V07::Add, ItemPayment::V07::Query, ItemService::V07::Add, ItemService::V07::Mod, ItemService::V07::Query, ItemSubtotal::V07::Add, ItemSubtotal::V07::Query, JobReport::V07::Query, PurchaseOrder::V07::Add, PurchaseOrder::V07::Mod, PurchaseOrder::V07::Query, ShipMethod::V07::Query, SubModels::Address, SubModels::EstimateLineAdd, SubModels::EstimateLineGroupAdd, SubModels::EstimateLineGroupMod, SubModels::EstimateLineMod, SubModels::SalesAndPurchase, SubModels::SalesOrPurchase, Terms::V07::Query, Vendor::V07::Add, Vendor::V07::Mod, Vendor::V07::Query, Vendor::V13::Add, Vendor::V13::Mod, Vendor::V13::Query, VendorType::V07::Query
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from XmlActions
header, header_attributes, query
included, #ordered_fields
Constructor Details
#initialize(attributes = {}) ⇒ Base
Returns a new instance of Base.
11
12
13
14
15
16
|
# File 'lib/qbwc_requests/base.rb', line 11
def initialize(attributes = {})
@attributes = compact(attributes)
@attributes.each do |name, value|
self.instance_variable_set("@#{name}", value) if value.present?
end
end
|
Class Method Details
.qbxml(hash) ⇒ Object
18
19
20
|
# File 'lib/qbwc_requests/base.rb', line 18
def self.qbxml hash
Qbxml.new(:qb, "#{version.to_i}.0").to_qbxml(hash)
end
|
.version ⇒ Object
26
27
28
|
# File 'lib/qbwc_requests/base.rb', line 26
def self.version
self.name.split("::")[2].gsub("V","")
end
|
Instance Method Details
#class_name ⇒ Object
22
23
24
|
# File 'lib/qbwc_requests/base.rb', line 22
def class_name
self.class.underscore(self.class.name.split("::")[1].gsub("Qbxml",""))
end
|
#persisted? ⇒ Boolean
30
31
32
|
# File 'lib/qbwc_requests/base.rb', line 30
def persisted?
false
end
|
#to_xml(request_id) ⇒ Object
7
8
9
|
# File 'lib/qbwc_requests/base.rb', line 7
def to_xml request_id
self.valid? ? xml(request_id, self.class.name.demodulize) : self
end
|