fishbowl 0.0.1 → 1.0.2

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 (177) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +9 -4
  4. data/Gemfile +9 -2
  5. data/Guardfile +13 -0
  6. data/README.md +25 -5
  7. data/fishbowl.gemspec +5 -5
  8. data/lib/fishbowl/configuration.rb +9 -0
  9. data/lib/fishbowl/connection.rb +100 -0
  10. data/lib/fishbowl/errors.rb +18 -8
  11. data/lib/fishbowl/ext.rb +15 -0
  12. data/lib/fishbowl/objects/account.rb +8 -12
  13. data/lib/fishbowl/objects/address.rb +86 -0
  14. data/lib/fishbowl/objects/base_object.rb +42 -9
  15. data/lib/fishbowl/objects/carrier.rb +15 -0
  16. data/lib/fishbowl/objects/carton.rb +54 -0
  17. data/lib/fishbowl/objects/uom.rb +47 -0
  18. data/lib/fishbowl/objects/user.rb +15 -0
  19. data/lib/fishbowl/objects.rb +5 -0
  20. data/lib/fishbowl/requests/add_inventory.rb +34 -0
  21. data/lib/fishbowl/requests/add_sales_order_item.rb +42 -0
  22. data/lib/fishbowl/requests/adjust_inventory.rb +28 -0
  23. data/lib/fishbowl/requests/get_account_balance.rb +15 -0
  24. data/lib/fishbowl/requests/get_account_list.rb +13 -0
  25. data/lib/fishbowl/requests/get_carrier_list.rb +14 -0
  26. data/lib/fishbowl/requests/get_customer_list.rb +12 -0
  27. data/lib/fishbowl/requests/get_customer_name_list.rb +12 -0
  28. data/lib/fishbowl/requests/get_export_list.rb +12 -0
  29. data/lib/fishbowl/requests/get_import_list.rb +12 -0
  30. data/lib/fishbowl/requests/get_location_group_list.rb +12 -0
  31. data/lib/fishbowl/requests/get_location_list.rb +12 -0
  32. data/lib/fishbowl/requests/get_product.rb +18 -0
  33. data/lib/fishbowl/requests/get_product_price.rb +21 -0
  34. data/lib/fishbowl/requests/get_uom_list.rb +12 -0
  35. data/lib/fishbowl/requests/get_vendor_list.rb +12 -0
  36. data/lib/fishbowl/requests/get_vendor_name_list.rb +12 -0
  37. data/lib/fishbowl/requests/get_work_order_list.rb +12 -0
  38. data/lib/fishbowl/requests/inventory_quantity.rb +17 -0
  39. data/lib/fishbowl/requests/load_sales_order.rb +21 -0
  40. data/lib/fishbowl/requests/make_payment.rb +32 -0
  41. data/lib/fishbowl/requests/save_sales_order.rb +86 -0
  42. data/lib/fishbowl/requests/total_inventory.rb +18 -0
  43. data/lib/fishbowl/requests/void_sales_order.rb +18 -0
  44. data/lib/fishbowl/requests.rb +5 -0
  45. data/lib/fishbowl/version.rb +1 -1
  46. data/lib/fishbowl.rb +12 -95
  47. data/lib/status_codes.yml +183 -0
  48. data/spec/connection_spec.rb +99 -99
  49. data/spec/errors_spec.rb +11 -9
  50. data/spec/examples/account.xml +6 -0
  51. data/spec/examples/address.xml +30 -0
  52. data/spec/examples/carrier.xml +3 -0
  53. data/spec/examples/carton.xml +93 -0
  54. data/spec/examples/contact_information.xml +5 -0
  55. data/spec/examples/contacts.xml +7 -0
  56. data/spec/examples/credit_card.xml +10 -0
  57. data/spec/examples/customer.xml +54 -0
  58. data/spec/examples/location.xml +14 -0
  59. data/spec/examples/location_group.xml +5 -0
  60. data/spec/examples/location_group_string.xml +1 -0
  61. data/spec/examples/order_history.xml +8 -0
  62. data/spec/examples/part.xml +105 -0
  63. data/spec/examples/payment.xml +6 -0
  64. data/spec/examples/pick.xml +265 -0
  65. data/spec/examples/pick_item.xml +236 -0
  66. data/spec/examples/product.xml +159 -0
  67. data/spec/examples/purchase_order.xml +53 -0
  68. data/spec/examples/receipt.xml +146 -0
  69. data/spec/examples/report.xml +10 -0
  70. data/spec/examples/report_tree.xml +7 -0
  71. data/spec/examples/sales_order.xml +47 -0
  72. data/spec/examples/sales_order_item.xml +32 -0
  73. data/spec/examples/shipping.xml +127 -0
  74. data/spec/examples/tag.xml +28 -0
  75. data/spec/examples/tax_rate.xml +10 -0
  76. data/spec/examples/tracking.xml +14 -0
  77. data/spec/examples/tracking_item.xml +12 -0
  78. data/spec/examples/transfer_order.xml +257 -0
  79. data/spec/examples/transfer_order_item.xml +147 -0
  80. data/spec/examples/uom.xml +26 -0
  81. data/spec/examples/uom_conversion.xml +8 -0
  82. data/spec/examples/user.xml +8 -0
  83. data/spec/examples/vendor.xml +19 -0
  84. data/spec/examples/vendor_part_number.xml +3 -0
  85. data/spec/examples/work_order.xml +228 -0
  86. data/spec/examples/work_order_item.xml +172 -0
  87. data/spec/objects/account_spec.rb +33 -27
  88. data/spec/objects/address_information_spec.rb +18 -0
  89. data/spec/objects/address_spec.rb +36 -0
  90. data/spec/objects/base_object_spec.rb +67 -23
  91. data/spec/objects/carrier_spec.rb +15 -0
  92. data/spec/objects/carton_spec.rb +23 -0
  93. data/spec/objects/country_spec.rb +16 -0
  94. data/spec/objects/shipping_item_spec.rb +21 -0
  95. data/spec/objects/state_spec.rb +17 -0
  96. data/spec/objects/uom_conversion_spec.rb +20 -0
  97. data/spec/objects/uom_spec.rb +20 -0
  98. data/spec/objects/user_spec.rb +20 -0
  99. data/spec/requests/add_inventory_spec.rb +79 -0
  100. data/spec/requests/add_sales_order_item_spec.rb +85 -0
  101. data/spec/requests/adjust_inventory_spec.rb +62 -0
  102. data/spec/requests/calculate_sales_order_spec.rb +48 -0
  103. data/spec/requests/close_short_sales_order_spec.rb +45 -0
  104. data/spec/requests/cycle_count_spec.rb +49 -0
  105. data/spec/requests/delete_sales_order_spec.rb +45 -0
  106. data/spec/requests/export_spec.rb +45 -0
  107. data/spec/requests/get_account_balance_spec.rb +52 -0
  108. data/spec/requests/get_account_list_spec.rb +51 -0
  109. data/spec/requests/get_carrier_list_spec.rb +54 -0
  110. data/spec/requests/get_customer_list_spec.rb +51 -0
  111. data/spec/requests/get_customer_name_list_spec.rb +45 -0
  112. data/spec/requests/get_customer_spec.rb +45 -0
  113. data/spec/requests/get_export_list_spec.rb +45 -0
  114. data/spec/requests/get_import_list_spec.rb +45 -0
  115. data/spec/requests/get_inventory_quantity_spec.rb +65 -0
  116. data/spec/requests/get_light_part_list_spec.rb +51 -0
  117. data/spec/requests/get_location_group_list_spec.rb +45 -0
  118. data/spec/requests/get_location_list_spec.rb +45 -0
  119. data/spec/requests/get_next_number_spec.rb +45 -0
  120. data/spec/requests/get_part_cost_spec.rb +45 -0
  121. data/spec/requests/get_part_information_spec.rb +45 -0
  122. data/spec/requests/get_part_list_spec.rb +65 -0
  123. data/spec/requests/get_pick_spec.rb +45 -0
  124. data/spec/requests/get_product_information_spec.rb +46 -0
  125. data/spec/requests/get_purchase_order_list_spec.rb +45 -0
  126. data/spec/requests/get_receipt_spec.rb +49 -0
  127. data/spec/requests/get_receiving_list_spec.rb +49 -0
  128. data/spec/requests/get_sales_order_list_spec.rb +49 -0
  129. data/spec/requests/get_ship_list_spec.rb +49 -0
  130. data/spec/requests/get_ship_now_list_spec.rb +48 -0
  131. data/spec/requests/get_shipment_spec.rb +45 -0
  132. data/spec/requests/get_system_property_spec.rb +45 -0
  133. data/spec/requests/get_total_inventory_spec.rb +46 -0
  134. data/spec/requests/get_transfer_order_list_spec.rb +45 -0
  135. data/spec/requests/get_uom_list_spec.rb +45 -0
  136. data/spec/requests/get_user_property_spec.rb +45 -0
  137. data/spec/requests/get_vendor_list_spec.rb +45 -0
  138. data/spec/requests/get_vendor_name_list_spec.rb +45 -0
  139. data/spec/requests/get_vendor_spec.rb +48 -0
  140. data/spec/requests/get_work_order_list_spec.rb +45 -0
  141. data/spec/requests/get_work_order_spec.rb +45 -0
  142. data/spec/requests/import_spec.rb +49 -0
  143. data/spec/requests/issues_sales_order_spec.rb +45 -0
  144. data/spec/requests/load_sales_order_spec.rb +45 -0
  145. data/spec/requests/load_transfer_order_spec.rb +45 -0
  146. data/spec/requests/location_query_spec.rb +49 -0
  147. data/spec/requests/make_payment_spec.rb +50 -0
  148. data/spec/requests/move_spec.rb +49 -0
  149. data/spec/requests/part_query_spec.rb +46 -0
  150. data/spec/requests/pick_query_spec.rb +49 -0
  151. data/spec/requests/print_report_spec.rb +48 -0
  152. data/spec/requests/product_query_spec.rb +46 -0
  153. data/spec/requests/quick_ship_spec.rb +45 -0
  154. data/spec/requests/quickbooks_export_spec.rb +43 -0
  155. data/spec/requests/save_customer_spec.rb +48 -0
  156. data/spec/requests/save_discount_spec.rb +48 -0
  157. data/spec/requests/save_pick_spec.rb +48 -0
  158. data/spec/requests/save_purchase_order_spec.rb +48 -0
  159. data/spec/requests/save_receipt_spec.rb +48 -0
  160. data/spec/requests/save_report_spec.rb +49 -0
  161. data/spec/requests/save_sales_order_spec.rb +48 -0
  162. data/spec/requests/save_shipment_spec.rb +48 -0
  163. data/spec/requests/save_tax_rate_spec.rb +48 -0
  164. data/spec/requests/save_transfer_order_spec.rb +48 -0
  165. data/spec/requests/save_upc_spec.rb +48 -0
  166. data/spec/requests/save_vendor_spec.rb +48 -0
  167. data/spec/requests/save_work_order_spec.rb +48 -0
  168. data/spec/requests/set_default_part_location_spec.rb +48 -0
  169. data/spec/requests/set_system_property_spec.rb +48 -0
  170. data/spec/requests/set_user_property_spec.rb +48 -0
  171. data/spec/requests/ship_spec.rb +48 -0
  172. data/spec/requests/void_sales_order_spec.rb +43 -0
  173. data/spec/spec_helper.rb +48 -16
  174. data/spec/support/examples_loader.rb +5 -0
  175. data/spec/support/response_mocks.rb +27 -0
  176. metadata +304 -35
  177. data/spec/support/fake_login.rb +0 -15
