quickeebooks 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/HISTORY.md +4 -0
- data/coverage/index.html +4146 -3040
- data/lib/quickeebooks.rb +3 -0
- data/lib/quickeebooks/common/addressable.rb +66 -0
- data/lib/quickeebooks/online/model/customer.rb +2 -0
- data/lib/quickeebooks/online/model/invoice.rb +0 -2
- data/lib/quickeebooks/online/model/invoice_header.rb +16 -4
- data/lib/quickeebooks/online/model/vendor.rb +2 -1
- data/lib/quickeebooks/version.rb +1 -1
- data/lib/quickeebooks/windows/model/customer.rb +1 -12
- data/lib/quickeebooks/windows/model/vendor.rb +1 -0
- data/spec/quickeebooks/online/customer_spec.rb +9 -4
- data/spec/xml/online/customer.xml +14 -2
- metadata +3 -3
- data/quickeebooks-0.1.4.gem +0 -0
data/lib/quickeebooks.rb
CHANGED
@@ -0,0 +1,66 @@
|
|
1
|
+
module Quickeebooks
|
2
|
+
module Model
|
3
|
+
module Addressable
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, InstanceMethods
|
7
|
+
base.extend ClassMethods
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
end
|
12
|
+
|
13
|
+
module InstanceMethods
|
14
|
+
def phone=(phone)
|
15
|
+
self.phones ||= []
|
16
|
+
self.phones << phone
|
17
|
+
end
|
18
|
+
|
19
|
+
def address=(address)
|
20
|
+
self.addresses ||= []
|
21
|
+
self.addresses << address
|
22
|
+
end
|
23
|
+
|
24
|
+
def billing_address
|
25
|
+
select_address("Billing")
|
26
|
+
end
|
27
|
+
|
28
|
+
def shipping_address
|
29
|
+
select_address("Shipping")
|
30
|
+
end
|
31
|
+
|
32
|
+
def primary_phone
|
33
|
+
select_phone("Primary")
|
34
|
+
end
|
35
|
+
|
36
|
+
def secondary_phone
|
37
|
+
select_phone("Secondary")
|
38
|
+
end
|
39
|
+
|
40
|
+
def mobile_phone
|
41
|
+
select_phone("Mobile")
|
42
|
+
end
|
43
|
+
|
44
|
+
def fax
|
45
|
+
select_phone("Fax")
|
46
|
+
end
|
47
|
+
|
48
|
+
def pager
|
49
|
+
select_phone("Pager")
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def select_phone(type)
|
55
|
+
phones.detect { |phone| phone.device_type == type }
|
56
|
+
end
|
57
|
+
|
58
|
+
def select_address(tag)
|
59
|
+
addresses.detect { |address| address.tag == tag }
|
60
|
+
end
|
61
|
+
|
62
|
+
end # InstanceMethods
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -23,8 +23,6 @@ module Quickeebooks
|
|
23
23
|
xml_accessor :sync_token, :from => 'SyncToken', :as => Integer
|
24
24
|
xml_accessor :meta_data, :from => 'MetaData', :as => Quickeebooks::Online::Model::MetaData
|
25
25
|
xml_accessor :header, :from => 'Header', :as => Quickeebooks::Online::Model::InvoiceHeader
|
26
|
-
xml_accessor :bill_address, :from => 'BillAddr', :as => Quickeebooks::Online::Model::Address
|
27
|
-
xml_accessor :ship_address, :from => 'ShipAddr', :as => Quickeebooks::Online::Model::Address
|
28
26
|
xml_accessor :bill_email, :from => 'BillEmail'
|
29
27
|
xml_accessor :ship_method_id, :from => 'ShipMethodId', :as => Quickeebooks::Online::Model::Id
|
30
28
|
xml_accessor :ship_method_name, :from => 'ShipMethodName'
|
@@ -11,21 +11,33 @@ module Quickeebooks
|
|
11
11
|
xml_accessor :doc_number, :from => 'DocNumber'
|
12
12
|
xml_accessor :txn_date, :from => 'TxnDate', :as => Time
|
13
13
|
xml_accessor :msg, :from => 'Msg'
|
14
|
+
xml_accessor :note, :from => 'Note'
|
15
|
+
xml_accessor :status, :from => 'Status'
|
14
16
|
xml_accessor :customer_id, :from => 'CustomerId', :as => Quickeebooks::Online::Model::Id
|
15
17
|
xml_accessor :customer_name, :from => 'CustomerName'
|
18
|
+
xml_accessor :class_id, :from => 'ClassId', :as => Quickeebooks::Online::Model::Id
|
16
19
|
xml_accessor :sales_tax_code_id, :from => 'SalesTaxCodeId', :as => Quickeebooks::Online::Model::Id
|
17
20
|
xml_accessor :sales_tax_code_name, :from => 'SalesTaxCodeName'
|
21
|
+
xml_accessor :ship_date, :from => 'ShipDate', :as => Time
|
18
22
|
xml_accessor :sub_total_amount, :from => 'SubTotalAmt', :as => Float
|
19
23
|
xml_accessor :tax_rate, :from => 'TaxRate', :as => Float
|
20
24
|
xml_accessor :tax_amount, :from => 'TaxAmt', :as => Float
|
21
|
-
xml_accessor :balance, :from => 'Balance', :as => Float
|
22
25
|
xml_accessor :total_amount, :from => 'TotalAmt', :as => Float
|
26
|
+
xml_accessor :to_be_emailed, :from => 'ToBeEmailed'
|
27
|
+
xml_accessor :to_be_printed, :from => 'ToBePrinted'
|
28
|
+
xml_accessor :sales_term_id, :from => 'SalesTermId', :as => Quickeebooks::Online::Model::Id
|
23
29
|
xml_accessor :due_date, :from => 'DueDate', :as => Time
|
30
|
+
xml_accessor :billing_address, :from => 'BillAddr', :as => Quickeebooks::Online::Model::Address
|
31
|
+
xml_accessor :shipping_address, :from => 'ShipAddr', :as => Quickeebooks::Online::Model::Address
|
24
32
|
xml_accessor :bill_email, :from => 'BillEmail'
|
33
|
+
xml_accessor :ship_method_id, :from => 'ShipMethodId', :as => Quickeebooks::Online::Model::Id
|
34
|
+
xml_accessor :ship_method_name, :from => 'ShipMethodName'
|
35
|
+
xml_accessor :balance, :from => 'Balance', :as => Float
|
25
36
|
xml_accessor :discount_amount, :from => 'DiscountAmt', :as => Float
|
26
|
-
xml_accessor :
|
27
|
-
xml_accessor :
|
28
|
-
xml_accessor :
|
37
|
+
xml_accessor :discount_rate, :from => 'DiscountRate', :as => Float
|
38
|
+
xml_accessor :discount_taxable, :from => 'DiscountTaxable'
|
39
|
+
xml_accessor :txn_id, :from => 'TxnId', :as => Quickeebooks::Online::Model::Id
|
40
|
+
|
29
41
|
end
|
30
42
|
end
|
31
43
|
end
|
data/lib/quickeebooks/version.rb
CHANGED
@@ -13,6 +13,7 @@ module Quickeebooks
|
|
13
13
|
module Model
|
14
14
|
class Customer < Quickeebooks::Windows::Model::IntuitType
|
15
15
|
include ActiveModel::Validations
|
16
|
+
include Quickeebooks::Model::Addressable
|
16
17
|
|
17
18
|
DEFAULT_TYPE_OF = 'Person'
|
18
19
|
XML_COLLECTION_NODE = 'Customers'
|
@@ -81,14 +82,6 @@ module Quickeebooks
|
|
81
82
|
active == 'true'
|
82
83
|
end
|
83
84
|
|
84
|
-
def billing_address
|
85
|
-
addresses.detect { |address| address.tag == "Billing" }
|
86
|
-
end
|
87
|
-
|
88
|
-
def shipping_address
|
89
|
-
addresses.detect { |address| address.tag == "Shipping" }
|
90
|
-
end
|
91
|
-
|
92
85
|
def valid_for_update?
|
93
86
|
if sync_token.nil?
|
94
87
|
errors.add(:sync_token, "Missing required attribute SyncToken for update")
|
@@ -112,10 +105,6 @@ module Quickeebooks
|
|
112
105
|
self.email = Quickeebooks::Windows::Model::Email.new(email_address)
|
113
106
|
end
|
114
107
|
|
115
|
-
def address=(address)
|
116
|
-
self.addresses ||= []
|
117
|
-
self.addresses << address
|
118
|
-
end
|
119
108
|
|
120
109
|
# To delete an account Intuit requires we provide Id and SyncToken fields
|
121
110
|
def valid_for_deletion?
|
@@ -5,6 +5,7 @@ module Quickeebooks
|
|
5
5
|
module Windows
|
6
6
|
module Model
|
7
7
|
class Vendor < Quickeebooks::Windows::Model::IntuitType
|
8
|
+
include Quickeebooks::Model::Addressable
|
8
9
|
|
9
10
|
xml_convention :camelcase
|
10
11
|
xml_accessor :vendor_id, :from => 'VendorId', :as => Quickeebooks::Windows::Model::VendorId
|
@@ -10,10 +10,15 @@ describe "Quickeebooks::Online::Model::Customer" do
|
|
10
10
|
customer.meta_data.create_time.year.should == create_time.year
|
11
11
|
customer.addresses.count.should == 2
|
12
12
|
|
13
|
-
customer.
|
13
|
+
customer.billing_address.line1.should == "123 Main St."
|
14
|
+
customer.shipping_address.line1.should == "123 Shipping St."
|
14
15
|
|
15
|
-
customer.phones.size.should ==
|
16
|
-
customer.
|
16
|
+
customer.phones.size.should == 5
|
17
|
+
customer.primary_phone.free_form_number.should == "(408) 555-1212"
|
18
|
+
customer.secondary_phone.free_form_number.should == "(408) 555-1213"
|
19
|
+
customer.mobile_phone.free_form_number.should == "(408) 555-1214"
|
20
|
+
customer.fax.free_form_number.should == "(408) 555-1215"
|
21
|
+
customer.pager.free_form_number.should == "(408) 555-1216"
|
17
22
|
|
18
23
|
customer.email.address.should == "johndoe@gmail.com"
|
19
24
|
|
@@ -40,4 +45,4 @@ describe "Quickeebooks::Online::Model::Customer" do
|
|
40
45
|
customer.errors.keys.include?(:sync_token).should == true
|
41
46
|
end
|
42
47
|
|
43
|
-
end
|
48
|
+
end
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<Tag>Billing</Tag>
|
18
18
|
</Address>
|
19
19
|
<Address>
|
20
|
-
<Line1>123
|
20
|
+
<Line1>123 Shipping St.</Line1>
|
21
21
|
<Line2>Suite 400</Line2>
|
22
22
|
<City>San Diego</City>
|
23
23
|
<Country>USA</Country>
|
@@ -29,9 +29,21 @@
|
|
29
29
|
<DeviceType>Primary</DeviceType>
|
30
30
|
<FreeFormNumber>(408) 555-1212</FreeFormNumber>
|
31
31
|
</Phone>
|
32
|
+
<Phone>
|
33
|
+
<DeviceType>Secondary</DeviceType>
|
34
|
+
<FreeFormNumber>(408) 555-1213</FreeFormNumber>
|
35
|
+
</Phone>
|
32
36
|
<Phone>
|
33
37
|
<DeviceType>Mobile</DeviceType>
|
34
|
-
<FreeFormNumber>(
|
38
|
+
<FreeFormNumber>(408) 555-1214</FreeFormNumber>
|
39
|
+
</Phone>
|
40
|
+
<Phone>
|
41
|
+
<DeviceType>Fax</DeviceType>
|
42
|
+
<FreeFormNumber>(408) 555-1215</FreeFormNumber>
|
43
|
+
</Phone>
|
44
|
+
<Phone>
|
45
|
+
<DeviceType>Pager</DeviceType>
|
46
|
+
<FreeFormNumber>(408) 555-1216</FreeFormNumber>
|
35
47
|
</Phone>
|
36
48
|
<WebSite>
|
37
49
|
<URI>http://blah.com</URI>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quickeebooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: roxml
|
@@ -221,6 +221,7 @@ files:
|
|
221
221
|
- Gemfile
|
222
222
|
- Gemfile.lock
|
223
223
|
- HISTORY.md
|
224
|
+
- lib/quickeebooks/common/addressable.rb
|
224
225
|
- lib/quickeebooks/common/date_time.rb
|
225
226
|
- lib/quickeebooks/common/logging.rb
|
226
227
|
- lib/quickeebooks/common/online_entity_model.rb
|
@@ -363,7 +364,6 @@ files:
|
|
363
364
|
- lib/quickeebooks/windows/service/time_activity.rb
|
364
365
|
- lib/quickeebooks.rb
|
365
366
|
- MIT-LICENSE
|
366
|
-
- quickeebooks-0.1.4.gem
|
367
367
|
- quickeebooks.gemspec
|
368
368
|
- Rakefile
|
369
369
|
- README.md
|
data/quickeebooks-0.1.4.gem
DELETED
Binary file
|