kounta_rest 0.1.7 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +67 -36
- data/lib/kounta/address.rb +14 -17
- data/lib/kounta/break.rb +6 -0
- data/lib/kounta/category.rb +12 -15
- data/lib/kounta/company.rb +59 -50
- data/lib/kounta/customer.rb +33 -32
- data/lib/kounta/errors.rb +8 -7
- data/lib/kounta/inventory.rb +5 -7
- data/lib/kounta/line.rb +18 -21
- data/lib/kounta/order.rb +45 -49
- data/lib/kounta/payment.rb +14 -17
- data/lib/kounta/person.rb +21 -24
- data/lib/kounta/price_list.rb +7 -9
- data/lib/kounta/product.rb +25 -27
- data/lib/kounta/register.rb +11 -14
- data/lib/kounta/resource.rb +105 -93
- data/lib/kounta/rest/client.rb +177 -79
- data/lib/kounta/shift.rb +25 -0
- data/lib/kounta/site.rb +46 -38
- data/lib/kounta/staff.rb +30 -0
- data/lib/kounta/tax.rb +7 -9
- data/lib/kounta/version.rb +1 -1
- data/lib/kounta/webhook.rb +16 -0
- data/lib/kounta.rb +42 -72
- metadata +77 -145
- data/.gitignore +0 -20
- data/.gitmodules +0 -3
- data/Gemfile +0 -4
- data/Rakefile +0 -1
- data/console.rb +0 -14
- data/kounta.gemspec +0 -33
- data/spec/fixtures/address.json +0 -12
- data/spec/fixtures/addresses.json +0 -25
- data/spec/fixtures/base_price_list.json +0 -52
- data/spec/fixtures/categories.json +0 -217
- data/spec/fixtures/category.json +0 -11
- data/spec/fixtures/companies_me.json +0 -45
- data/spec/fixtures/customer.json +0 -39
- data/spec/fixtures/customers.json +0 -26
- data/spec/fixtures/inventory.json +0 -10
- data/spec/fixtures/line.json +0 -7
- data/spec/fixtures/order.json +0 -67
- data/spec/fixtures/orders.json +0 -134
- data/spec/fixtures/payment.json +0 -6
- data/spec/fixtures/people.json +0 -20
- data/spec/fixtures/person.json +0 -41
- data/spec/fixtures/price_list.json +0 -52
- data/spec/fixtures/price_lists.json +0 -12
- data/spec/fixtures/product.json +0 -25
- data/spec/fixtures/products.json +0 -119
- data/spec/fixtures/site.json +0 -6
- data/spec/fixtures/sites.json +0 -14
- data/spec/fixtures/tax.json +0 -7
- data/spec/fixtures/taxes.json +0 -16
- data/spec/helper.rb +0 -28
- data/spec/kounta/address_spec.rb +0 -11
- data/spec/kounta/category_spec.rb +0 -11
- data/spec/kounta/company_spec.rb +0 -24
- data/spec/kounta/customer_spec.rb +0 -15
- data/spec/kounta/kounta_spec.rb +0 -21
- data/spec/kounta/line_spec.rb +0 -14
- data/spec/kounta/order_spec.rb +0 -37
- data/spec/kounta/payment_spec.rb +0 -14
- data/spec/kounta/person_spec.rb +0 -15
- data/spec/kounta/product_spec.rb +0 -16
- data/spec/kounta/resource_spec.rb +0 -95
- data/spec/kounta/rest/client_spec.rb +0 -38
- data/spec/kounta/site_spec.rb +0 -11
- data/spec/support/endpoints.rb +0 -72
data/spec/fixtures/orders.json
DELETED
@@ -1,134 +0,0 @@
|
|
1
|
-
[
|
2
|
-
{
|
3
|
-
"id": 912387093,
|
4
|
-
"company_id": 162,
|
5
|
-
"status": "PENDING",
|
6
|
-
"total": 45.65,
|
7
|
-
"paid": 0,
|
8
|
-
"notes": "Take away, gold member",
|
9
|
-
"created_at": "2013-06-02T14:22:08+10:00",
|
10
|
-
"updated_at": "2013-06-02T14:22:08+10:00",
|
11
|
-
"placed_at": "2013-05-29T11:14:06+10:00",
|
12
|
-
"fulfil_at": "2013-05-29T13:00:00+10:00",
|
13
|
-
"customer": {
|
14
|
-
"id": 389426,
|
15
|
-
"first_name": "Lucy",
|
16
|
-
"last_name": "Lavender",
|
17
|
-
"email": "lucy@kounta.com",
|
18
|
-
"image": "http://www.gravatar.com/avatar/cb9532c3d6f3f835d2253b5fcaa68340.jpg"
|
19
|
-
},
|
20
|
-
"lines": [
|
21
|
-
{
|
22
|
-
"id": 37864193203,
|
23
|
-
"number": 1,
|
24
|
-
"product": {
|
25
|
-
"id": 7302,
|
26
|
-
"name": "Caffé Latte"
|
27
|
-
},
|
28
|
-
"quantity": 6,
|
29
|
-
"notes": "Extra sugar please",
|
30
|
-
"unit_price": 1.36,
|
31
|
-
"unit_tax": 0.14
|
32
|
-
},
|
33
|
-
{
|
34
|
-
"id": 37864193204,
|
35
|
-
"number": 2,
|
36
|
-
"product": {
|
37
|
-
"id": 5312,
|
38
|
-
"name": "Salmon Sandwich"
|
39
|
-
},
|
40
|
-
"quantity": 1,
|
41
|
-
"price_variation": 0.9,
|
42
|
-
"unit_price": 9.09,
|
43
|
-
"unit_tax": 0.91
|
44
|
-
}
|
45
|
-
],
|
46
|
-
"payments": [
|
47
|
-
{
|
48
|
-
"id": 19230990,
|
49
|
-
"method": {
|
50
|
-
"id": 1,
|
51
|
-
"name": "Cash"
|
52
|
-
},
|
53
|
-
"amount": 5.5,
|
54
|
-
"created_at": "2013-05-29T11:14:06+10:00"
|
55
|
-
},
|
56
|
-
{
|
57
|
-
"id": 19230996,
|
58
|
-
"method": {
|
59
|
-
"id": 12,
|
60
|
-
"name": "PayPal"
|
61
|
-
},
|
62
|
-
"amount": 13.5,
|
63
|
-
"created_at": "2013-05-29T13:00:00+10:00",
|
64
|
-
"ref": "INV2-8M9F-B8UN-YQ5S-2G7K"
|
65
|
-
}
|
66
|
-
]
|
67
|
-
},
|
68
|
-
{
|
69
|
-
"id": 912387401,
|
70
|
-
"company_id": 162,
|
71
|
-
"status": "COMPLETED",
|
72
|
-
"total": 30.25,
|
73
|
-
"paid": 30.25,
|
74
|
-
"notes": "Take away, gold member",
|
75
|
-
"created_at": "2013-06-02T14:22:55+10:00",
|
76
|
-
"updated_at": "2013-06-02T14:22:55+10:00",
|
77
|
-
"placed_at": "2013-05-29T11:14:06+10:00",
|
78
|
-
"fulfil_at": "2013-05-29T13:00:00+10:00",
|
79
|
-
"customer": {
|
80
|
-
"id": 389427,
|
81
|
-
"first_name": "Lucy",
|
82
|
-
"last_name": "Lavender",
|
83
|
-
"email": "lucy@kounta.com",
|
84
|
-
"image": "http://www.gravatar.com/avatar/cb9532c3d6f3f835d2253b5fcaa68340.jpg"
|
85
|
-
},
|
86
|
-
"lines": [
|
87
|
-
{
|
88
|
-
"id": 37864193203,
|
89
|
-
"number": 1,
|
90
|
-
"product": {
|
91
|
-
"id": 7302,
|
92
|
-
"name": "Caffé Latte"
|
93
|
-
},
|
94
|
-
"quantity": 6,
|
95
|
-
"notes": "Extra sugar please",
|
96
|
-
"unit_price": 1.36,
|
97
|
-
"unit_tax": 0.14
|
98
|
-
},
|
99
|
-
{
|
100
|
-
"id": 37864193204,
|
101
|
-
"number": 2,
|
102
|
-
"product": {
|
103
|
-
"id": 5312,
|
104
|
-
"name": "Salmon Sandwich"
|
105
|
-
},
|
106
|
-
"quantity": 1,
|
107
|
-
"price_variation": 0.9,
|
108
|
-
"unit_price": 9.09,
|
109
|
-
"unit_tax": 0.91
|
110
|
-
}
|
111
|
-
],
|
112
|
-
"payments": [
|
113
|
-
{
|
114
|
-
"id": 19230990,
|
115
|
-
"method": {
|
116
|
-
"id": 1,
|
117
|
-
"name": "Cash"
|
118
|
-
},
|
119
|
-
"amount": 5.5,
|
120
|
-
"created_at": "2013-05-29T11:14:06+10:00"
|
121
|
-
},
|
122
|
-
{
|
123
|
-
"id": 19230996,
|
124
|
-
"method": {
|
125
|
-
"id": 12,
|
126
|
-
"name": "PayPal"
|
127
|
-
},
|
128
|
-
"amount": 13.5,
|
129
|
-
"created_at": "2013-05-29T13:00:00+10:00",
|
130
|
-
"ref": "INV2-8M9F-B8UN-YQ5S-2G7K"
|
131
|
-
}
|
132
|
-
]
|
133
|
-
}
|
134
|
-
]
|
data/spec/fixtures/payment.json
DELETED
data/spec/fixtures/people.json
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
[
|
2
|
-
{
|
3
|
-
"id": 701892,
|
4
|
-
"first_name": "Jamie",
|
5
|
-
"last_name": "McDonald",
|
6
|
-
"customer_id": 389427,
|
7
|
-
"staff_id": null,
|
8
|
-
"primary_email_address": "jamie@kounta.kom",
|
9
|
-
"image": "http://www.gravatar.com/avatar/cc6f3f16c233257d437ea5163787645e.jpg"
|
10
|
-
},
|
11
|
-
{
|
12
|
-
"id": 742890,
|
13
|
-
"first_name": "Jim",
|
14
|
-
"last_name": "Bluth",
|
15
|
-
"customer_id": null,
|
16
|
-
"staff_id": 3012,
|
17
|
-
"primary_email_address": "jim@kounta.kom",
|
18
|
-
"image": null
|
19
|
-
}
|
20
|
-
]
|
data/spec/fixtures/person.json
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"id": 701892,
|
3
|
-
"first_name": "Jamie",
|
4
|
-
"last_name": "McDonald",
|
5
|
-
"customer_id": 389427,
|
6
|
-
"staff_id": null,
|
7
|
-
"primary_email_address": "jamie@kounta.kom",
|
8
|
-
"email_addresses": [
|
9
|
-
"jamie@kounta.kom",
|
10
|
-
"jamie112783@hotmail.kom"
|
11
|
-
],
|
12
|
-
"shipping_address": {
|
13
|
-
"id": 198109,
|
14
|
-
"lines": [
|
15
|
-
"Suite 5, Level 12",
|
16
|
-
"44 Mutton Street"
|
17
|
-
],
|
18
|
-
"city": "Beeftown",
|
19
|
-
"zone": "NSW",
|
20
|
-
"postal_code": "2112",
|
21
|
-
"country": "AU"
|
22
|
-
},
|
23
|
-
"postal_address": null,
|
24
|
-
"addresses": {
|
25
|
-
"count": 3,
|
26
|
-
"updated_at": "2013-05-22T16:21:40+10:00"
|
27
|
-
},
|
28
|
-
"phone_numbers": [
|
29
|
-
{
|
30
|
-
"label": "Phone",
|
31
|
-
"number": "(02) 9876 5432"
|
32
|
-
},
|
33
|
-
{
|
34
|
-
"label": "Mobile",
|
35
|
-
"number": "0405 060 708"
|
36
|
-
}
|
37
|
-
],
|
38
|
-
"image": "http://www.gravatar.com/avatar/cc6f3f16c233257d437ea5163787645e.jpg",
|
39
|
-
"created_at": "2013-05-08T13:56:02+10:00",
|
40
|
-
"updated_at": "2013-05-22T16:21:40+10:00"
|
41
|
-
}
|
@@ -1,52 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"id": 236,
|
3
|
-
"name": "VIP Prices",
|
4
|
-
"parent_id": 201,
|
5
|
-
"products": [
|
6
|
-
{
|
7
|
-
"id": 1,
|
8
|
-
"name": "Test",
|
9
|
-
"unit_price": 10.25
|
10
|
-
},
|
11
|
-
{
|
12
|
-
"id": 2,
|
13
|
-
"name": "Caffè Latte",
|
14
|
-
"unit_price": 14.45
|
15
|
-
},
|
16
|
-
{
|
17
|
-
"id": 3,
|
18
|
-
"name": "Caffè Latte",
|
19
|
-
"unit_price": 13.15
|
20
|
-
},
|
21
|
-
{
|
22
|
-
"id": 4,
|
23
|
-
"name": "Caffè Latte",
|
24
|
-
"unit_price": 16.80
|
25
|
-
},
|
26
|
-
{
|
27
|
-
"id": 5,
|
28
|
-
"name": "Caffè Latte",
|
29
|
-
"unit_price": 8.90
|
30
|
-
},
|
31
|
-
{
|
32
|
-
"id": 6,
|
33
|
-
"name": "Caffè Latte",
|
34
|
-
"unit_price": 4.45
|
35
|
-
},
|
36
|
-
{
|
37
|
-
"id": 7,
|
38
|
-
"name": "Caffè Latte",
|
39
|
-
"unit_price": 10004.41
|
40
|
-
},
|
41
|
-
{
|
42
|
-
"id": 8,
|
43
|
-
"name": "Caffè Latte",
|
44
|
-
"unit_price": 999.99
|
45
|
-
},
|
46
|
-
{
|
47
|
-
"id": 9,
|
48
|
-
"name": "Caffè Latte",
|
49
|
-
"unit_price": 142.33
|
50
|
-
}
|
51
|
-
]
|
52
|
-
}
|
data/spec/fixtures/product.json
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"id": 1,
|
3
|
-
"company_id": 162,
|
4
|
-
"name": "Salomon Undhof Wieden & Berg Gruner Veltliner",
|
5
|
-
"code": "wine298",
|
6
|
-
"description": "Pale-coloured, with a rich nose of fresh herbs and peppery cucumber varietal character. Soft, rounded and nicely balanced with a clean, dry palate and some opulence.",
|
7
|
-
"barcode": "1234567890",
|
8
|
-
"image": "http://danmurphys.com.au/media/DM/Product/750x2000/332012_0_9999_v1_m56577569853958110.jpg",
|
9
|
-
"tags": [
|
10
|
-
"Fresh Food",
|
11
|
-
"Fragile",
|
12
|
-
"Organic"
|
13
|
-
],
|
14
|
-
"unit_price": 6.8,
|
15
|
-
"cost_price": 4,
|
16
|
-
"stock": 21,
|
17
|
-
"taxes": [
|
18
|
-
{
|
19
|
-
"id": 829,
|
20
|
-
"code": "GST",
|
21
|
-
"name": "GST",
|
22
|
-
"rate": 0.1
|
23
|
-
}
|
24
|
-
]
|
25
|
-
}
|
data/spec/fixtures/products.json
DELETED
@@ -1,119 +0,0 @@
|
|
1
|
-
[
|
2
|
-
{
|
3
|
-
"company_id": 162,
|
4
|
-
"id": 1,
|
5
|
-
"name": "Salomon Undhof Wieden & Berg Gruner Veltliner",
|
6
|
-
"description": "Pale-coloured, with a rich nose of fresh herbs and peppery cucumber varietal character. Soft, rounded and nicely balanced with a clean, dry palate and some opulence.",
|
7
|
-
"tags": [
|
8
|
-
"Website"
|
9
|
-
],
|
10
|
-
"image": "http://danmurphys.com.au/media/DM/Product/750x2000/332012_0_9999_v1_m56577569853958110.jpg",
|
11
|
-
"cost_price": 4,
|
12
|
-
"unit_price": 50.00,
|
13
|
-
"stock": 21
|
14
|
-
},
|
15
|
-
{
|
16
|
-
"company_id": 162,
|
17
|
-
"id": 2,
|
18
|
-
"name": "Hahndorf Hill Gruner Veltliner",
|
19
|
-
"description": "Aromas of salad leaf, a hint of stone fruit. Crisp and bracing, with pepper and spice flavours, and mouth-watering acidity.",
|
20
|
-
"tags": [
|
21
|
-
"Website"
|
22
|
-
],
|
23
|
-
"image": "http://danmurphys.com.au/media/DM/Product/750x2000/344099_0_9999_v1_m56577569853952360.jpg",
|
24
|
-
"cost_price": 4,
|
25
|
-
"unit_price": 25.45,
|
26
|
-
"stock": 21
|
27
|
-
},
|
28
|
-
{
|
29
|
-
"company_id": 162,
|
30
|
-
"id": 3,
|
31
|
-
"name": "Berton Vineyards Vermentino",
|
32
|
-
"description": "Crisp, crunchy and lightly herbal, this is a fresh, simple, unwooded dry white that shocked the NSW Wine Awards judges with its quality and price. Fruity palate and a near-dry finish: satisfying yet refreshing.",
|
33
|
-
"tags": [
|
34
|
-
"Website"
|
35
|
-
],
|
36
|
-
"image": "http://danmurphys.com.au/media/DM/Product/750x2000/368428_0_9999_v1_m56577569853952366.jpg",
|
37
|
-
"cost_price": 4,
|
38
|
-
"unit_price": 78.00,
|
39
|
-
"stock": 21
|
40
|
-
},
|
41
|
-
{
|
42
|
-
"company_id": 162,
|
43
|
-
"id": 4,
|
44
|
-
"name": "Ulithorne Corsus Vermentinu",
|
45
|
-
"description": "That's how they spell it in Corsica. Pale-hued, with a lightly peppery aroma, hints of talc, fresh herbs and other, more savoury notes. Delicate in the mouth; light-bodied and dry, lean and savoury, not fruity. Fairly simple but well made: it's an adaptable food wine.",
|
46
|
-
"tags": [
|
47
|
-
"Website"
|
48
|
-
],
|
49
|
-
"image": "http://danmurphys.com.au/media/DM/Product/750x2000/380851_0_9999_v1_m56577569846600429.jpg",
|
50
|
-
"cost_price": 4,
|
51
|
-
"unit_price": 5.00,
|
52
|
-
"stock": 21
|
53
|
-
},
|
54
|
-
{
|
55
|
-
"company_id": 162,
|
56
|
-
"id": 5,
|
57
|
-
"name": "By Farr",
|
58
|
-
"description": "The flavour is voluminous and gorgeously smooth, with a pillowy roundness, yet it's not even remotely fat, oily or lacking acidity. A great viognier, as good as any from France.",
|
59
|
-
"tags": [
|
60
|
-
"Website"
|
61
|
-
],
|
62
|
-
"image": "http://danmurphys.com.au/media/DM/Product/750x2000/383118_0_9999_v1_m56577569853988110.jpg",
|
63
|
-
"cost_price": 4,
|
64
|
-
"unit_price": 5.00,
|
65
|
-
"stock": 21
|
66
|
-
},
|
67
|
-
{
|
68
|
-
"company_id": 162,
|
69
|
-
"id": 6,
|
70
|
-
"name": "Clusel-Roch Condrieu Verchery",
|
71
|
-
"description": "Condrieu is the appellation and this one is classy. Very complex, with honeysuckle, spice and stone-fruit aromas. Fragrant, rich, full-bodied and dense, but without the heaviness or tannin grip that viognier can display - it remains light on its feet.",
|
72
|
-
"tags": [
|
73
|
-
"Website"
|
74
|
-
],
|
75
|
-
"image": "http://danmurphys.com.au/media/DM/Product/750x2000/717348_0_9999_v1_m56577569853956898.jpg",
|
76
|
-
"cost_price": 4,
|
77
|
-
"unit_price": 4.99,
|
78
|
-
"stock": 21
|
79
|
-
},
|
80
|
-
{
|
81
|
-
"company_id": 162,
|
82
|
-
"id": 7,
|
83
|
-
"name": "Hoddles Creek Estate 1er",
|
84
|
-
"description": "Possibly Australia's only commercial pinot blanc, this has a whiff of sulfides when first poured, underneath an intriguing pear and honey flavour. Decant it, if you like, to aerate before serving.",
|
85
|
-
"tags": [
|
86
|
-
"Website"
|
87
|
-
],
|
88
|
-
"image": "http://danmurphys.com.au/media/DM/Product/750x2000/720488_0_9999_v1_m56577569853963049.jpg",
|
89
|
-
"cost_price": 4,
|
90
|
-
"unit_price": 10.99,
|
91
|
-
"stock": 21
|
92
|
-
},
|
93
|
-
{
|
94
|
-
"company_id": 162,
|
95
|
-
"id": 8,
|
96
|
-
"name": "Albert Mann Pinot Blanc Auxerrois",
|
97
|
-
"description": "A full-yellow colour and buttered-toast bouquet indicate some bottle age. Smoky development plus peach, spices and honeydew melon. Soft, light, fruity flavour that is off-dry, finishing with good balance.",
|
98
|
-
"tags": [
|
99
|
-
"Website"
|
100
|
-
],
|
101
|
-
"image": "http://danmurphys.com.au/media/DM/Product/750x2000/757992_0_9999_v1_m56577569853630814.jpg",
|
102
|
-
"cost_price": 4,
|
103
|
-
"unit_price": 45.12,
|
104
|
-
"stock": 21
|
105
|
-
},
|
106
|
-
{
|
107
|
-
"company_id": 162,
|
108
|
-
"id": 9,
|
109
|
-
"name": "Adriano Adami Bosco di Gica Brut Prosecco di Valdobbiadene DOC non-vintage",
|
110
|
-
"description": "Pale colour with a vigorous, frothy mousse of bubbles. Aromas are peppery and creamy with some fresh yeasty notes. It's straightforward, with a touch of well-balanced sweetness and a fluffy, creamy texture.",
|
111
|
-
"tags": [
|
112
|
-
"Website"
|
113
|
-
],
|
114
|
-
"image": "http://danmurphys.com.au/media/DM/Product/750x2000/384219_0_9999_v1_m56577569852341202.jpg",
|
115
|
-
"cost_price": 4,
|
116
|
-
"unit_price": 0.56,
|
117
|
-
"stock": 21
|
118
|
-
}
|
119
|
-
]
|
data/spec/fixtures/site.json
DELETED
data/spec/fixtures/sites.json
DELETED
data/spec/fixtures/tax.json
DELETED
data/spec/fixtures/taxes.json
DELETED
data/spec/helper.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
SimpleCov.start
|
3
|
-
|
4
|
-
require 'rspec'
|
5
|
-
require 'webmock/rspec'
|
6
|
-
require 'kounta'
|
7
|
-
|
8
|
-
# Requires supporting files with custom matchers and macros, etc,
|
9
|
-
# in ./support/ and its subdirectories.
|
10
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
11
|
-
|
12
|
-
RSpec.configure do |config|
|
13
|
-
config.include Helpers
|
14
|
-
|
15
|
-
config.before(:each) do
|
16
|
-
|
17
|
-
stub_endpoints
|
18
|
-
|
19
|
-
Kounta.configure do |config|
|
20
|
-
config.client_id = "1234"
|
21
|
-
config.client_secret = "5678"
|
22
|
-
config.client_token = "abcd"
|
23
|
-
config.client_refresh_token = "efgh"
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
data/spec/kounta/address_spec.rb
DELETED
data/spec/kounta/company_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
require 'oj'
|
3
|
-
|
4
|
-
describe Kounta::Company do
|
5
|
-
|
6
|
-
subject { Kounta::Company }
|
7
|
-
|
8
|
-
it "should be able to create a company from an existing hash" do
|
9
|
-
subject.new(Oj.load(File.read("#{Kounta.root}/spec/fixtures/companies_me.json")))
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should be able to create a company without a hash" do
|
13
|
-
subject.new.should be_an_instance_of subject
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should have a resource path" do
|
17
|
-
subject.new.resource_path.should eq({companies: 162})
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should have a base price list" do
|
21
|
-
subject.new.base_price_list.should be_an_instance_of Kounta::PriceList
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
describe Kounta::Customer do
|
4
|
-
|
5
|
-
subject { Kounta::Company.new.customer(389427) }
|
6
|
-
|
7
|
-
it "should have a name" do
|
8
|
-
subject.name.should eq("Samuel Richardson")
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should have a resource path" do
|
12
|
-
subject.resource_path.should eq({companies: 162, customers: 389427})
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
data/spec/kounta/kounta_spec.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
describe Kounta do
|
4
|
-
|
5
|
-
subject { Kounta }
|
6
|
-
|
7
|
-
it "should be able to call a configure block" do
|
8
|
-
subject.configure do |config|
|
9
|
-
config.should be(Kounta)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should be able to configure logging" do
|
14
|
-
Kounta.enable_logging.should be(false)
|
15
|
-
Kounta.enable_logging = true
|
16
|
-
Kounta.enable_logging.should be(true)
|
17
|
-
Kounta.enable_logging = false
|
18
|
-
Kounta.enable_logging.should be(false)
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
data/spec/kounta/line_spec.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
describe Kounta::Line do
|
4
|
-
|
5
|
-
subject { Kounta::Line.new }
|
6
|
-
|
7
|
-
it "should have a resource path" do
|
8
|
-
subject.company_id = 162
|
9
|
-
subject.order_id = 6789
|
10
|
-
subject.id = 1
|
11
|
-
subject.resource_path.should eq({companies: 162, orders: 6789, lines: 1})
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
data/spec/kounta/order_spec.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
describe Kounta::Order do
|
4
|
-
|
5
|
-
subject { Kounta::Company.new.customer(701892).order(93824701) }
|
6
|
-
|
7
|
-
it "should be able to add payments to new orders" do
|
8
|
-
new_order = Kounta::Order.new
|
9
|
-
new_order.payments << Kounta::Payment.new(:amount => 50.00)
|
10
|
-
new_order.to_hash[:payments].length.should be(1)
|
11
|
-
new_order.to_hash[:payments][0][:amount].should eq(50.00)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should be able to add lines to new orders" do
|
15
|
-
new_order = Kounta::Order.new
|
16
|
-
new_order.lines << Kounta::Line.new(:quantity => 4)
|
17
|
-
new_order.to_hash[:lines].length.should be(1)
|
18
|
-
new_order.to_hash[:lines][0][:quantity].should be(4)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should be able to add and serialise payments to created orders" do
|
22
|
-
subject.payments << Kounta::Payment.new(:amount => 50.00)
|
23
|
-
subject.to_hash[:payments].length.should be(3)
|
24
|
-
subject.to_hash[:payments][2][:amount].should eq(50.00)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should be able to add and serialise lines to created orders" do
|
28
|
-
subject.lines << Kounta::Line.new(:quantity => 4)
|
29
|
-
subject.to_hash[:lines].length.should be(3)
|
30
|
-
subject.to_hash[:lines][0][:quantity].should be(6)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should have a resource path" do
|
34
|
-
subject.resource_path.should eq({companies: 162, orders: 93824701})
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
data/spec/kounta/payment_spec.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
describe Kounta::Payment do
|
4
|
-
|
5
|
-
subject { Kounta::Payment.new }
|
6
|
-
|
7
|
-
it "should have a resource path" do
|
8
|
-
subject.company_id = 162
|
9
|
-
subject.order_id = 6789
|
10
|
-
subject.id = 1
|
11
|
-
subject.resource_path.should eq({companies: 162, orders: 6789, payments: 1})
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
data/spec/kounta/person_spec.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
describe Kounta::Person do
|
4
|
-
|
5
|
-
subject { Kounta::Company.new.person(701892) }
|
6
|
-
|
7
|
-
it "should have a name" do
|
8
|
-
subject.name.should eq("Jamie McDonald")
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should have a resource path" do
|
12
|
-
subject.resource_path.should eq({companies: 162, people: 701892})
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|