bws 0.2.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +36 -0
- data/LICENSE +20 -0
- data/README.rdoc +116 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/bws.gemspec +133 -0
- data/lib/bws.rb +13 -0
- data/lib/bws/acknowledge_order.rb +11 -0
- data/lib/bws/active_isbn_report.rb +27 -0
- data/lib/bws/checkout.rb +30 -0
- data/lib/bws/client.rb +807 -0
- data/lib/bws/create_shipment.rb +11 -0
- data/lib/bws/fillable_orders.rb +15 -0
- data/lib/bws/inventory.rb +58 -0
- data/lib/bws/order.rb +10 -0
- data/lib/bws/order_events.rb +28 -0
- data/lib/bws/orders.rb +14 -0
- data/lib/bws/reject_line_item.rb +11 -0
- data/lib/bws/response.rb +8 -0
- data/lib/bws/unacknowledged_orders.rb +23 -0
- data/test/fixtures/acknowledge_success.xml +11 -0
- data/test/fixtures/active_isbn_report_with_one_isbn_request_body.xml +13 -0
- data/test/fixtures/active_isbn_report_with_one_isbn_success.xml +38 -0
- data/test/fixtures/active_isbn_report_with_two_isbns_request_body.xml +16 -0
- data/test/fixtures/active_isbn_report_with_two_isbns_success.xml +57 -0
- data/test/fixtures/cancel_line_item_success.xml +11 -0
- data/test/fixtures/create_order_request_body.xml +70 -0
- data/test/fixtures/create_order_response_success.xml +14 -0
- data/test/fixtures/create_shipment_success.xml +11 -0
- data/test/fixtures/fillable_success.xml +127 -0
- data/test/fixtures/inventory_by_isbn_success.xml +36 -0
- data/test/fixtures/inventory_success.xml +54 -0
- data/test/fixtures/order_events_by_order_success.xml +68 -0
- data/test/fixtures/order_events_success.xml +65 -0
- data/test/fixtures/order_success.xml +37 -0
- data/test/fixtures/orders_show_success.xml +37 -0
- data/test/fixtures/price_order_request_body.xml +46 -0
- data/test/fixtures/price_order_response_success.xml +63 -0
- data/test/fixtures/single_post_create_order_request_body.xml +62 -0
- data/test/fixtures/single_post_create_order_response_success.xml +13 -0
- data/test/fixtures/unacknowledged_success.xml +122 -0
- data/test/fixtures/unacknowledged_success_0_orders.xml +12 -0
- data/test/fixtures/unacknowledged_success_1_order.xml +37 -0
- data/test/fixtures/validate_credit_card_request_body.xml +39 -0
- data/test/fixtures/validate_credit_card_response_success.xml +14 -0
- data/test/helper.rb +23 -0
- data/test/integration/test_bws_active_isbn_report.rb +28 -0
- data/test/integration/test_bws_retrieve_inventory.rb +31 -0
- data/test/unit/test_bws_acknowledge_order.rb +24 -0
- data/test/unit/test_bws_active_isbn_report.rb +45 -0
- data/test/unit/test_bws_checkout.rb +117 -0
- data/test/unit/test_bws_client.rb +370 -0
- data/test/unit/test_bws_create_shipment.rb +26 -0
- data/test/unit/test_bws_fillable_orders.rb +41 -0
- data/test/unit/test_bws_order.rb +25 -0
- data/test/unit/test_bws_reject_line_item.rb +26 -0
- data/test/unit/test_bws_response.rb +7 -0
- data/test/unit/test_bws_retrieve_inventory.rb +42 -0
- data/test/unit/test_bws_retrieve_inventory_by_isbn.rb +25 -0
- data/test/unit/test_bws_retrieve_order_events.rb +42 -0
- data/test/unit/test_bws_retrieve_order_events_by_order.rb +37 -0
- data/test/unit/test_bws_unacknowledged_orders.rb +74 -0
- data/test/unit/test_retrieve_orders_show.rb +27 -0
- metadata +293 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<envelope>
|
3
|
+
<header>
|
4
|
+
<response_id>1281477072_95</response_id>
|
5
|
+
</header>
|
6
|
+
<body>
|
7
|
+
<checkout_price_order>
|
8
|
+
<checkout_verification_code>Z1iZdUNpn7h1C2uB35gwh6nquO6</checkout_verification_code>
|
9
|
+
<customer>
|
10
|
+
<customer_verification_code>BY09yczUUlNOcOxog84ewyblsoX</customer_verification_code>
|
11
|
+
</customer>
|
12
|
+
<product_list>
|
13
|
+
<product_list_verification_code>Bc7Thhh8Kxz001LAR8SrKb2vYDX</product_list_verification_code>
|
14
|
+
<subtotal_cents>15314</subtotal_cents>
|
15
|
+
<subtotal_tax_cents>0</subtotal_tax_cents>
|
16
|
+
<products>
|
17
|
+
<product>
|
18
|
+
<product_id>9780006552192</product_id>
|
19
|
+
<product_type>book</product_type>
|
20
|
+
<quantity>2</quantity>
|
21
|
+
<rental_period>90</rental_period>
|
22
|
+
<price_cents>4916</price_cents>
|
23
|
+
<retail_price_cents>9395</retail_price_cents>
|
24
|
+
</product>
|
25
|
+
<product>
|
26
|
+
<product_id>9780007138210</product_id>
|
27
|
+
<product_type>book</product_type>
|
28
|
+
<quantity>1</quantity>
|
29
|
+
<rental_period>90</rental_period>
|
30
|
+
<price_cents>5482</price_cents>
|
31
|
+
<retail_price_cents>9900</retail_price_cents>
|
32
|
+
</product>
|
33
|
+
</products>
|
34
|
+
</product_list>
|
35
|
+
<billing_address>
|
36
|
+
<billing_address_verification_code>T0xuZlf9TdeWEbhESG8vQ9jvUly</billing_address_verification_code>
|
37
|
+
</billing_address>
|
38
|
+
<shipping_address>
|
39
|
+
<shipping_address_verification_code>PqEKARN4JLeJ35BMtNg5A2FUHS0</shipping_address_verification_code>
|
40
|
+
</shipping_address>
|
41
|
+
<shipping_options>
|
42
|
+
<shipping_option>
|
43
|
+
<shipping_option_verification_code>OxfBErWqBBkJmZfgD1CJmO7iDU1</shipping_option_verification_code>
|
44
|
+
<method_name>Ground</method_name>
|
45
|
+
<shipping_price_cents>599</shipping_price_cents>
|
46
|
+
<tax_cost_cents>0</tax_cost_cents>
|
47
|
+
</shipping_option>
|
48
|
+
<shipping_option>
|
49
|
+
<shipping_option_verification_code>1F54wiPKHTBjBi9IidMGcvAOL9d</shipping_option_verification_code>
|
50
|
+
<method_name>Second Day</method_name>
|
51
|
+
<shipping_price_cents>1997</shipping_price_cents>
|
52
|
+
<tax_cost_cents>0</tax_cost_cents>
|
53
|
+
</shipping_option>
|
54
|
+
<shipping_option>
|
55
|
+
<shipping_option_verification_code>6elDKQHvyMVr8FTmTHRuekQb39c</shipping_option_verification_code>
|
56
|
+
<method_name>Next Day</method_name>
|
57
|
+
<shipping_price_cents>3397</shipping_price_cents>
|
58
|
+
<tax_cost_cents>0</tax_cost_cents>
|
59
|
+
</shipping_option>
|
60
|
+
</shipping_options>
|
61
|
+
</checkout_price_order>
|
62
|
+
</body>
|
63
|
+
</envelope>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<checkout_single_post_create_order>
|
2
|
+
<charge_amount_cents>10383</charge_amount_cents>
|
3
|
+
<external_order_id>BOOK-INC-ORDER-1234567</external_order_id>
|
4
|
+
<customer>
|
5
|
+
<email>dorothea@toydurgan.us</email>
|
6
|
+
<external_user_id>6370931058</external_user_id>
|
7
|
+
</customer>
|
8
|
+
<product_list>
|
9
|
+
<subtotal_cents>9222</subtotal_cents>
|
10
|
+
<subtotal_tax_cents>762</subtotal_tax_cents>
|
11
|
+
<products>
|
12
|
+
<product>
|
13
|
+
<product_id>9780006552192</product_id>
|
14
|
+
<product_type>book</product_type>
|
15
|
+
<quantity>2</quantity>
|
16
|
+
<rental_period>90</rental_period>
|
17
|
+
<rental_due_date>2011-10-12T23:59:59Z</rental_due_date>
|
18
|
+
<external_line_item_ids>
|
19
|
+
<external_line_item_id>BOOK-INC-LINE-ITEM-123001</external_line_item_id>
|
20
|
+
<external_line_item_id>BOOK-INC-LINE-ITEM-123002</external_line_item_id>
|
21
|
+
</external_line_item_ids>
|
22
|
+
<price_cents>2153</price_cents>
|
23
|
+
</product>
|
24
|
+
<product>
|
25
|
+
<product_id>9780007138210</product_id>
|
26
|
+
<product_type>book</product_type>
|
27
|
+
<quantity>1</quantity>
|
28
|
+
<rental_period>90</rental_period>
|
29
|
+
<rental_due_date>2011-10-12T23:59:59Z</rental_due_date>
|
30
|
+
<external_line_item_ids>
|
31
|
+
<external_line_item_id>BOOK-INC-LINE-ITEM-123003</external_line_item_id>
|
32
|
+
</external_line_item_ids>
|
33
|
+
<price_cents>4916</price_cents>
|
34
|
+
</product>
|
35
|
+
</products>
|
36
|
+
</product_list>
|
37
|
+
<billing_address>
|
38
|
+
<first_name>Rhiannon</first_name>
|
39
|
+
<last_name>Okuneva</last_name>
|
40
|
+
<street_address>31189 ZackRapid</street_address>
|
41
|
+
<street_address_2></street_address_2>
|
42
|
+
<city>Lake Jedediah</city>
|
43
|
+
<state>TX</state>
|
44
|
+
<zip>83492-3353</zip>
|
45
|
+
<country>USA</country>
|
46
|
+
</billing_address>
|
47
|
+
<shipping_address>
|
48
|
+
<first_name>Rhiannon</first_name>
|
49
|
+
<last_name>Okuneva</last_name>
|
50
|
+
<street_address>31189 ZackRapid</street_address>
|
51
|
+
<street_address_2></street_address_2>
|
52
|
+
<city>Lake Jedediah</city>
|
53
|
+
<state>TX</state>
|
54
|
+
<zip>83492-3353</zip>
|
55
|
+
<country>USA</country>
|
56
|
+
</shipping_address>
|
57
|
+
<shipping_option>
|
58
|
+
<method_name>Ground</method_name>
|
59
|
+
<shipping_price_cents>399</shipping_price_cents>
|
60
|
+
<tax_cost_cents>0</tax_cost_cents>
|
61
|
+
</shipping_option>
|
62
|
+
</checkout_single_post_create_order>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<envelope>
|
3
|
+
<header>
|
4
|
+
<response_id>1281477072_95</response_id>
|
5
|
+
</header>
|
6
|
+
<body>
|
7
|
+
<checkout_single_post_create_order>
|
8
|
+
<order>
|
9
|
+
<public_id>BR-D69A780BA</public_id>
|
10
|
+
</order>
|
11
|
+
</checkout_single_post_create_order>
|
12
|
+
</body>
|
13
|
+
</envelope>
|
@@ -0,0 +1,122 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<envelope>
|
3
|
+
<header>
|
4
|
+
<response_id>1281464852_43</response_id>
|
5
|
+
</header>
|
6
|
+
<body>
|
7
|
+
<distributor_orders_unacknowledged>
|
8
|
+
<distributor_orders total_pages="1" page="1">
|
9
|
+
<distributor_order>
|
10
|
+
<public_id>BR-A07367256</public_id>
|
11
|
+
|
12
|
+
<offered_at>2010-08-10T17:37:20Z</offered_at>
|
13
|
+
<ordered_at>2010-08-10T17:37:18Z</ordered_at>
|
14
|
+
<shipping_method>Ground</shipping_method>
|
15
|
+
<shipping_first_name>Roger</shipping_first_name>
|
16
|
+
<shipping_last_name>Smith</shipping_last_name>
|
17
|
+
<shipping_street_address>123 Test St.</shipping_street_address>
|
18
|
+
|
19
|
+
<shipping_city>Santa Clara</shipping_city>
|
20
|
+
<shipping_state>CA</shipping_state>
|
21
|
+
<shipping_zip>95054</shipping_zip>
|
22
|
+
<distributor_line_items>
|
23
|
+
<distributor_line_item>
|
24
|
+
<public_id>3D7BD4EB9</public_id>
|
25
|
+
<title>Understanding Nuclear Engineering Theory and Practice for Dummies</title>
|
26
|
+
|
27
|
+
<status>unacknowledged</status>
|
28
|
+
<inventory_type>BookRenterInventory</inventory_type>
|
29
|
+
<inventory_sku>X0001234</inventory_sku>
|
30
|
+
<inventory_isbn>9780077377489</inventory_isbn>
|
31
|
+
</distributor_line_item>
|
32
|
+
</distributor_line_items>
|
33
|
+
</distributor_order>
|
34
|
+
<distributor_order>
|
35
|
+
|
36
|
+
<public_id>BR-A04221177</public_id>
|
37
|
+
<offered_at>2010-08-10T17:37:24Z</offered_at>
|
38
|
+
<ordered_at>2010-08-10T17:37:21Z</ordered_at>
|
39
|
+
<shipping_method>Ground</shipping_method>
|
40
|
+
<shipping_first_name>Roger</shipping_first_name>
|
41
|
+
<shipping_last_name>Smith</shipping_last_name>
|
42
|
+
|
43
|
+
<shipping_street_address>123 Test St.</shipping_street_address>
|
44
|
+
<shipping_city>Santa Clara</shipping_city>
|
45
|
+
<shipping_state>CA</shipping_state>
|
46
|
+
<shipping_zip>95054</shipping_zip>
|
47
|
+
<distributor_line_items>
|
48
|
+
<distributor_line_item>
|
49
|
+
<public_id>16CB5B7ED</public_id>
|
50
|
+
|
51
|
+
<title>Understanding Animal and Veterinary Sciences Through the Ages for Students</title>
|
52
|
+
<status>unacknowledged</status>
|
53
|
+
<inventory_type>BookRenterInventory</inventory_type>
|
54
|
+
<inventory_sku>X0001234</inventory_sku>
|
55
|
+
<inventory_isbn>9780077377489</inventory_isbn>
|
56
|
+
</distributor_line_item>
|
57
|
+
</distributor_line_items>
|
58
|
+
|
59
|
+
</distributor_order>
|
60
|
+
<distributor_order>
|
61
|
+
<public_id>BR-A06991107</public_id>
|
62
|
+
<offered_at>2010-08-10T17:37:28Z</offered_at>
|
63
|
+
<ordered_at>2010-08-10T17:37:25Z</ordered_at>
|
64
|
+
<shipping_method>Ground</shipping_method>
|
65
|
+
<shipping_first_name>Roger</shipping_first_name>
|
66
|
+
|
67
|
+
<shipping_last_name>Smith</shipping_last_name>
|
68
|
+
<shipping_street_address>123 Test St.</shipping_street_address>
|
69
|
+
<shipping_city>Santa Clara</shipping_city>
|
70
|
+
<shipping_state>CA</shipping_state>
|
71
|
+
<shipping_zip>95054</shipping_zip>
|
72
|
+
<distributor_line_items>
|
73
|
+
|
74
|
+
<distributor_line_item>
|
75
|
+
<public_id>035A5F938</public_id>
|
76
|
+
<title>Peace Studies</title>
|
77
|
+
<status>unacknowledged</status>
|
78
|
+
<inventory_type>BookRenterInventory</inventory_type>
|
79
|
+
<inventory_sku>X0001234</inventory_sku>
|
80
|
+
<inventory_isbn>9780077377489</inventory_isbn>
|
81
|
+
|
82
|
+
</distributor_line_item>
|
83
|
+
</distributor_line_items>
|
84
|
+
</distributor_order>
|
85
|
+
<distributor_order>
|
86
|
+
<public_id>BR-A06307142</public_id>
|
87
|
+
<offered_at>2010-08-10T17:37:34Z</offered_at>
|
88
|
+
<ordered_at>2010-08-10T17:37:30Z</ordered_at>
|
89
|
+
<shipping_method>Ground</shipping_method>
|
90
|
+
|
91
|
+
<shipping_first_name>Roger</shipping_first_name>
|
92
|
+
<shipping_last_name>Smith</shipping_last_name>
|
93
|
+
<shipping_street_address>123 Test St.</shipping_street_address>
|
94
|
+
<shipping_city>Santa Clara</shipping_city>
|
95
|
+
<shipping_state>CA</shipping_state>
|
96
|
+
<shipping_zip>95054</shipping_zip>
|
97
|
+
|
98
|
+
<distributor_line_items>
|
99
|
+
<distributor_line_item>
|
100
|
+
<public_id>CB0D67214</public_id>
|
101
|
+
<title>International Scientific Method Through the Ages for Dummies</title>
|
102
|
+
<status>unacknowledged</status>
|
103
|
+
<inventory_type>BookRenterInventory</inventory_type>
|
104
|
+
<inventory_sku>X0001234</inventory_sku>
|
105
|
+
|
106
|
+
<inventory_isbn>9780077377489</inventory_isbn>
|
107
|
+
</distributor_line_item>
|
108
|
+
<distributor_line_item>
|
109
|
+
<public_id>689873B4B</public_id>
|
110
|
+
<title>Understanding Computer Engineering Theory and Practice</title>
|
111
|
+
<status>unacknowledged</status>
|
112
|
+
<inventory_type>BookRenterInventory</inventory_type>
|
113
|
+
|
114
|
+
<inventory_sku>X0001234</inventory_sku>
|
115
|
+
<inventory_isbn>9780077377489</inventory_isbn>
|
116
|
+
</distributor_line_item>
|
117
|
+
</distributor_line_items>
|
118
|
+
</distributor_order>
|
119
|
+
</distributor_orders>
|
120
|
+
</distributor_orders_unacknowledged>
|
121
|
+
</body>
|
122
|
+
</envelope>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<envelope>
|
3
|
+
<header>
|
4
|
+
<response_id>1281464852_43</response_id>
|
5
|
+
</header>
|
6
|
+
<body>
|
7
|
+
<distributor_orders_unacknowledged>
|
8
|
+
<distributor_orders total_pages="0" page="1">
|
9
|
+
</distributor_orders>
|
10
|
+
</distributor_orders_unacknowledged>
|
11
|
+
</body>
|
12
|
+
</envelope>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<envelope>
|
3
|
+
<header>
|
4
|
+
<response_id>1281464852_43</response_id>
|
5
|
+
</header>
|
6
|
+
<body>
|
7
|
+
<distributor_orders_unacknowledged>
|
8
|
+
<distributor_orders total_pages="1" page="1">
|
9
|
+
<distributor_order>
|
10
|
+
<public_id>BR-A07367256</public_id>
|
11
|
+
|
12
|
+
<offered_at>2010-08-10T17:37:20Z</offered_at>
|
13
|
+
<ordered_at>2010-08-10T17:37:18Z</ordered_at>
|
14
|
+
<shipping_method>Ground</shipping_method>
|
15
|
+
<shipping_first_name>Roger</shipping_first_name>
|
16
|
+
<shipping_last_name>Smith</shipping_last_name>
|
17
|
+
<shipping_street_address>123 Test St.</shipping_street_address>
|
18
|
+
|
19
|
+
<shipping_city>Santa Clara</shipping_city>
|
20
|
+
<shipping_state>CA</shipping_state>
|
21
|
+
<shipping_zip>95054</shipping_zip>
|
22
|
+
<distributor_line_items>
|
23
|
+
<distributor_line_item>
|
24
|
+
<public_id>3D7BD4EB9</public_id>
|
25
|
+
<title>Understanding Nuclear Engineering Theory and Practice for Dummies</title>
|
26
|
+
|
27
|
+
<status>unacknowledged</status>
|
28
|
+
<inventory_type>BookRenterInventory</inventory_type>
|
29
|
+
<inventory_sku>X0001234</inventory_sku>
|
30
|
+
<inventory_isbn>9780077377489</inventory_isbn>
|
31
|
+
</distributor_line_item>
|
32
|
+
</distributor_line_items>
|
33
|
+
</distributor_order>
|
34
|
+
</distributor_orders>
|
35
|
+
</distributor_orders_unacknowledged>
|
36
|
+
</body>
|
37
|
+
</envelope>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<checkout_validate_credit_card>
|
2
|
+
<checkout_verification_code>97QmSKDrAWIeyv0tdUG8mZjm0hU</checkout_verification_code>
|
3
|
+
<product_list>
|
4
|
+
<product_list_verification_code>IrZm1tVf4XboWXIVh0TQSgq2qjP</product_list_verification_code>
|
5
|
+
<segment>SEGMENT</segment>
|
6
|
+
<products>
|
7
|
+
<product>
|
8
|
+
<product_id>9780006552192</product_id>
|
9
|
+
<product_type>book</product_type>
|
10
|
+
<quantity>2</quantity>
|
11
|
+
<rental_period>90</rental_period>
|
12
|
+
</product>
|
13
|
+
<product>
|
14
|
+
<product_id>9780007138210</product_id>
|
15
|
+
<product_type>book</product_type>
|
16
|
+
<quantity>1</quantity>
|
17
|
+
<rental_period>90</rental_period>
|
18
|
+
</product>
|
19
|
+
</products>
|
20
|
+
</product_list>
|
21
|
+
<billing_address>
|
22
|
+
<billing_address_verification_code>WxcS0a0ch7dfkNbOhY0k58BMKCE</billing_address_verification_code>
|
23
|
+
<first_name>Simone</first_name>
|
24
|
+
<last_name>Towne</last_name>
|
25
|
+
<street_address>56879 TillmanCircles</street_address>
|
26
|
+
<street_address_2></street_address_2>
|
27
|
+
<city>New Al</city>
|
28
|
+
<state>NY</state>
|
29
|
+
<zip>36266</zip>
|
30
|
+
<country>USA</country>
|
31
|
+
</billing_address>
|
32
|
+
<credit_card>
|
33
|
+
<number>4111 1111 1111 1111</number>
|
34
|
+
<month>12</month>
|
35
|
+
<year>2011</year>
|
36
|
+
<verification_value>123</verification_value>
|
37
|
+
<type>visa</type>
|
38
|
+
</credit_card>
|
39
|
+
</checkout_validate_credit_card>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<envelope>
|
3
|
+
<header>
|
4
|
+
<response_id>1281477072_95</response_id>
|
5
|
+
</header>
|
6
|
+
<body>
|
7
|
+
<checkout_validate_credit_card>
|
8
|
+
<checkout_verification_code>97QmSKDrAWIeyv0tdUG8mZjm0hU</checkout_verification_code>
|
9
|
+
<credit_card>
|
10
|
+
<credit_card_verification_code>FJz1jpxHrGDRm7bQHVKd6kTsL6y</credit_card_verification_code>
|
11
|
+
</credit_card>
|
12
|
+
</checkout_validate_credit_card>
|
13
|
+
</body>
|
14
|
+
</envelope>
|
data/test/helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'shoulda'
|
4
|
+
require 'mocha'
|
5
|
+
require 'fakeweb'
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
8
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
9
|
+
require 'bws'
|
10
|
+
|
11
|
+
class Test::Unit::TestCase
|
12
|
+
def fake_get(url, response_file_name)
|
13
|
+
body = File.read(File.join(File.dirname(__FILE__), 'fixtures', response_file_name))
|
14
|
+
FakeWeb.register_uri(:get, url, :body => body, :content_type => 'application/xml')
|
15
|
+
end
|
16
|
+
|
17
|
+
def fake_post(url, response_file_name)
|
18
|
+
body = File.read(File.join(File.dirname(__FILE__), 'fixtures', response_file_name))
|
19
|
+
FakeWeb.register_uri(:post, url, :body => body, :content_type => 'application/xml')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'active_support/core_ext'
|
3
|
+
|
4
|
+
class TestBwsActiveIsbnReport < Test::Unit::TestCase
|
5
|
+
|
6
|
+
context "making real calls" do
|
7
|
+
setup do
|
8
|
+
@key = '6PizjaluOu9uVbnUaeak'
|
9
|
+
@uri = 'https://bws.demo.bookrenter.com/v1'
|
10
|
+
@client = BWS::Client.new(@key, @uri)
|
11
|
+
FakeWeb.allow_net_connect = true
|
12
|
+
end
|
13
|
+
|
14
|
+
def teardown
|
15
|
+
FakeWeb.allow_net_connect = false
|
16
|
+
end
|
17
|
+
|
18
|
+
context "active isbn report" do
|
19
|
+
should "be an BWS::ActiveIsbnReport object" do
|
20
|
+
@active_isbn_report_request_body_xml = File.read(File.join(File.dirname(__FILE__), '../fixtures', "active_isbn_report_with_one_isbn_request_body.xml"))
|
21
|
+
@active_isbn_report_hash = Hash.from_xml(@active_isbn_report_request_body_xml)["reports_active_isbn_report"]
|
22
|
+
|
23
|
+
@response = @client.retrieve_active_isbn_report(@active_isbn_report_hash)
|
24
|
+
assert @response.instance_of?(BWS::ActiveIsbnReport)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestBwsRetrieveInventory < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context "making real calls" do
|
6
|
+
setup do
|
7
|
+
@key = '6PizjaluOu9uVbnUaeak'
|
8
|
+
@uri = 'https://bws.demo.bookrenter.com/v1'
|
9
|
+
@client = BWS::Client.new(@key, @uri)
|
10
|
+
FakeWeb.allow_net_connect = true
|
11
|
+
end
|
12
|
+
|
13
|
+
def teardown
|
14
|
+
FakeWeb.allow_net_connect = false
|
15
|
+
end
|
16
|
+
|
17
|
+
context "retrieve inventory" do
|
18
|
+
should "be an BWS::Inventory object" do
|
19
|
+
@response = @client.retrieve_inventory(nil, nil, "1", "1")
|
20
|
+
assert @response.instance_of?(BWS::Inventory)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "retrieve order events" do
|
25
|
+
should "be an BWS::OrderEvents object" do
|
26
|
+
@response = @client.retrieve_order_events(nil, nil, nil, "1", "1")
|
27
|
+
assert @response.instance_of?(BWS::OrderEvents)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|