fishbowl 0.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +9 -4
- data/Gemfile +9 -2
- data/Guardfile +13 -0
- data/README.md +25 -5
- data/fishbowl.gemspec +5 -5
- data/lib/fishbowl/configuration.rb +9 -0
- data/lib/fishbowl/connection.rb +100 -0
- data/lib/fishbowl/errors.rb +18 -8
- data/lib/fishbowl/ext.rb +15 -0
- data/lib/fishbowl/objects/account.rb +8 -12
- data/lib/fishbowl/objects/address.rb +86 -0
- data/lib/fishbowl/objects/base_object.rb +42 -9
- data/lib/fishbowl/objects/carrier.rb +15 -0
- data/lib/fishbowl/objects/carton.rb +54 -0
- data/lib/fishbowl/objects/uom.rb +47 -0
- data/lib/fishbowl/objects/user.rb +15 -0
- data/lib/fishbowl/objects.rb +5 -0
- data/lib/fishbowl/requests/add_inventory.rb +34 -0
- data/lib/fishbowl/requests/add_sales_order_item.rb +42 -0
- data/lib/fishbowl/requests/adjust_inventory.rb +28 -0
- data/lib/fishbowl/requests/get_account_balance.rb +15 -0
- data/lib/fishbowl/requests/get_account_list.rb +13 -0
- data/lib/fishbowl/requests/get_carrier_list.rb +14 -0
- data/lib/fishbowl/requests/get_customer_list.rb +12 -0
- data/lib/fishbowl/requests/get_customer_name_list.rb +12 -0
- data/lib/fishbowl/requests/get_export_list.rb +12 -0
- data/lib/fishbowl/requests/get_import_list.rb +12 -0
- data/lib/fishbowl/requests/get_location_group_list.rb +12 -0
- data/lib/fishbowl/requests/get_location_list.rb +12 -0
- data/lib/fishbowl/requests/get_product.rb +18 -0
- data/lib/fishbowl/requests/get_product_price.rb +21 -0
- data/lib/fishbowl/requests/get_uom_list.rb +12 -0
- data/lib/fishbowl/requests/get_vendor_list.rb +12 -0
- data/lib/fishbowl/requests/get_vendor_name_list.rb +12 -0
- data/lib/fishbowl/requests/get_work_order_list.rb +12 -0
- data/lib/fishbowl/requests/inventory_quantity.rb +17 -0
- data/lib/fishbowl/requests/load_sales_order.rb +21 -0
- data/lib/fishbowl/requests/make_payment.rb +32 -0
- data/lib/fishbowl/requests/save_sales_order.rb +86 -0
- data/lib/fishbowl/requests/total_inventory.rb +18 -0
- data/lib/fishbowl/requests/void_sales_order.rb +18 -0
- data/lib/fishbowl/requests.rb +5 -0
- data/lib/fishbowl/version.rb +1 -1
- data/lib/fishbowl.rb +12 -95
- data/lib/status_codes.yml +183 -0
- data/spec/connection_spec.rb +99 -99
- data/spec/errors_spec.rb +11 -9
- data/spec/examples/account.xml +6 -0
- data/spec/examples/address.xml +30 -0
- data/spec/examples/carrier.xml +3 -0
- data/spec/examples/carton.xml +93 -0
- data/spec/examples/contact_information.xml +5 -0
- data/spec/examples/contacts.xml +7 -0
- data/spec/examples/credit_card.xml +10 -0
- data/spec/examples/customer.xml +54 -0
- data/spec/examples/location.xml +14 -0
- data/spec/examples/location_group.xml +5 -0
- data/spec/examples/location_group_string.xml +1 -0
- data/spec/examples/order_history.xml +8 -0
- data/spec/examples/part.xml +105 -0
- data/spec/examples/payment.xml +6 -0
- data/spec/examples/pick.xml +265 -0
- data/spec/examples/pick_item.xml +236 -0
- data/spec/examples/product.xml +159 -0
- data/spec/examples/purchase_order.xml +53 -0
- data/spec/examples/receipt.xml +146 -0
- data/spec/examples/report.xml +10 -0
- data/spec/examples/report_tree.xml +7 -0
- data/spec/examples/sales_order.xml +47 -0
- data/spec/examples/sales_order_item.xml +32 -0
- data/spec/examples/shipping.xml +127 -0
- data/spec/examples/tag.xml +28 -0
- data/spec/examples/tax_rate.xml +10 -0
- data/spec/examples/tracking.xml +14 -0
- data/spec/examples/tracking_item.xml +12 -0
- data/spec/examples/transfer_order.xml +257 -0
- data/spec/examples/transfer_order_item.xml +147 -0
- data/spec/examples/uom.xml +26 -0
- data/spec/examples/uom_conversion.xml +8 -0
- data/spec/examples/user.xml +8 -0
- data/spec/examples/vendor.xml +19 -0
- data/spec/examples/vendor_part_number.xml +3 -0
- data/spec/examples/work_order.xml +228 -0
- data/spec/examples/work_order_item.xml +172 -0
- data/spec/objects/account_spec.rb +33 -27
- data/spec/objects/address_information_spec.rb +18 -0
- data/spec/objects/address_spec.rb +36 -0
- data/spec/objects/base_object_spec.rb +67 -23
- data/spec/objects/carrier_spec.rb +15 -0
- data/spec/objects/carton_spec.rb +23 -0
- data/spec/objects/country_spec.rb +16 -0
- data/spec/objects/shipping_item_spec.rb +21 -0
- data/spec/objects/state_spec.rb +17 -0
- data/spec/objects/uom_conversion_spec.rb +20 -0
- data/spec/objects/uom_spec.rb +20 -0
- data/spec/objects/user_spec.rb +20 -0
- data/spec/requests/add_inventory_spec.rb +79 -0
- data/spec/requests/add_sales_order_item_spec.rb +85 -0
- data/spec/requests/adjust_inventory_spec.rb +62 -0
- data/spec/requests/calculate_sales_order_spec.rb +48 -0
- data/spec/requests/close_short_sales_order_spec.rb +45 -0
- data/spec/requests/cycle_count_spec.rb +49 -0
- data/spec/requests/delete_sales_order_spec.rb +45 -0
- data/spec/requests/export_spec.rb +45 -0
- data/spec/requests/get_account_balance_spec.rb +52 -0
- data/spec/requests/get_account_list_spec.rb +51 -0
- data/spec/requests/get_carrier_list_spec.rb +54 -0
- data/spec/requests/get_customer_list_spec.rb +51 -0
- data/spec/requests/get_customer_name_list_spec.rb +45 -0
- data/spec/requests/get_customer_spec.rb +45 -0
- data/spec/requests/get_export_list_spec.rb +45 -0
- data/spec/requests/get_import_list_spec.rb +45 -0
- data/spec/requests/get_inventory_quantity_spec.rb +65 -0
- data/spec/requests/get_light_part_list_spec.rb +51 -0
- data/spec/requests/get_location_group_list_spec.rb +45 -0
- data/spec/requests/get_location_list_spec.rb +45 -0
- data/spec/requests/get_next_number_spec.rb +45 -0
- data/spec/requests/get_part_cost_spec.rb +45 -0
- data/spec/requests/get_part_information_spec.rb +45 -0
- data/spec/requests/get_part_list_spec.rb +65 -0
- data/spec/requests/get_pick_spec.rb +45 -0
- data/spec/requests/get_product_information_spec.rb +46 -0
- data/spec/requests/get_purchase_order_list_spec.rb +45 -0
- data/spec/requests/get_receipt_spec.rb +49 -0
- data/spec/requests/get_receiving_list_spec.rb +49 -0
- data/spec/requests/get_sales_order_list_spec.rb +49 -0
- data/spec/requests/get_ship_list_spec.rb +49 -0
- data/spec/requests/get_ship_now_list_spec.rb +48 -0
- data/spec/requests/get_shipment_spec.rb +45 -0
- data/spec/requests/get_system_property_spec.rb +45 -0
- data/spec/requests/get_total_inventory_spec.rb +46 -0
- data/spec/requests/get_transfer_order_list_spec.rb +45 -0
- data/spec/requests/get_uom_list_spec.rb +45 -0
- data/spec/requests/get_user_property_spec.rb +45 -0
- data/spec/requests/get_vendor_list_spec.rb +45 -0
- data/spec/requests/get_vendor_name_list_spec.rb +45 -0
- data/spec/requests/get_vendor_spec.rb +48 -0
- data/spec/requests/get_work_order_list_spec.rb +45 -0
- data/spec/requests/get_work_order_spec.rb +45 -0
- data/spec/requests/import_spec.rb +49 -0
- data/spec/requests/issues_sales_order_spec.rb +45 -0
- data/spec/requests/load_sales_order_spec.rb +45 -0
- data/spec/requests/load_transfer_order_spec.rb +45 -0
- data/spec/requests/location_query_spec.rb +49 -0
- data/spec/requests/make_payment_spec.rb +50 -0
- data/spec/requests/move_spec.rb +49 -0
- data/spec/requests/part_query_spec.rb +46 -0
- data/spec/requests/pick_query_spec.rb +49 -0
- data/spec/requests/print_report_spec.rb +48 -0
- data/spec/requests/product_query_spec.rb +46 -0
- data/spec/requests/quick_ship_spec.rb +45 -0
- data/spec/requests/quickbooks_export_spec.rb +43 -0
- data/spec/requests/save_customer_spec.rb +48 -0
- data/spec/requests/save_discount_spec.rb +48 -0
- data/spec/requests/save_pick_spec.rb +48 -0
- data/spec/requests/save_purchase_order_spec.rb +48 -0
- data/spec/requests/save_receipt_spec.rb +48 -0
- data/spec/requests/save_report_spec.rb +49 -0
- data/spec/requests/save_sales_order_spec.rb +48 -0
- data/spec/requests/save_shipment_spec.rb +48 -0
- data/spec/requests/save_tax_rate_spec.rb +48 -0
- data/spec/requests/save_transfer_order_spec.rb +48 -0
- data/spec/requests/save_upc_spec.rb +48 -0
- data/spec/requests/save_vendor_spec.rb +48 -0
- data/spec/requests/save_work_order_spec.rb +48 -0
- data/spec/requests/set_default_part_location_spec.rb +48 -0
- data/spec/requests/set_system_property_spec.rb +48 -0
- data/spec/requests/set_user_property_spec.rb +48 -0
- data/spec/requests/ship_spec.rb +48 -0
- data/spec/requests/void_sales_order_spec.rb +43 -0
- data/spec/spec_helper.rb +48 -16
- data/spec/support/examples_loader.rb +5 -0
- data/spec/support/response_mocks.rb +27 -0
- metadata +304 -35
- data/spec/support/fake_login.rb +0 -15
@@ -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
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fishbowl::Requests do
|
4
|
+
describe "#quickbooks_export" 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.quickbooks_export
|
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.QBExportRq
|
26
|
+
}
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
request.to_xml
|
31
|
+
end
|
32
|
+
|
33
|
+
def expected_response
|
34
|
+
Nokogiri::XML::Builder.new do |xml|
|
35
|
+
xml.response {
|
36
|
+
xml.QBExportRs(statusCode: '1000', statusMessage: "Success!") {
|
37
|
+
#TODO figure out what goes here!
|
38
|
+
}
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fishbowl::Requests do
|
4
|
+
describe "#save_customer" 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(:mock_customer) {
|
14
|
+
#TODO mock a Customer
|
15
|
+
}
|
16
|
+
|
17
|
+
it "sends proper request" do
|
18
|
+
mock_the_response(expected_response)
|
19
|
+
Fishbowl::Requests.save_customer(mock_customer)
|
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.CustomerSaveRq {
|
29
|
+
#TODO mock a Customer object
|
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.CustomerSaveRs(statusCode: '1000', statusMessage: "Success!") {
|
42
|
+
#TODO figure out what goes here!
|
43
|
+
}
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fishbowl::Requests do
|
4
|
+
describe "#save_discount" 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(:mock_discount) {
|
14
|
+
#TODO mock a Customer
|
15
|
+
}
|
16
|
+
|
17
|
+
it "sends proper request" do
|
18
|
+
mock_the_response(expected_response)
|
19
|
+
Fishbowl::Requests.save_discount(mock_discount)
|
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.SaveDiscountRq {
|
29
|
+
#TODO mock a Discount object
|
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.SaveDiscountRs(statusCode: '1000', statusMessage: "Success!") {
|
42
|
+
#TODO figure out what goes here!
|
43
|
+
}
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fishbowl::Requests do
|
4
|
+
describe "#save_pick" 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(:mock_pick) {
|
14
|
+
#TODO mock a Pick
|
15
|
+
}
|
16
|
+
|
17
|
+
it "sends proper request" do
|
18
|
+
mock_the_response(expected_response)
|
19
|
+
Fishbowl::Requests.save_pick(mock_pick)
|
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.SavePickRq {
|
29
|
+
#TODO mock a Pick object
|
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.SavePickRs(statusCode: '1000', statusMessage: "Success!") {
|
42
|
+
#TODO figure out what goes here!
|
43
|
+
}
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fishbowl::Requests do
|
4
|
+
describe "#save_purchase_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
|
+
let(:mock_purchase_order) {
|
14
|
+
#TODO mock a PurchaseOrder
|
15
|
+
}
|
16
|
+
|
17
|
+
it "sends proper request" do
|
18
|
+
mock_the_response(expected_response)
|
19
|
+
Fishbowl::Requests.save_purchase_order(mock_purchase_order)
|
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.POSaveRq {
|
29
|
+
#TODO mock a PurchaseOrder object
|
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.POSaveRs(statusCode: '1000', statusMessage: "Success!") {
|
42
|
+
#TODO figure out what goes here!
|
43
|
+
}
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fishbowl::Requests do
|
4
|
+
describe "#save_receipt" 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(:mock_receipt) {
|
14
|
+
#TODO mock a Receipt
|
15
|
+
}
|
16
|
+
|
17
|
+
it "sends proper request" do
|
18
|
+
mock_the_response(expected_response)
|
19
|
+
Fishbowl::Requests.save_receipt(mock_receipt)
|
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.SaveReceiptRq {
|
29
|
+
#TODO mock a Receipt object
|
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.SaveReceiptRs(statusCode: '1000', statusMessage: "Success!") {
|
42
|
+
#TODO figure out what goes here!
|
43
|
+
}
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fishbowl::Requests do
|
4
|
+
describe "#save_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(:mock_report) {
|
14
|
+
#TODO mock a Report
|
15
|
+
}
|
16
|
+
|
17
|
+
it "sends proper request" do
|
18
|
+
mock_the_response(expected_response)
|
19
|
+
Fishbowl::Requests.save_report("Company", mock_report)
|
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.SaveReportRq {
|
29
|
+
xml.ReportTree "Company"
|
30
|
+
#TODO mock a Report object
|
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.SaveReportRs(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 "#save_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
|
+
let(:mock_sales_order) {
|
14
|
+
#TODO mock a SalesOrder
|
15
|
+
}
|
16
|
+
|
17
|
+
it "sends proper request" do
|
18
|
+
mock_the_response(expected_response)
|
19
|
+
Fishbowl::Requests.save_sales_order(mock_sales_order)
|
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.SOSaveRq {
|
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.SOSaveRs(statusCode: '1000', statusMessage: "Success!") {
|
42
|
+
#TODO figure out what goes here!
|
43
|
+
}
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fishbowl::Requests do
|
4
|
+
describe "#save_shipment" 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(:mock_shipment) {
|
14
|
+
#TODO mock a Shipment
|
15
|
+
}
|
16
|
+
|
17
|
+
it "sends proper request" do
|
18
|
+
mock_the_response(expected_response)
|
19
|
+
Fishbowl::Requests.save_shipment(mock_shipment)
|
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.SaveShipmentRq {
|
29
|
+
#TODO mock a Shipment object
|
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.SaveShipmentRs(statusCode: '1000', statusMessage: "Success!") {
|
42
|
+
#TODO figure out what goes here!
|
43
|
+
}
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fishbowl::Requests do
|
4
|
+
describe "#save_tax_rate" 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.save_tax_rate(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.SaveTaxRateRq {
|
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.SaveTaxRateRs(statusCode: '1000', statusMessage: "Success!") {
|
42
|
+
#TODO figure out what goes here!
|
43
|
+
}
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|