@@ -0,0 +1,228 @@
1
+ <WO>
2
+ <ID>1</ID>
3
+ <Num>1:001</Num>
4
+ <Type>Manufacture</Type>
5
+ <TypeID>6</TypeID>
6
+ <MOItemID>1</MOItemID>
7
+ <WOItems>
8
+ <WOItem>
9
+ <ID>1</ID>
10
+ <MOItemID>2</MOItemID>
11
+ <TypeID>10</TypeID>
12
+ <Part>
13
+ <PartID>36</PartID>
14
+ <PartClassID>0</PartClassID>
15
+ <TypeID>10</TypeID>
16
+ <UOM>
17
+ <UOMID>1</UOMID>
18
+ <Name>Each</Name>
19
+ <Code>ea</Code>
20
+ <Integral>true</Integral>
21
+ <Active>true</Active>
22
+ <Type>Count</Type>
23
+ <UOMConversions>
24
+ <UOMConversion>
25
+ <MainUOMID>1</MainUOMID>
26
+ <ToUOMID>17</ToUOMID>
27
+ <ToUOMCode>pr</ToUOMCode>
28
+ <ConversionMultiply>1.0</ConversionMultiply>
29
+ <ConversionFactor>2.0</ConversionFactor>
30
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
31
+ </UOMConversion>
32
+ <UOMConversion>
33
+ <MainUOMID>1</MainUOMID>
34
+ <ToUOMID>18</ToUOMID>
35
+ <ToUOMCode>pk</ToUOMCode>
36
+ <ConversionMultiply>1.0</ConversionMultiply>
37
+ <ConversionFactor>20.0</ConversionFactor>
38
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
39
+ </UOMConversion>
40
+ </UOMConversions>
41
+ </UOM>
42
+ <Num>BB2002</Num>
43
+ <Description>Comfort Bike</Description>
44
+ <Details/>
45
+ <StandardCost>0</StandardCost>
46
+ <HasBOM>false</HasBOM>
47
+ <Configurable>false</Configurable>
48
+ <ActiveFlag>true</ActiveFlag>
49
+ <SerializedFlag>true</SerializedFlag>
50
+ <TrackingFlag>true</TrackingFlag>
51
+ <Weight>20</Weight>
52
+ <WeightUOM>
53
+ <UOM>
54
+ <UOMID>3</UOMID>
55
+ <Name>Pound</Name>
56
+ <Code>lbs</Code>
57
+ <Integral>false</Integral>
58
+ <Active>true</Active>
59
+ <Type>Weight</Type>
60
+ <UOMConversions>
61
+ <UOMConversion>
62
+ <MainUOMID>3</MainUOMID>
63
+ <ToUOMID>8</ToUOMID>
64
+ <ToUOMCode>kg</ToUOMCode>
65
+ <ConversionMultiply>1.0</ConversionMultiply>
66
+ <ConversionFactor>2.2046000957489014</ConversionFactor>
67
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
68
+ </UOMConversion>
69
+ </UOMConversions>
70
+ </UOM>
71
+ </WeightUOM>
72
+ <Width>0</Width>
73
+ <Height>0</Height>
74
+ <Len>0</Len>
75
+ <SizeUOM>
76
+ <UOM>
77
+ <UOMID>2</UOMID>
78
+ <Name>Foot</Name>
79
+ <Code>ft</Code>
80
+ <Integral>false</Integral>
81
+ <Active>true</Active>
82
+ <Type>Length</Type>
83
+ <UOMConversions>
84
+ <UOMConversion>
85
+ <MainUOMID>2</MainUOMID>
86
+ <ToUOMID>7</ToUOMID>
87
+ <ToUOMCode>in</ToUOMCode>
88
+ <ConversionMultiply>12.0</ConversionMultiply>
89
+ <ConversionFactor>1.0</ConversionFactor>
90
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
91
+ </UOMConversion>
92
+ <UOMConversion>
93
+ <MainUOMID>2</MainUOMID>
94
+ <ToUOMID>9</ToUOMID>
95
+ <ToUOMCode>m</ToUOMCode>
96
+ <ConversionMultiply>1.0</ConversionMultiply>
97
+ <ConversionFactor>3.2808001041412354</ConversionFactor>
98
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
99
+ </UOMConversion>
100
+ </UOMConversions>
101
+ </UOM>
102
+ </SizeUOM>
103
+ <UPC/>
104
+ <PartTrackingList>
105
+ <PartTracking>
106
+ <PartTrackingID>4</PartTrackingID>
107
+ <Name>Serial Number</Name>
108
+ <Abbr>SN(s)</Abbr>
109
+ <Description/>
110
+ <SortOrder>4</SortOrder>
111
+ <TrackingTypeID>40</TrackingTypeID>
112
+ <Active>true</Active>
113
+ <Primary>true</Primary>
114
+ </PartTracking>
115
+ </PartTrackingList>
116
+ <VendorPartNums>
117
+ <VendorPartNumber>
118
+ <Number>BB2002</Number>
119
+ </VendorPartNumber>
120
+ <VendorPartNumber>
121
+ <Number>BB2002</Number>
122
+ </VendorPartNumber>
123
+ </VendorPartNums>
124
+ </Part>
125
+ <Description>Create BB2002</Description>
126
+ <Cost>$0.00</Cost>
127
+ <DateScheduled>2004-11-04T00:00:00</DateScheduled>
128
+ <InstructionNote/>
129
+ <InstructionURL/>
130
+ <QtyScrapped>0</QtyScrapped>
131
+ <QtyToFulfill>1</QtyToFulfill>
132
+ <QtyUsed>1</QtyUsed>
133
+ <DestLocation>
134
+ <Location>
135
+ <LocationID>10</LocationID>
136
+ <TypeID>70</TypeID>
137
+ <Name>Store Front</Name>
138
+ <Description>Point of Sale location</Description>
139
+ <CountedAsAvailable>true</CountedAsAvailable>
140
+ <Default>true</Default>
141
+ <Active>true</Active>
142
+ <Pickable>true</Pickable>
143
+ <Receivable>true</Receivable>
144
+ <LocationGroupID>1</LocationGroupID>
145
+ <LocationGroupName>SLC</LocationGroupName>
146
+ <SortOrder>10013</SortOrder>
147
+ <TagID>384</TagID>
148
+ <TagNumber>371</TagNumber>
149
+ </Location>
150
+ </DestLocation>
151
+ <UOM>
152
+ <UOMID>1</UOMID>
153
+ <Name>Each</Name>
154
+ <Code>ea</Code>
155
+ <Integral>true</Integral>
156
+ <Active>true</Active>
157
+ <Type>Count</Type>
158
+ <UOMConversions>
159
+ <UOMConversion>
160
+ <MainUOMID>1</MainUOMID>
161
+ <ToUOMID>17</ToUOMID>
162
+ <ToUOMCode>pr</ToUOMCode>
163
+ <ConversionMultiply>1.0</ConversionMultiply>
164
+ <ConversionFactor>2.0</ConversionFactor>
165
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
166
+ </UOMConversion>
167
+ <UOMConversion>
168
+ <MainUOMID>1</MainUOMID>
169
+ <ToUOMID>18</ToUOMID>
170
+ <ToUOMCode>pk</ToUOMCode>
171
+ <ConversionMultiply>1.0</ConversionMultiply>
172
+ <ConversionFactor>20.0</ConversionFactor>
173
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
174
+ </UOMConversion>
175
+ </UOMConversions>
176
+ </UOM>
177
+ <Tracking/>
178
+ <SortID>1</SortID>
179
+ </WOItem>
180
+ </WOItems>
181
+ <Cost>0</Cost>
182
+ <Location>
183
+ <Location>
184
+ <LocationID>9</LocationID>
185
+ <TypeID>80</TypeID>
186
+ <Name>Manufacturing</Name>
187
+ <Description>The place where things are Manufactured</Description>
188
+ <CountedAsAvailable>true</CountedAsAvailable>
189
+ <Default>true</Default>
190
+ <Active>true</Active>
191
+ <Pickable>true</Pickable>
192
+ <Receivable>true</Receivable>
193
+ <LocationGroupID>1</LocationGroupID>
194
+ <LocationGroupName>SLC</LocationGroupName>
195
+ <SortOrder>10004</SortOrder>
196
+ <TagID>383</TagID>
197
+ <TagNumber>370</TagNumber>
198
+ </Location>
199
+ </Location>
200
+ <LocationGroup>
201
+ <LocationGroup>
202
+ <LocationGroupID>1</LocationGroupID>
203
+ <LocationGroupName>SLC</LocationGroupName>
204
+ <DefaultQBClassID>2</DefaultQBClassID>
205
+ </LocationGroup>
206
+ </LocationGroup>
207
+ <Note/>
208
+ <StatusID>40</StatusID>
209
+ <QBClass>None</QBClass>
210
+ <QBClassID>1</QBClassID>
211
+ <QtyOrdered>1</QtyOrdered>
212
+ <QtyTarget>1</QtyTarget>
213
+ <DateCreated>2004-11-04T16:59:40</DateCreated>
214
+ <DateFinished>2004-11-04T17:01:07</DateFinished>
215
+ <DateLastModified>2004-11-04T17:01:07</DateLastModified>
216
+ <DateScheduled>2004-11-04T00:00:00</DateScheduled>
217
+ <DateStarted>2004-11-04T16:59:40</DateStarted>
218
+ <User>
219
+ <User>
220
+ <ID>1</ID>
221
+ <UserName>admin</UserName>
222
+ <FirstName>Administrator</FirstName>
223
+ <LastName>Administrator</LastName>
224
+ <Initials>ADM</Initials>
225
+ <Active>true</Active>
226
+ </User>
227
+ </User>
228
+ </WO>
@@ -0,0 +1,172 @@
1
+ <WOItem>
2
+ <ID>1</ID>
3
+ <MOItemID>2</MOItemID>
4
+ <TypeID>10</TypeID>
5
+ <Part>
6
+ <PartID>36</PartID>
7
+ <PartClassID>0</PartClassID>
8
+ <TypeID>10</TypeID>
9
+ <UOM>
10
+ <UOMID>1</UOMID>
11
+ <Name>Each</Name>
12
+ <Code>ea</Code>
13
+ <Integral>true</Integral>
14
+ <Active>true</Active>
15
+ <Type>Count</Type>
16
+ <UOMConversions>
17
+ <UOMConversion>
18
+ <MainUOMID>1</MainUOMID>
19
+ <ToUOMID>17</ToUOMID>
20
+ <ToUOMCode>pr</ToUOMCode>
21
+ <ConversionMultiply>1.0</ConversionMultiply>
22
+ <ConversionFactor>2.0</ConversionFactor>
23
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
24
+ </UOMConversion>
25
+ <UOMConversion>
26
+ <MainUOMID>1</MainUOMID>
27
+ <ToUOMID>18</ToUOMID>
28
+ <ToUOMCode>pk</ToUOMCode>
29
+ <ConversionMultiply>1.0</ConversionMultiply>
30
+ <ConversionFactor>20.0</ConversionFactor>
31
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
32
+ </UOMConversion>
33
+ </UOMConversions>
34
+ </UOM>
35
+ <Num>BB2002</Num>
36
+ <Description>Comfort Bike</Description>
37
+ <Details/>
38
+ <StandardCost>0</StandardCost>
39
+ <HasBOM>false</HasBOM>
40
+ <Configurable>false</Configurable>
41
+ <ActiveFlag>true</ActiveFlag>
42
+ <SerializedFlag>true</SerializedFlag>
43
+ <TrackingFlag>true</TrackingFlag>
44
+ <Weight>20</Weight>
45
+ <WeightUOM>
46
+ <UOM>
47
+ <UOMID>3</UOMID>
48
+ <Name>Pound</Name>
49
+ <Code>lbs</Code>
50
+ <Integral>false</Integral>
51
+ <Active>true</Active>
52
+ <Type>Weight</Type>
53
+ <UOMConversions>
54
+ <UOMConversion>
55
+ <MainUOMID>3</MainUOMID>
56
+ <ToUOMID>8</ToUOMID>
57
+ <ToUOMCode>kg</ToUOMCode>
58
+ <ConversionMultiply>1.0</ConversionMultiply>
59
+ <ConversionFactor>2.2046000957489014</ConversionFactor>
60
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
61
+ </UOMConversion>
62
+ </UOMConversions>
63
+ </UOM>
64
+ </WeightUOM>
65
+ <Width>0</Width>
66
+ <Height>0</Height>
67
+ <Len>0</Len>
68
+ <SizeUOM>
69
+ <UOM>
70
+ <UOMID>2</UOMID>
71
+ <Name>Foot</Name>
72
+ <Code>ft</Code>
73
+ <Integral>false</Integral>
74
+ <Active>true</Active>
75
+ <Type>Length</Type>
76
+ <UOMConversions>
77
+ <UOMConversion>
78
+ <MainUOMID>2</MainUOMID>
79
+ <ToUOMID>7</ToUOMID>
80
+ <ToUOMCode>in</ToUOMCode>
81
+ <ConversionMultiply>12.0</ConversionMultiply>
82
+ <ConversionFactor>1.0</ConversionFactor>
83
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
84
+ </UOMConversion>
85
+ <UOMConversion>
86
+ <MainUOMID>2</MainUOMID>
87
+ <ToUOMID>9</ToUOMID>
88
+ <ToUOMCode>m</ToUOMCode>
89
+ <ConversionMultiply>1.0</ConversionMultiply>
90
+ <ConversionFactor>3.2808001041412354</ConversionFactor>
91
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
92
+ </UOMConversion>
93
+ </UOMConversions>
94
+ </UOM>
95
+ </SizeUOM>
96
+ <UPC/>
97
+ <PartTrackingList>
98
+ <PartTracking>
99
+ <PartTrackingID>4</PartTrackingID>
100
+ <Name>Serial Number</Name>
101
+ <Abbr>SN(s)</Abbr>
102
+ <Description/>
103
+ <SortOrder>4</SortOrder>
104
+ <TrackingTypeID>40</TrackingTypeID>
105
+ <Active>true</Active>
106
+ <Primary>true</Primary>
107
+ </PartTracking>
108
+ </PartTrackingList>
109
+ <VendorPartNums>
110
+ <VendorPartNumber>
111
+ <Number>BB2002</Number>
112
+ </VendorPartNumber>
113
+ <VendorPartNumber>
114
+ <Number>BB2002</Number>
115
+ </VendorPartNumber>
116
+ </VendorPartNums>
117
+ </Part>
118
+ <Description>Create BB2002</Description>
119
+ <Cost>$0.00</Cost>
120
+ <DateScheduled>2004-11-04T00:00:00</DateScheduled>
121
+ <InstructionNote/>
122
+ <InstructionURL/>
123
+ <QtyScrapped>0</QtyScrapped>
124
+ <QtyToFulfill>1</QtyToFulfill>
125
+ <QtyUsed>1</QtyUsed>
126
+ <DestLocation>
127
+ <Location>
128
+ <LocationID>10</LocationID>
129
+ <TypeID>70</TypeID>
130
+ <Name>Store Front</Name>
131
+ <Description>Point of Sale location</Description>
132
+ <CountedAsAvailable>true</CountedAsAvailable>
133
+ <Default>true</Default>
134
+ <Active>true</Active>
135
+ <Pickable>true</Pickable>
136
+ <Receivable>true</Receivable>
137
+ <LocationGroupID>1</LocationGroupID>
138
+ <LocationGroupName>SLC</LocationGroupName>
139
+ <SortOrder>10013</SortOrder>
140
+ <TagID>384</TagID>
141
+ <TagNumber>371</TagNumber>
142
+ </Location>
143
+ </DestLocation>
144
+ <UOM>
145
+ <UOMID>1</UOMID>
146
+ <Name>Each</Name>
147
+ <Code>ea</Code>
148
+ <Integral>true</Integral>
149
+ <Active>true</Active>
150
+ <Type>Count</Type>
151
+ <UOMConversions>
152
+ <UOMConversion>
153
+ <MainUOMID>1</MainUOMID>
154
+ <ToUOMID>17</ToUOMID>
155
+ <ToUOMCode>pr</ToUOMCode>
156
+ <ConversionMultiply>1.0</ConversionMultiply>
157
+ <ConversionFactor>2.0</ConversionFactor>
158
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
159
+ </UOMConversion>
160
+ <UOMConversion>
161
+ <MainUOMID>1</MainUOMID>
162
+ <ToUOMID>18</ToUOMID>
163
+ <ToUOMCode>pk</ToUOMCode>
164
+ <ConversionMultiply>1.0</ConversionMultiply>
165
+ <ConversionFactor>20.0</ConversionFactor>
166
+ <ToUOMIsIntegral>false</ToUOMIsIntegral>
167
+ </UOMConversion>
168
+ </UOMConversions>
169
+ </UOM>
170
+ <Tracking/>
171
+ <SortID>1</SortID>
172
+ </WOItem>
@@ -14,6 +14,21 @@ describe Fishbowl::Objects::Account do
14
14
 
