quickbooks 0.0.1

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.
Files changed (47) hide show
  1. data/LICENSE +16 -0
  2. data/README +46 -0
  3. data/Rakefile +92 -0
  4. data/doc/classes/QuickBooks.html +148 -0
  5. data/doc/classes/QuickBooks/Models.html +121 -0
  6. data/doc/classes/QuickBooks/Models/Address.html +159 -0
  7. data/doc/classes/QuickBooks/Models/Base.html +152 -0
  8. data/doc/classes/QuickBooks/Models/Base.src/M000009.html +18 -0
  9. data/doc/classes/QuickBooks/Models/Base.src/M000010.html +17 -0
  10. data/doc/classes/QuickBooks/Models/CreditCardInfo.html +149 -0
  11. data/doc/classes/QuickBooks/Models/Customer.html +409 -0
  12. data/doc/classes/QuickBooks/Models/Customer.src/M000001.html +34 -0
  13. data/doc/classes/QuickBooks/Models/Customer.src/M000002.html +17 -0
  14. data/doc/classes/QuickBooks/Models/DataExt.html +141 -0
  15. data/doc/classes/QuickBooks/Models/ListItem.html +174 -0
  16. data/doc/classes/QuickBooks/Models/ListItem.src/M000007.html +17 -0
  17. data/doc/classes/QuickBooks/Models/ListItem.src/M000008.html +17 -0
  18. data/doc/classes/QuickBooks/Models/Transaction.html +202 -0
  19. data/doc/classes/QuickBooks/Models/Transaction.src/M000003.html +17 -0
  20. data/doc/classes/QuickBooks/Models/Transaction.src/M000004.html +17 -0
  21. data/doc/classes/QuickBooks/Models/Transaction.src/M000005.html +17 -0
  22. data/doc/classes/QuickBooks/Models/Transaction.src/M000006.html +17 -0
  23. data/doc/classes/QuickBooks/Session.html +279 -0
  24. data/doc/classes/QuickBooks/Session.src/M000011.html +25 -0
  25. data/doc/classes/QuickBooks/Session.src/M000012.html +21 -0
  26. data/doc/classes/QuickBooks/Session.src/M000013.html +20 -0
  27. data/doc/classes/QuickBooks/Session.src/M000014.html +18 -0
  28. data/doc/classes/QuickBooks/Session.src/M000015.html +22 -0
  29. data/doc/created.rid +1 -0
  30. data/doc/files/LICENSE.html +129 -0
  31. data/doc/files/README.html +168 -0
  32. data/doc/files/lib/quickbooks/models/base_rb.html +129 -0
  33. data/doc/files/lib/quickbooks/models/customer_rb.html +136 -0
  34. data/doc/files/lib/quickbooks/session_rb.html +109 -0
  35. data/doc/files/lib/quickbooks_rb.html +138 -0
  36. data/doc/fr_class_index.html +36 -0
  37. data/doc/fr_file_index.html +32 -0
  38. data/doc/fr_method_index.html +41 -0
  39. data/doc/index.html +24 -0
  40. data/doc/rdoc-style.css +208 -0
  41. data/lib/quickbooks.rb +40 -0
  42. data/lib/quickbooks/models/base.rb +71 -0
  43. data/lib/quickbooks/models/customer.rb +56 -0
  44. data/lib/quickbooks/session.rb +90 -0
  45. data/test/quickbooks/quickbooks_test.rb +27 -0
  46. data/test/test_helper.rb +4 -0
  47. metadata +105 -0
