fishbowl 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/Gemfile +1 -8
  4. data/fishbowl.gemspec +4 -4
  5. data/lib/fishbowl.rb +9 -90
  6. data/lib/fishbowl/configuration.rb +9 -0
  7. data/lib/fishbowl/connection.rb +99 -0
  8. data/lib/fishbowl/errors.rb +9 -2
  9. data/lib/fishbowl/objects/account.rb +0 -26
  10. data/lib/fishbowl/objects/base_object.rb +25 -8
  11. data/lib/fishbowl/requests.rb +3 -4
  12. data/lib/fishbowl/requests/get_account_balance.rb +15 -0
  13. data/lib/fishbowl/requests/get_account_list.rb +13 -0
  14. data/lib/fishbowl/requests/get_carrier_list.rb +3 -2
  15. data/lib/fishbowl/requests/get_customer_list.rb +12 -0
  16. data/lib/fishbowl/requests/get_customer_name_list.rb +12 -0
  17. data/lib/fishbowl/requests/get_export_list.rb +12 -0
  18. data/lib/fishbowl/requests/get_import_list.rb +12 -0
  19. data/lib/fishbowl/requests/get_location_group_list.rb +12 -0
  20. data/lib/fishbowl/requests/get_location_list.rb +12 -0
  21. data/lib/fishbowl/requests/get_uom_list.rb +12 -0
  22. data/lib/fishbowl/requests/get_vendor_list.rb +12 -0
  23. data/lib/fishbowl/requests/get_vendor_name_list.rb +12 -0
  24. data/lib/fishbowl/requests/get_work_order_list.rb +12 -0
  25. data/lib/fishbowl/requests/void_sales_order.rb +18 -0
  26. data/lib/fishbowl/version.rb +1 -1
  27. data/lib/status_codes.yml +183 -0
  28. data/spec/objects/account_spec.rb +0 -41
  29. data/spec/requests/calculate_sales_order_spec.rb +48 -0
  30. data/spec/requests/close_short_sales_order_spec.rb +45 -0
  31. data/spec/requests/cycle_count_spec.rb +49 -0
  32. data/spec/requests/delete_sales_order_spec.rb +45 -0
  33. data/spec/requests/export_spec.rb +45 -0
  34. data/spec/requests/get_account_balance_spec.rb +52 -0
  35. data/spec/requests/get_account_list_spec.rb +51 -0
  36. data/spec/requests/get_customer_list_spec.rb +51 -0
  37. data/spec/requests/get_customer_name_list_spec.rb +45 -0
  38. data/spec/requests/get_customer_spec.rb +45 -0
  39. data/spec/requests/get_export_list_spec.rb +45 -0
  40. data/spec/requests/get_import_list_spec.rb +45 -0
  41. data/spec/requests/get_inventory_quantity_spec.rb +65 -0
  42. data/spec/requests/get_light_part_list_spec.rb +51 -0
  43. data/spec/requests/get_location_group_list_spec.rb +45 -0
  44. data/spec/requests/get_location_list_spec.rb +45 -0
  45. data/spec/requests/get_next_number_spec.rb +45 -0
  46. data/spec/requests/get_part_cost_spec.rb +45 -0
  47. data/spec/requests/get_part_information_spec.rb +45 -0
  48. data/spec/requests/get_part_list_spec.rb +65 -0
  49. data/spec/requests/get_pick_spec.rb +45 -0
  50. data/spec/requests/get_product_information_spec.rb +46 -0
  51. data/spec/requests/get_purchase_order_list_spec.rb +45 -0
  52. data/spec/requests/get_receipt_spec.rb +49 -0
  53. data/spec/requests/get_receiving_list_spec.rb +49 -0
  54. data/spec/requests/get_sales_order_list_spec.rb +49 -0
  55. data/spec/requests/get_ship_list_spec.rb +49 -0
  56. data/spec/requests/get_ship_now_list_spec.rb +48 -0
  57. data/spec/requests/get_shipment_spec.rb +45 -0
  58. data/spec/requests/get_system_property_spec.rb +45 -0
  59. data/spec/requests/get_total_inventory_spec.rb +46 -0
  60. data/spec/requests/get_transfer_order_list_spec.rb +45 -0
  61. data/spec/requests/get_uom_list_spec.rb +45 -0
  62. data/spec/requests/get_user_property_spec.rb +45 -0
  63. data/spec/requests/get_vendor_list_spec.rb +45 -0
  64. data/spec/requests/get_vendor_name_list_spec.rb +45 -0
  65. data/spec/requests/get_vendor_spec.rb +48 -0
  66. data/spec/requests/get_work_order_list_spec.rb +45 -0
  67. data/spec/requests/get_work_order_spec.rb +45 -0
  68. data/spec/requests/import_spec.rb +49 -0
  69. data/spec/requests/issues_sales_order_spec.rb +45 -0
  70. data/spec/requests/load_sales_order_spec.rb +45 -0
  71. data/spec/requests/load_transfer_order_spec.rb +45 -0
  72. data/spec/requests/location_query_spec.rb +49 -0
  73. data/spec/requests/make_payment_spec.rb +50 -0
  74. data/spec/requests/move_spec.rb +49 -0
  75. data/spec/requests/part_query_spec.rb +46 -0
  76. data/spec/requests/pick_query_spec.rb +49 -0
  77. data/spec/requests/print_report_spec.rb +48 -0
  78. data/spec/requests/product_query_spec.rb +46 -0
  79. data/spec/requests/quick_ship_spec.rb +45 -0
  80. data/spec/requests/quickbooks_export_spec.rb +43 -0
  81. data/spec/requests/save_customer_spec.rb +48 -0
  82. data/spec/requests/save_discount_spec.rb +48 -0
  83. data/spec/requests/save_pick_spec.rb +48 -0
  84. data/spec/requests/save_purchase_order_spec.rb +48 -0
  85. data/spec/requests/save_receipt_spec.rb +48 -0
  86. data/spec/requests/save_report_spec.rb +49 -0
  87. data/spec/requests/save_sales_order_spec.rb +48 -0
  88. data/spec/requests/save_shipment_spec.rb +48 -0
  89. data/spec/requests/save_tax_rate_spec.rb +48 -0
  90. data/spec/requests/save_transfer_order_spec.rb +48 -0
  91. data/spec/requests/save_upc_spec.rb +48 -0
  92. data/spec/requests/save_vendor_spec.rb +48 -0
  93. data/spec/requests/save_work_order_spec.rb +48 -0
  94. data/spec/requests/set_default_part_location_spec.rb +48 -0
  95. data/spec/requests/set_system_property_spec.rb +48 -0
  96. data/spec/requests/set_user_property_spec.rb +48 -0
  97. data/spec/requests/ship_spec.rb +48 -0
  98. data/spec/requests/void_sales_order_spec.rb +43 -0
  99. metadata +167 -21
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fishbowl::Requests do
4
+ describe "#load_sales_order" do
5
+ before :each do
6
+ mock_tcp_connection
7
+ mock_login_response
8
+ Fishbowl::Connection.connect(host: 'localhost')
9
+ Fishbowl::Connection.login(username: 'johndoe', password: 'secret')
10
+ end
11
+
12
+ let(:connection) { FakeTCPSocket.instance }
13
+
14
+ it "sends proper request" do
15
+ mock_the_response(expected_response)
16
+ Fishbowl::Requests.load_sales_order("50067")
17
+ connection.last_write.should be_equivalent_to(expected_request)
18
+ end
19
+
20
+ def expected_request
21
+ request = Nokogiri::XML::Builder.new do |xml|
22
+ xml.FbiXml {
23
+ xml.Ticket
24
+ xml.FbiMsgsRq {
25
+ xml.LoadSORq {
26
+ xml.Number "50024"
27
+ }
28
+ }
29
+ }
30
+ end
31
+
32
+ request.to_xml
33
+ end
34
+
35
+ def expected_response
36
+ Nokogiri::XML::Builder.new do |xml|
37
+ xml.response {
38
+ xml.LoadSORs(statusCode: '1000', statusMessage: "Success!") {
39
+ #TODO figure out what goes here!
40
+ }
41
+ }
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fishbowl::Requests do
4
+ describe "#load_transfer_order" do
5
+ before :each do
6
+ mock_tcp_connection
7
+ mock_login_response
8
+ Fishbowl::Connection.connect(host: 'localhost')
9
+ Fishbowl::Connection.login(username: 'johndoe', password: 'secret')
10
+ end
11
+
12
+ let(:connection) { FakeTCPSocket.instance }
13
+
14
+ it "sends proper request" do
15
+ mock_the_response(expected_response)
16
+ Fishbowl::Requests.load_transfer_order(1)
17
+ connection.last_write.should be_equivalent_to(expected_request)
18
+ end
19
+
20
+ def expected_request
21
+ request = Nokogiri::XML::Builder.new do |xml|
22
+ xml.FbiXml {
23
+ xml.Ticket
24
+ xml.FbiMsgsRq {
25
+ xml.LoadTransferOrderRq {
26
+ xml.Number 1
27
+ }
28
+ }
29
+ }
30
+ end
31
+
32
+ request.to_xml
33
+ end
34
+
35
+ def expected_response
36
+ Nokogiri::XML::Builder.new do |xml|
37
+ xml.response {
38
+ xml.LoadTransferOrderRs(statusCode: '1000', statusMessage: "Success!") {
39
+ #TODO figure out what goes here!
40
+ }
41
+ }
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fishbowl::Requests do
4
+ describe "#location_query" do
5
+ before :each do
6
+ mock_tcp_connection
7
+ mock_login_response
8
+ Fishbowl::Connection.connect(host: 'localhost')
9
+ Fishbowl::Connection.login(username: 'johndoe', password: 'secret')
10
+ end
11
+
12
+ let(:connection) { FakeTCPSocket.instance }
13
+
14
+ let(:valid_options) {
15
+ #TODO figure out what valid options are
16
+ }
17
+
18
+ it "sends proper request" do
19
+ mock_the_response(expected_response)
20
+ Fishbowl::Requests.location_query(valid_options)
21
+ connection.last_write.should be_equivalent_to(expected_request)
22
+ end
23
+
24
+ def expected_request
25
+ request = Nokogiri::XML::Builder.new do |xml|
26
+ xml.FbiXml {
27
+ xml.Ticket
28
+ xml.FbiMsgsRq {
29
+ xml.LocationQueryRq {
30
+ #TODO figure out what goes here!
31
+ }
32
+ }
33
+ }
34
+ end
35
+
36
+ request.to_xml
37
+ end
38
+
39
+ def expected_response
40
+ Nokogiri::XML::Builder.new do |xml|
41
+ xml.response {
42
+ xml.LocationQueryRs(statusCode: '1000', statusMessage: "Success!") {
43
+ #TODO figure out what goes here!
44
+ }
45
+ }
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,50 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fishbowl::Requests do
4
+ describe "#make_payment" do
5
+ before :each do
6
+ mock_tcp_connection
7
+ mock_login_response
8
+ Fishbowl::Connection.connect(host: 'localhost')
9
+ Fishbowl::Connection.login(username: 'johndoe', password: 'secret')
10
+ end
11
+
12
+ let(:connection) { FakeTCPSocket.instance }
13
+
14
+ let(:valid_options) {
15
+ #TODO figure out valid options
16
+ }
17
+
18
+ it "sends proper request" do
19
+ mock_the_response(expected_response)
20
+ Fishbowl::Requests.make_payment(valid_options)
21
+ connection.last_write.should be_equivalent_to(expected_request)
22
+ end
23
+
24
+ def expected_request
25
+ request = Nokogiri::XML::Builder.new do |xml|
26
+ xml.FbiXml {
27
+ xml.Ticket
28
+ xml.FbiMsgsRq {
29
+ xml.MakePaymentRq {
30
+ xml.Payment #TODO mock Payment object
31
+ xml.ProcessPayment true
32
+ }
33
+ }
34
+ }
35
+ end
36
+
37
+ request.to_xml
38
+ end
39
+
40
+ def expected_response
41
+ Nokogiri::XML::Builder.new do |xml|
42
+ xml.response {
43
+ xml.MakePaymentRs(statusCode: '1000', statusMessage: "Success!") {
44
+ #TODO figure out what goes here!
45
+ }
46
+ }
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fishbowl::Requests do
4
+ describe "#move" do
5
+ before :each do
6
+ mock_tcp_connection
7
+ mock_login_response
8
+ Fishbowl::Connection.connect(host: 'localhost')
9
+ Fishbowl::Connection.login(username: 'johndoe', password: 'secret')
10
+ end
11
+
12
+ let(:connection) { FakeTCPSocket.instance }
13
+
14
+ let(:valid_options) {
15
+ #TODO figure out valid options
16
+ }
17
+
18
+ it "sends proper request" do
19
+ mock_the_response(expected_response)
20
+ Fishbowl::Requests.move(valid_options)
21
+ connection.last_write.should be_equivalent_to(expected_request)
22
+ end
23
+
24
+ def expected_request
25
+ request = Nokogiri::XML::Builder.new do |xml|
26
+ xml.FbiXml {
27
+ xml.Ticket
28
+ xml.FbiMsgsRq {
29
+ xml.MoveRq {
30
+ #TODO figure out what goes here!
31
+ }
32
+ }
33
+ }
34
+ end
35
+
36
+ request.to_xml
37
+ end
38
+
39
+ def expected_response
40
+ Nokogiri::XML::Builder.new do |xml|
41
+ xml.response {
42
+ xml.MoveRs(statusCode: '1000', statusMessage: "Success!") {
43
+ #TODO figure out what goes here!
44
+ }
45
+ }
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fishbowl::Requests do
4
+ describe "#part_query" do
5
+ before :each do
6
+ mock_tcp_connection
7
+ mock_login_response
8
+ Fishbowl::Connection.connect(host: 'localhost')
9
+ Fishbowl::Connection.login(username: 'johndoe', password: 'secret')
10
+ end
11
+
12
+ let(:connection) { FakeTCPSocket.instance }
13
+
14
+ it "sends proper request" do
15
+ mock_the_response(expected_response)
16
+ Fishbowl::Requests.part_query("C501", "SLC")
17
+ connection.last_write.should be_equivalent_to(expected_request)
18
+ end
19
+
20
+ def expected_request(options = {})
21
+ request = Nokogiri::XML::Builder.new do |xml|
22
+ xml.FbiXml {
23
+ xml.Ticket
24
+ xml.FbiMsgsRq {
25
+ xml.PartQueryRq {
26
+ xml.PartNum "B203"
27
+ xml.LocationGroup "SLC"
28
+ }
29
+ }
30
+ }
31
+ end
32
+
33
+ request.to_xml
34
+ end
35
+
36
+ def expected_response
37
+ Nokogiri::XML::Builder.new do |xml|
38
+ xml.response {
39
+ xml.PartQueryRs(statusCode: '1000', statusMessage: "Success!") {
40
+ #TODO figure out what goes here!
41
+ }
42
+ }
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fishbowl::Requests do
4
+ describe "#pick_query" do
5
+ before :each do
6
+ mock_tcp_connection
7
+ mock_login_response
8
+ Fishbowl::Connection.connect(host: 'localhost')
9
+ Fishbowl::Connection.login(username: 'johndoe', password: 'secret')
10
+ end
11
+
12
+ let(:connection) { FakeTCPSocket.instance }
13
+
14
+ let(:valid_options) {
15
+ #TODO figure out valid options
16
+ }
17
+
18
+ it "sends proper request" do
19
+ mock_the_response(expected_response)
20
+ Fishbowl::Requests.pick_query(valid_options)
21
+ connection.last_write.should be_equivalent_to(expected_request)
22
+ end
23
+
24
+ def expected_request(options = {})
25
+ request = Nokogiri::XML::Builder.new do |xml|
26
+ xml.FbiXml {
27
+ xml.Ticket
28
+ xml.FbiMsgsRq {
29
+ xml.PickQueryRq {
30
+ #TODO figure out what goes here!
31
+ }
32
+ }
33
+ }
34
+ end
35
+
36
+ request.to_xml
37
+ end
38
+
39
+ def expected_response
40
+ Nokogiri::XML::Builder.new do |xml|
41
+ xml.response {
42
+ xml.PickQueryRs(statusCode: '1000', statusMessage: "Success!") {
43
+ #TODO figure out what goes here!
44
+ }
45
+ }
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fishbowl::Requests do
4
+ describe "#print_report" do
5
+ before :each do
6
+ mock_tcp_connection
7
+ mock_login_response
8
+ Fishbowl::Connection.connect(host: 'localhost')
9
+ Fishbowl::Connection.login(username: 'johndoe', password: 'secret')
10
+ end
11
+
12
+ let(:connection) { FakeTCPSocket.instance }
13
+ let(:valid_options) {
14
+ #TODO figure out valid options
15
+ }
16
+
17
+ it "sends proper request" do
18
+ mock_the_response(expected_response)
19
+ Fishbowl::Requests.print_report(valid_options)
20
+ connection.last_write.should be_equivalent_to(expected_request)
21
+ end
22
+
23
+ def expected_request
24
+ request = Nokogiri::XML::Builder.new do |xml|
25
+ xml.FbiXml {
26
+ xml.Ticket
27
+ xml.FbiMsgsRq {
28
+ xml.PrintReportRq {
29
+ #TODO figure out what goes here!
30
+ }
31
+ }
32
+ }
33
+ end
34
+
35
+ request.to_xml
36
+ end
37
+
38
+ def expected_response
39
+ Nokogiri::XML::Builder.new do |xml|
40
+ xml.response {
41
+ xml.PrintReportRs(statusCode: '1000', statusMessage: "Success!") {
42
+ #TODO figure out what goes here!
43
+ }
44
+ }
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fishbowl::Requests do
4
+ describe "#product_query" do
5
+ before :each do
6
+ mock_tcp_connection
7
+ mock_login_response
8
+ Fishbowl::Connection.connect(host: 'localhost')
9
+ Fishbowl::Connection.login(username: 'johndoe', password: 'secret')
10
+ end
11
+
12
+ let(:connection) { FakeTCPSocket.instance }
13
+
14
+ it "sends proper request" do
15
+ mock_the_response(expected_response)
16
+ Fishbowl::Requests.product_query("BB2005", true)
17
+ connection.last_write.should be_equivalent_to(expected_request)
18
+ end
19
+
20
+ def expected_request(options = {})
21
+ request = Nokogiri::XML::Builder.new do |xml|
22
+ xml.FbiXml {
23
+ xml.Ticket
24
+ xml.FbiMsgsRq {
25
+ xml.ProductQueryRq {
26
+ xml.ProductNum "BB2005"
27
+ xml.GetImage true
28
+ }
29
+ }
30
+ }
31
+ end
32
+
33
+ request.to_xml
34
+ end
35
+
36
+ def expected_response
37
+ Nokogiri::XML::Builder.new do |xml|
38
+ xml.response {
39
+ xml.ProductQueryRs(statusCode: '1000', statusMessage: "Success!") {
40
+ #TODO figure out what goes here!
41
+ }
42
+ }
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fishbowl::Requests do
4
+ describe "#quick_ship" do
5
+ before :each do
6
+ mock_tcp_connection
7
+ mock_login_response
8
+ Fishbowl::Connection.connect(host: 'localhost')
9
+ Fishbowl::Connection.login(username: 'johndoe', password: 'secret')
10
+ end
11
+
12
+ let(:connection) { FakeTCPSocket.instance }
13
+
14
+ it "sends proper request" do
15
+ mock_the_response(expected_response)
16
+ Fishbowl::Requests.quick_ship("50067")
17
+ connection.last_write.should be_equivalent_to(expected_request)
18
+ end
19
+
20
+ def expected_request
21
+ request = Nokogiri::XML::Builder.new do |xml|
22
+ xml.FbiXml {
23
+ xml.Ticket
24
+ xml.FbiMsgsRq {
25
+ xml.QuickShipRq {
26
+ xml.SONumber "50067"
27
+ }
28
+ }
29
+ }
30
+ end
31
+
32
+ request.to_xml
33
+ end
34
+
35
+ def expected_response
36
+ Nokogiri::XML::Builder.new do |xml|
37
+ xml.response {
38
+ xml.QuickShipRs(statusCode: '1000', statusMessage: "Success!") {
39
+ #TODO figure out what goes here!
40
+ }
41
+ }
42
+ end
43
+ end
44
+ end
45
+ end