15
15
  let(:connection) { FakeTCPSocket.instance }
16
16
 
17
+ describe "instances" do
18
+
19
+ let(:account) {
20
+ doc = Nokogiri::XML.parse(example_file('account.xml'))
21
+ Fishbowl::Objects::Account.new(doc.xpath('//Account'))
22
+ }
23
+
24
+ it "should properly initialize from example file" do
25
+ account.name.should eq("Cost Variance")
26
+ account.accounting_id.should eq("8000001B-1310422643")
27
+ account.account_type.should eq("12")
28
+ account.balance.should eq("0")
29
+ end
30
+ end
31
+
17
32
  describe ".get_list" do
18
33
  let(:proper_request) do
19
34
  Nokogiri::XML::Builder.new do |xml|
@@ -26,41 +41,32 @@ describe Fishbowl::Objects::Account do
26
41
  end
27
42
  end
28
43
 
29
- let(:canned_response) do
30
-
31
- end
32
-
33
- it "should properly format the request" do
34
- Fishbowl::Objects::Account.get_list
35
- connection.last_write.should be_equivalent_to(proper_request.to_xml)
36
- end
37
-
38
- it "should return array of Accounts"
39
-
40
- it "should return empty array when no accounts" do
41
-
42
- end
43
- end
44
-
45
- describe ".get_balance" do
46
- let(:proper_request) do
47
- Nokogiri::XML::Builder.new do |xml|
48
- xml.FbiXml {
49
- xml.Ticket
50
- xml.FbiMsgsRq {
51
- xml.GetAccountBalanceRq {
52
- xml.Account "General Account"
53
- }
44
+ before :each do
45
+ canned_response = Nokogiri::XML::Builder.new do |xml|
46
+ xml.response {
47
+ xml.GetAccountListRs(statusCode: '1000', statusMessage: "Success!") {
48
+ (rand(3) + 2).times do |i|
49
+ xml.Account {
50
+ xml.Name "Demo Account #{i}"
51
+ xml.AccountingID "DEMO#{i}"
52
+ xml.AccountType i
53
+ xml.Balance "1200.00"
54
+ }
55
+ end
54
56
  }
55
57
  }
56
58
  end
59
+
60
+ mock_the_response(canned_response)
57
61
  end
58
62
 
59
63
  it "should properly format the request" do
60
- Fishbowl::Objects::Account.get_balance("General Account")
64
+ Fishbowl::Objects::Account.get_list
61
65
  connection.last_write.should be_equivalent_to(proper_request.to_xml)
62
66
  end
63
67
 
64
- it "should return the balance for the requested Account"
68
+ it "should return array of Accounts" do
69
+ Fishbowl::Objects::Account.get_list.should be_an(Array)
70
+ end
65
71
  end
66
72
  end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fishbowl::Objects::AddressInformation do
4
+ describe "instances" do
5
+
6
+ let(:address_info) {
7
+ doc = Nokogiri::XML.parse(example_file('address.xml'))
8
+ Fishbowl::Objects::AddressInformation.new(doc.xpath('//AddressInformation'))
9
+ }
10
+
11
+ it "should properly initialize from example file" do
12
+ address_info.name.should eq("Main Office")
13
+ address_info.data.should eq("Address Data")
14
+ address_info.default.should eq("true")
15
+ address_info.type.should eq("Home")
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fishbowl::Objects::Address do
4
+ before :each do
5
+ mock_tcp_connection
6
+ mock_login_response
7
+ Fishbowl::Connection.connect(host: 'localhost')
8
+ Fishbowl::Connection.login(username: 'johndoe', password: 'secret')
9
+ end
10
+
11
+ after :each do
12
+ unmock_tcp
13
+ end
14
+
15
+ let(:connection) { FakeTCPSocket.instance }
16
+
17
+ describe "instances" do
18
+
19
+ let(:address) {
20
+ doc = Nokogiri::XML.parse(example_file('address.xml'))
21
+ Fishbowl::Objects::Address.new(doc.xpath('//Address'))
22
+ }
23
+
24
+ it "should properly initialize from example file" do
25
+ address.name.should eq("Main Office")
26
+ address.attn.should eq("Attn")
27
+ address.street.should eq("123 Neverland dr.")
28
+
29
+ address.state.should be_a(Fishbowl::Objects::State)
30
+ address.country.should be_a(Fishbowl::Objects::Country)
31
+ address.address_information_list.should be_a(Array)
32
+ address.address_information_list.first.should be_a(Fishbowl::Objects::AddressInformation)
33
+ end
34
+ end
35
+ end
36
+
@@ -3,6 +3,7 @@ require 'spec_helper'
3
3
  describe Fishbowl::Objects::BaseObject do
4
4
  let(:ticket) { "thisisasample" }
5
5
  let(:base_object) { Fishbowl::Objects::BaseObject.new }
6
+ let(:connection) { FakeTCPSocket.instance }
6
7
 
7
8
  let(:empty_ticket_builder) do
8
9
  Nokogiri::XML::Builder.new do |xml|
@@ -10,7 +11,7 @@ describe Fishbowl::Objects::BaseObject do
10
11
  xml.Ticket
11
12
 
12
13
  xml.FbiMsgsRq {
13
- xml.SampleRequest
14
+ xml.SampleRq
14
15
  }
15
16
  }
16
17
  end
@@ -22,43 +23,86 @@ describe Fishbowl::Objects::BaseObject do
22
23
  xml.Ticket ticket
23
24
 
24
25
  xml.FbiMsgsRq {
25
- xml.SampleRequest
26
+ xml.SampleRq
26
27
  }
27
28
  }