data/lib/quickbooks.rb ADDED
@@ -0,0 +1,40 @@
1
+ #--
2
+ # Copyright (c) 2006 Chris Bruce
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5
+ # and associated documentation files (the "Software"), to deal in the Software without restriction,
6
+ # including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
7
+ # and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
8
+ # subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all copies or substantial
11
+ # portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
14
+ # LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
15
+ # NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
16
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
17
+ # OR OTHER DEALINGS IN THE SOFTWARE.
18
+ #++
19
+ # QuickBooks::Session is used to communicate with QuickBooks RDS Server. You need to configure
20
+ # your QuickBooks software to allow RDS connection from application.
21
+ #
22
+ # require 'quickbooks'
23
+ #
24
+ # session = QuickBooks::Session.new('admin', 'pass', 'My Test App')
25
+ # session.open
26
+ # xml = <<END
27
+ # <?xml version="1.0"?>
28
+ # <?qbxml version="3.0"?>
29
+ # <QBXML>
30
+ # <QBXMLMsgsRq onError="continueOnError">
31
+ # <InvoiceQueryRq requestID="1">
32
+ # <RefNumber>81</RefNumber>
33
+ # <IncludeLineItems>true</IncludeLineItems>
34
+ # </InvoiceQueryRq>
35
+ # </QBXMLMsgsRq>
36
+ # </QBXML>
37
+ # <<END
38
+ # session.send(xml)
39
+ # session.close
40
+ require 'quickbooks/session'
@@ -0,0 +1,71 @@
1
+ # Copyright (c) 2006 Chris Bruce
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software
4
+ # and associated documentation files (the "Software"), to deal in the Software without restriction,
5
+ # including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
6
+ # and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
7
+ # subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial
10
+ # portions of the Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
13
+ # LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14
+ # NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
15
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
16
+ # OR OTHER DEALINGS IN THE SOFTWARE.
17
+
18
+ module QuickBooks
19
+ module Models
20
+ class Base
21
+ def add_xml
22
+ xml
23
+ end
24
+
25
+ def mod_xml
26
+ end
27
+
28
+ end
29
+
30
+ class Transaction
31
+ attr_accessor :id, :ref_number
32
+
33
+ def self.delete
34
+ end
35
+
36
+ def delete
37
+ end
38
+
39
+ def self.void
40
+ end
41
+
42
+ def void
43
+ end
44
+
45
+ end
46
+
47
+ class ListItem < Base
48
+ attr_accessor :id, :full_name
49
+
50
+ def self.delete(id)
51
+ end
52
+
53
+ def delete
54
+ end
55
+ end
56
+
57
+ class DataExt < Base
58
+ attr_accessor :owner_id, :data_ext_name, :data_ext_type, :data_ext_value
59
+ end
60
+
61
+ class CreditCardInfo
62
+ attr_accessor :credit_card_number, :expiration_month, :expiration_year, :name_on_card, :credit_card_address, :credit_card_postal_code
63
+ end
64
+
65
+ class Address
66
+ attr_accessor :addr1, :addr2, :addr3, :addr4, :city, :state, :postal_code, :country
67
+ end
68
+
69
+
70
+ end
71
+ end
@@ -0,0 +1,56 @@
1
+ # Copyright (c) 2006 Chris Bruce
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software
4
+ # and associated documentation files (the "Software"), to deal in the Software without restriction,
5
+ # including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
6
+ # and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
7
+ # subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial
10
+ # portions of the Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
13
+ # LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14
+ # NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
15
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
16
+ # OR OTHER DEALINGS IN THE SOFTWARE.
17
+
18
+ require 'base'
19
+ module QuickBooks
20
+ module Models
21
+ class Customer < ListItem
22
+ attr_accessor(:time_created, :time_modified, :edit_sequence, :name, :is_active, :parent_ref, :sublevel,
23
+ :company_name, :salutation, :first_name, :middle_name, :last_name, :suffix, :bill_address, :ship_address,
24
+ :print_as, :phone, :mobile, :pager, :alt_phone, :fax, :email, :contact, :alt_contact, :customer_type_ref,
25
+ :terms_ref, :sales_rep_ref, :open_balance, :open_balance_date, :balance, :total_balance, :sales_tax_code_ref,
26
+ :item_sales_tax_ref, :resale_nmber, :account_number, :credit_limit, :preferred_payment_method_ref,
27
+ :credit_card_info, :job_status, :job_start_date, :job_projected_end_date, :job_end_date, :job_desc,
28
+ :job_type_ref, :notes, :is_statement_with_parent, :delivery_method, :price_level_ref, :data_ext_ref)
29
+
30
+ def initialize(attributes={})
31
+ @new_record = true
32
+
33
+ @parent_ref = new ListItem
34
+ @bill_address = new Address
35
+ @terms_ref = new ListItem
36
+ @sales_rep_ref = new ListItem
37
+ @sales_tax_code_ref = new ListItem
38
+ @item_sales_tax_ref = new ListItem
39
+ @preferred_payment_method_ref = new ListItem
40
+ @job_type_ref = new ListItem
41
+ @price_live_ref = new ListItem
42
+ @data_ext_ref = new ListItem
43
+
44
+ @ship_address = new Address
45
+ @customer_type_ref = new ListItem
46
+
47
+ @credit_card_info = new CreditCardInfo
48
+ end
49
+
50
+ def new_record?
51
+ end
52
+
53
+
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,90 @@
1
+ #--
2
+ # Copyright (c) 2006 Chris Bruce
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5
+ # and associated documentation files (the "Software"), to deal in the Software without restriction,
6
+ # including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
7
+ # and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
8
+ # subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all copies or substantial
11
+ # portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
14
+ # LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
15
+ # NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
16
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
17
+ # OR OTHER DEALINGS IN THE SOFTWARE.
18
+ #++
19
+
20
+ module QuickBooks
21
+ # Session used to communicate with QuickBooks RDS Server. You need to configure
22
+ # your QuickBooks software to allow RDS connection from application.
23
+ # <code>
24
+ # require 'quickbooks'
25
+ #
26
+ # session = QuickBooks::Session.new('admin', 'pass', 'My Test App')
27
+ # session.open
28
+ # xml = <<END
29
+ # <?xml version="1.0"?>
30
+ # <?qbxml version="3.0"?>
31
+ # <QBXML>
32
+ # <QBXMLMsgsRq onError="continueOnError">
33
+ # <InvoiceQueryRq requestID="1">
34
+ # <RefNumber>81</RefNumber>
35
+ # <IncludeLineItems>true</IncludeLineItems>
36
+ # </InvoiceQueryRq>
37
+ # </QBXMLMsgsRq>
38
+ # </QBXML>
39
+ # <<END
40
+ # session.send(xml)
41
+ # session.close
42
+ class Session
43
+ require 'cgi'
44
+ require 'soap/wsdlDriver'
45
+
46
+ attr_accessor :user, :password, :application_name, :host, :port
47
+
48
+ # Initializes an instance of QuickBooks::Session
49
+ def initialize(user, password, application_name, host="localhost", port=3790, mode='multiUser')
50
+ @user = user
51
+ @password = password
52
+ @application_name = application_name
53
+ @host = host
54
+ @port = port
55
+ @mode = mode
56
+ @ticket = nil
57
+ @soap_client = nil
58
+ end
59
+
60
+ # Determines if the Session is connected to a QuickBooks RDS Server
61
+ def connected?
62
+ if @ticket && @soap_client
63
+ return true
64
+ end
65
+ return false
66
+ end
67
+
68
+ # Opens a connection to a QuickBooks RDS Server
69
+ def open
70
+ @soap_client = SOAP::WSDLDriverFactory.new("https://#{@host}:#{@port}/QBXMLRemote?wsdl").create_rpc_driver
71
+ @ticket = @soap_client.OpenConnectionAndBeginSession(@user, @password, '', @application_name, '', @mode)
72
+ return @ticket
73
+ end
74
+
75
+ # Send a QBXML message to QuickBooks RDS Server
76
+ def send(xml)
77
+ @soap_client.ProcessRequest(@ticket, xml)
78
+ end
79
+
80
+ # Close the session to QuickBooks RDS Server
81
+ def close
82
+ if connected? && @soap_client
83
+ @soap_client.CloseConnection(@ticket)
84
+ @soap_client = nil
85
+ @ticket = nil
86
+ end
87
+ end
88
+
89
+ end
90
+ end
@@ -0,0 +1,27 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class QuickBooksTest < Test::Unit::TestCase
4
+ def setup
5
+ end
6
+
7
+ def test_connection
8
+ session = QuickBooks::Session.new('admin', 'pass123', 'My Test App')
9
+ session.open
10
+ xml = <<EOL
11
+ <?xml version="1.0"?>
12
+ <?qbxml version="3.0"?>
13
+ <QBXML>
14
+ <QBXMLMsgsRq onError="continueOnError">
15
+ <InvoiceQueryRq requestID="1">
16
+ <RefNumber>81</RefNumber>
17
+ <IncludeLineItems>true</IncludeLineItems>
18
+ </InvoiceQueryRq>
19
+ </QBXMLMsgsRq>
20
+ </QBXML>
21
+ EOL
22
+ res = session.send(xml)
23
+ assert_not_nil(res)
24
+ session.close
25
+ end
26
+
27
+ end
@@ -0,0 +1,4 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
2
+
3
+ require 'test/unit'
4
+ require 'quickbooks'
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11
3
+ specification_version: 1
4
+ name: quickbooks
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.1
7
+ date: 2006-09-13 00:00:00 -07:00
8
+ summary: A module to connect to QuickBooks through the QuickBooks SDK.
9
+ require_paths:
10
+ - lib
11
+ email: chrisabruce@yahoo.com
12
+ homepage: http://quickbooks.rubyforge.org
13
+ rubyforge_project:
14
+ description: A module to connect to QuickBooks and QuickBooks Merchant Services through the QuickBooks SDK.
15
+ autorequire: quickbooks
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ authors:
29
+ - Chris Bruce
30
+ files:
31
+ - lib/quickbooks
32
+ - lib/quickbooks.rb
33
+ - lib/quickbooks/models
34
+ - lib/quickbooks/session.rb
35
+ - lib/quickbooks/models/base.rb
36
+ - lib/quickbooks/models/customer.rb
37
+ - test/quickbooks
38
+ - test/test_helper.rb
39
+ - test/quickbooks/quickbooks_test.rb
40
+ - LICENSE
41
+ - Rakefile
42
+ - README
43
+ - doc/classes
44
+ - doc/created.rid
45
+ - doc/files
46
+ - doc/fr_class_index.html
47
+ - doc/fr_file_index.html
48
+ - doc/fr_method_index.html
49
+ - doc/index.html
50
+ - doc/rdoc-style.css
51
+ - doc/classes/QuickBooks
52
+ - doc/classes/QuickBooks.html
53
+ - doc/classes/QuickBooks/Models
54
+ - doc/classes/QuickBooks/Models.html
55
+ - doc/classes/QuickBooks/Session.html
56
+ - doc/classes/QuickBooks/Session.src
57
+ - doc/classes/QuickBooks/Models/Address.html
58
+ - doc/classes/QuickBooks/Models/Base.html
59
+ - doc/classes/QuickBooks/Models/Base.src
60
+ - doc/classes/QuickBooks/Models/CreditCardInfo.html
61
+ - doc/classes/QuickBooks/Models/Customer.html
62
+ - doc/classes/QuickBooks/Models/Customer.src
63
+ - doc/classes/QuickBooks/Models/DataExt.html
64
+ - doc/classes/QuickBooks/Models/ListItem.html
65
+ - doc/classes/QuickBooks/Models/ListItem.src
66
+ - doc/classes/QuickBooks/Models/Transaction.html
67
+ - doc/classes/QuickBooks/Models/Transaction.src
68
+ - doc/classes/QuickBooks/Models/Base.src/M000009.html
69
+ - doc/classes/QuickBooks/Models/Base.src/M000010.html
70
+ - doc/classes/QuickBooks/Models/Customer.src/M000001.html
71
+ - doc/classes/QuickBooks/Models/Customer.src/M000002.html
72
+ - doc/classes/QuickBooks/Models/ListItem.src/M000007.html
73
+ - doc/classes/QuickBooks/Models/ListItem.src/M000008.html
74
+ - doc/classes/QuickBooks/Models/Transaction.src/M000003.html
75
+ - doc/classes/QuickBooks/Models/Transaction.src/M000004.html
76
+ - doc/classes/QuickBooks/Models/Transaction.src/M000005.html
77
+ - doc/classes/QuickBooks/Models/Transaction.src/M000006.html
78
+ - doc/classes/QuickBooks/Session.src/M000011.html
79
+ - doc/classes/QuickBooks/Session.src/M000012.html
80
+ - doc/classes/QuickBooks/Session.src/M000013.html
81
+ - doc/classes/QuickBooks/Session.src/M000014.html
82
+ - doc/classes/QuickBooks/Session.src/M000015.html
83
+ - doc/files/lib
84
+ - doc/files/LICENSE.html
85
+ - doc/files/README.html
86
+ - doc/files/lib/quickbooks
87
+ - doc/files/lib/quickbooks_rb.html
88
+ - doc/files/lib/quickbooks/models
89
+ - doc/files/lib/quickbooks/session_rb.html
90
+ - doc/files/lib/quickbooks/models/base_rb.html
91
+ - doc/files/lib/quickbooks/models/customer_rb.html
92
+ test_files: []
93
+
94
+ rdoc_options: []
95
+
96
+ extra_rdoc_files: []
97
+
98
+ executables: []
99
+
100
+ extensions: []
101
+
102
+ requirements: []
103
+
104
+ dependencies: []
105
+