28
29
  end
29
30
  end
30
31
 
31
- context "Protected Methods" do
32
- describe "#send_request" do
32
+ before :each do
33
+ mock_tcp_connection
34
+ mock_login_response
35
+ Fishbowl::Connection.connect(host: 'localhost')
36
+ Fishbowl::Connection.login(username: 'johndoe', password: 'secret')
37
+ end
33
38
 
34
- end
39
+ after :each do
40
+ unmock_tcp
35
41
  end
36
42
 
37
- context "Private Methods" do
38
- describe "#build_request" do
39
- it "should build a request document" do
40
- base_object.send(:build_request, "SampleRequest").to_xml.should be_equivalent_to(empty_ticket_builder.to_xml)
41
- end
43
+ describe "#send_request" do
44
+ before :each do
45
+ mock_the_response
46
+ end
42
47
 
43
- it "should accept an XML Builder" do
44
- builder = Nokogiri::XML::Builder.new { |xml| xml.request { xml.SampleRequest } }
45
- base_object.send(:build_request, builder, true).to_xml.should be_equivalent_to(empty_ticket_builder.to_xml)
46
- end
48
+ it "should include the ticket value when it's set" do
49
+ base_object.ticket = ticket
50
+ base_object.send_request("SampleRq", "SampleRs")
51
+ connection.last_write.should be_equivalent_to(ticket_builder.to_xml)
52
+ end
47
53
 
48
- context "when ticket is empty" do
49
- it "should return an empty Nokogiri::XML::Builder" do
50
- base_object.send(:build_request, "SampleRequest").to_xml.should be_equivalent_to(empty_ticket_builder.to_xml)
51
- end
54
+ it "should send the specified request" do
55
+ base_object.send_request("SampleRq", "SampleRs")
56
+ connection.last_write.should be_equivalent_to(empty_ticket_builder.to_xml)
57
+ end
58
+
59
+ it "should get the expected response" do
60
+ code, message, response = base_object.send_request("SampleRq", "SampleRs")
61
+
62
+ code.should_not be_nil
63
+ message.should_not be_nil
64
+ response.should be_equivalent_to(mock_response.to_xml)
65
+ end
66
+ end
67
+
68
+ context "Protected Methods" do
69
+ describe ".attributes" do
70
+ it "should return an array containing 'ID' by default" do
71
+ Fishbowl::Objects::BaseObject.attributes.should eq(["ID"])
52
72
  end
73
+ end
53
74
 
54
- context "when ticket is set" do
55
- before :each do
56
- base_object.ticket = ticket
75
+ describe "#parse_attributes" do
76
+ it "should parse the requested attributes from the supplied xml" do
77
+ parse_xml = Nokogiri::XML::Builder.new do |xml|
78
+ xml.parse {
79
+ xml.ID "5"
80
+ xml.DataID "15"
81
+ xml.Name "Demo"
82
+ xml.SKU "DEMO"
83
+ }
57
84
  end
85
+ parse_xml = Nokogiri::XML.parse(parse_xml.to_xml)
58
86
 
59
- it "should return the ticket wrapped in a Nokogiri::XML::Builder" do
60
- base_object.send(:build_request, "SampleRequest").to_xml.should be_equivalent_to(ticket_builder.to_xml)
87
+ class Fishbowl::Objects::BaseObject
88
+ def self.attributes
89
+ %w{ID DataID Name SKU}
90
+ end
61
91
  end
92
+
93
+ base_object.instance_variable_set("@xml", parse_xml.xpath('parse'))
94
+
95
+ base_object.send(:parse_attributes)
96
+
97
+ base_object.instance_variables.should include(:@db_id)
98
+ base_object.instance_variables.should include(:@data_id)
99
+ base_object.instance_variables.should include(:@name)
100
+ base_object.instance_variables.should include(:@sku)
101
+
102
+ base_object.instance_variable_get(:@db_id).should eq("5")
103
+ base_object.instance_variable_get(:@data_id).should eq("15")
104
+ base_object.instance_variable_get(:@name).should eq("Demo")
105
+ base_object.instance_variable_get(:@sku).should eq("DEMO")
62
106
  end
63
107
  end
64
108
  end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fishbowl::Objects::Carrier do
4
+ describe "instances" do
5
+
6
+ let(:carrier) {
7
+ doc = Nokogiri::XML.parse(example_file('carrier.xml'))
8
+ Fishbowl::Objects::Carrier.new(doc.xpath('//Carrier'))
9
+ }
10
+
11
+ it "should properly initialize from example file" do
12
+ carrier.name.should eq("Will Call")
13
+ end
14
+ end
15
+ end