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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +67 -36
  3. data/lib/kounta/address.rb +14 -17
  4. data/lib/kounta/break.rb +6 -0
  5. data/lib/kounta/category.rb +12 -15
  6. data/lib/kounta/company.rb +59 -50
  7. data/lib/kounta/customer.rb +33 -32
  8. data/lib/kounta/errors.rb +8 -7
  9. data/lib/kounta/inventory.rb +5 -7
  10. data/lib/kounta/line.rb +18 -21
  11. data/lib/kounta/order.rb +45 -49
  12. data/lib/kounta/payment.rb +14 -17
  13. data/lib/kounta/person.rb +21 -24
  14. data/lib/kounta/price_list.rb +7 -9
  15. data/lib/kounta/product.rb +25 -27
  16. data/lib/kounta/register.rb +11 -14
  17. data/lib/kounta/resource.rb +105 -93
  18. data/lib/kounta/rest/client.rb +177 -79
  19. data/lib/kounta/shift.rb +25 -0
  20. data/lib/kounta/site.rb +46 -38
  21. data/lib/kounta/staff.rb +30 -0
  22. data/lib/kounta/tax.rb +7 -9
  23. data/lib/kounta/version.rb +1 -1
  24. data/lib/kounta/webhook.rb +16 -0
  25. data/lib/kounta.rb +42 -72
  26. metadata +77 -145
  27. data/.gitignore +0 -20
  28. data/.gitmodules +0 -3
  29. data/Gemfile +0 -4
  30. data/Rakefile +0 -1
  31. data/console.rb +0 -14
  32. data/kounta.gemspec +0 -33
  33. data/spec/fixtures/address.json +0 -12
  34. data/spec/fixtures/addresses.json +0 -25
  35. data/spec/fixtures/base_price_list.json +0 -52
  36. data/spec/fixtures/categories.json +0 -217
  37. data/spec/fixtures/category.json +0 -11
  38. data/spec/fixtures/companies_me.json +0 -45
  39. data/spec/fixtures/customer.json +0 -39
  40. data/spec/fixtures/customers.json +0 -26
  41. data/spec/fixtures/inventory.json +0 -10
  42. data/spec/fixtures/line.json +0 -7
  43. data/spec/fixtures/order.json +0 -67
  44. data/spec/fixtures/orders.json +0 -134
  45. data/spec/fixtures/payment.json +0 -6
  46. data/spec/fixtures/people.json +0 -20
  47. data/spec/fixtures/person.json +0 -41
  48. data/spec/fixtures/price_list.json +0 -52
  49. data/spec/fixtures/price_lists.json +0 -12
  50. data/spec/fixtures/product.json +0 -25
  51. data/spec/fixtures/products.json +0 -119
  52. data/spec/fixtures/site.json +0 -6
  53. data/spec/fixtures/sites.json +0 -14
  54. data/spec/fixtures/tax.json +0 -7
  55. data/spec/fixtures/taxes.json +0 -16
  56. data/spec/helper.rb +0 -28
  57. data/spec/kounta/address_spec.rb +0 -11
  58. data/spec/kounta/category_spec.rb +0 -11
  59. data/spec/kounta/company_spec.rb +0 -24
  60. data/spec/kounta/customer_spec.rb +0 -15
  61. data/spec/kounta/kounta_spec.rb +0 -21
  62. data/spec/kounta/line_spec.rb +0 -14
  63. data/spec/kounta/order_spec.rb +0 -37
  64. data/spec/kounta/payment_spec.rb +0 -14
  65. data/spec/kounta/person_spec.rb +0 -15
  66. data/spec/kounta/product_spec.rb +0 -16
  67. data/spec/kounta/resource_spec.rb +0 -95
  68. data/spec/kounta/rest/client_spec.rb +0 -38
  69. data/spec/kounta/site_spec.rb +0 -11
  70. data/spec/support/endpoints.rb +0 -72
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in Kounta.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"
data/console.rb DELETED
@@ -1,14 +0,0 @@
1
- require "./lib/kounta"
2
- require 'pry'
3
-
4
- tokens = YAML::load( File.open( './tokens.yml' ) )
5
-
6
- Kounta.configure do |config|
7
- config.client_id = tokens['client_id']
8
- config.client_secret = tokens['client_secret']
9
- config.client_token = tokens['client_token']
10
- config.client_refresh_token = tokens['client_refresh_token']
11
- config.enable_logging = true
12
- end
13
-
14
- binding.pry
data/kounta.gemspec DELETED
@@ -1,33 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'kounta/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "kounta_rest"
8
- spec.version = Kounta::VERSION
9
- spec.authors = ["Samuel Richardson"]
10
- spec.email = ["sam@richardson.co.nz"]
11
- spec.description = %q{Library for accessing Kounta's RESTful API}
12
- spec.summary = %q{A wrapper around Kounta's RESTful API}
13
- spec.homepage = "https://github.com/Rodeoclash/Kounta"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rspec", "~> 2.14"
24
- spec.add_development_dependency "simplecov", "0.7.1"
25
- spec.add_development_dependency "webmock", "1.13.0"
26
-
27
- spec.add_dependency "oj", "~> 2.1.4"
28
- spec.add_dependency "hashie", "~> 2.0.5"
29
- spec.add_dependency "oauth2", "0.9.2"
30
- spec.add_dependency "pry", "0.9.12.2"
31
- spec.add_dependency "yell", "1.5.1"
32
- spec.add_dependency "faraday_middleware", "0.9.0"
33
- end
@@ -1,12 +0,0 @@
1
- {
2
- "id": 198109,
3
- "people_id": 701892,
4
- "lines": [
5
- "Suite 5, Level 12",
6
- "44 Mutton Street"
7
- ],
8
- "city": "Beeftown",
9
- "zone": "NSW",
10
- "postal_code": "2112",
11
- "country": "AU"
12
- }
@@ -1,25 +0,0 @@
1
- [
2
- {
3
- "id": 198109,
4
- "people_id": 701892,
5
- "lines": [
6
- "Suite 5, Level 12",
7
- "44 Mutton Street"
8
- ],
9
- "city": "Beeftown",
10
- "zone": "NSW",
11
- "postal_code": "2112",
12
- "country": "AU"
13
- },
14
- {
15
- "id": 198770,
16
- "people_id": 701892,
17
- "lines": [
18
- "PO Box 828"
19
- ],
20
- "city": "Sydney",
21
- "zone": "NSW",
22
- "postal_code": "2000",
23
- "country": "AU"
24
- }
25
- ]
@@ -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
- }
@@ -1,217 +0,0 @@
1
- [
2
- {
3
- "id": 1,
4
- "company_id": 162,
5
- "name": "France"
6
- },
7
- {
8
- "id": 2,
9
- "company_id": 162,
10
- "name": "Italy"
11
- },
12
- {
13
- "id": 3,
14
- "company_id": 162,
15
- "name": "Australia"
16
- },
17
- {
18
- "id": 4,
19
- "company_id": 162,
20
- "name": "Germany"
21
- },
22
- {
23
- "id": 5,
24
- "company_id": 162,
25
- "name": "Spain"
26
- },
27
- {
28
- "id": 6,
29
- "company_id": 162,
30
- "name": "Austria"
31
- },
32
- {
33
- "id": 7,
34
- "company_id": 162,
35
- "name": "New Zealand"
36
- },
37
- {
38
- "id": 8,
39
- "company_id": 162,
40
- "name": "USA"
41
- },
42
- {
43
- "id": 9,
44
- "company_id": 162,
45
- "name": "Chille"
46
- },
47
- {
48
- "id": 10,
49
- "company_id": 162,
50
- "name": "Argentina"
51
- },
52
- {
53
- "id": 11,
54
- "company_id": 162,
55
- "name": "Other Country"
56
- },
57
- {
58
- "id": 12,
59
- "company_id": 162,
60
- "name": "Sparkling"
61
- },
62
- {
63
- "id": 13,
64
- "company_id": 162,
65
- "name": "White"
66
- },
67
- {
68
- "id": 14,
69
- "company_id": 162,
70
- "name": "Rose"
71
- },
72
- {
73
- "id": 15,
74
- "company_id": 162,
75
- "name": "Red"
76
- },
77
- {
78
- "id": 16,
79
- "company_id": 162,
80
- "name": "Sweet"
81
- },
82
- {
83
- "id": 17,
84
- "company_id": 162,
85
- "name": "Fortified"
86
- },
87
- {
88
- "id": 18,
89
- "company_id": 162,
90
- "name": "Beer and Cider"
91
- },
92
- {
93
- "id": 19,
94
- "company_id": 162,
95
- "name": "Sparkling White"
96
- },
97
- {
98
- "id": 20,
99
- "company_id": 162,
100
- "name": "Sparkling Rose"
101
- },
102
- {
103
- "id": 21,
104
- "company_id": 162,
105
- "name": "Sparkling Red"
106
- },
107
- {
108
- "id": 22,
109
- "company_id": 162,
110
- "name": "Sparkling Sweet"
111
- },
112
- {
113
- "id": 23,
114
- "company_id": 162,
115
- "name": "Other Sparkling"
116
- },
117
- {
118
- "id": 24,
119
- "company_id": 162,
120
- "name": "Chardonnay"
121
- },
122
- {
123
- "id": 25,
124
- "company_id": 162,
125
- "name": "Riesling"
126
- },
127
- {
128
- "id": 26,
129
- "company_id": 162,
130
- "name": "Sav Blanc"
131
- },
132
- {
133
- "id": 27,
134
- "company_id": 162,
135
- "name": "Semilion"
136
- },
137
- {
138
- "id": 28,
139
- "company_id": 162,
140
- "name": "Pinot Gris"
141
- },
142
- {
143
- "id": 29,
144
- "company_id": 162,
145
- "name": "Other White"
146
- },
147
- {
148
- "id": 30,
149
- "company_id": 162,
150
- "name": "Pinot"
151
- },
152
- {
153
- "id": 31,
154
- "company_id": 162,
155
- "name": "Shiraz"
156
- },
157
- {
158
- "id": 32,
159
- "company_id": 162,
160
- "name": "Cap Sav & Friends"
161
- },
162
- {
163
- "id": 33,
164
- "company_id": 162,
165
- "name": "Grenache & Friends"
166
- },
167
- {
168
- "id": 34,
169
- "company_id": 162,
170
- "name": "Nebiolo"
171
- },
172
- {
173
- "id": 35,
174
- "company_id": 162,
175
- "name": "Other Red"
176
- },
177
- {
178
- "id": 36,
179
- "company_id": 162,
180
- "name": "Sherry"
181
- },
182
- {
183
- "id": 37,
184
- "company_id": 162,
185
- "name": "Port"
186
- },
187
- {
188
- "id": 38,
189
- "company_id": 162,
190
- "name": "Madeira"
191
- },
192
- {
193
- "id": 39,
194
- "company_id": 162,
195
- "name": "Australian Fortifieds"
196
- },
197
- {
198
- "id": 40,
199
- "company_id": 162,
200
- "name": "Other Fortified"
201
- },
202
- {
203
- "id": 41,
204
- "company_id": 162,
205
- "name": "Lager"
206
- },
207
- {
208
- "id": 42,
209
- "company_id": 162,
210
- "name": "Ales"
211
- },
212
- {
213
- "id": 43,
214
- "company_id": 162,
215
- "name": "Cider"
216
- }
217
- ]
@@ -1,11 +0,0 @@
1
- {
2
- "id": 1,
3
- "company_id": 162,
4
- "name": "France",
5
- "description": "Wine from the country of France",
6
- "image": null,
7
- "products": {
8
- "count": 34,
9
- "updated_at": "2013-05-29T15:22:32+10:00"
10
- }
11
- }
@@ -1,45 +0,0 @@
1
- {
2
- "id": 162,
3
- "name": "Rockin’ & Rollin’ Again",
4
- "shipping_address": null,
5
- "postal_address": {
6
- "id": 198109,
7
- "lines": [
8
- "Suite 5, Level 12",
9
- "44 Mutton Street"
10
- ],
11
- "city": "Beeftown",
12
- "zone": "VIC",
13
- "postal_code": "6112",
14
- "country": "AU"
15
- },
16
- "addresses": {
17
- "count": 3,
18
- "updated_at": "2013-05-22T16:21:40+10:00"
19
- },
20
- "business_number": "63 987 012 468",
21
- "contact_staff_member": {
22
- "id": 92402,
23
- "first_name": "Ricky",
24
- "last_name": "McDonald",
25
- "email": "rocky@rara.kom"
26
- },
27
- "image": "http://www.gravatar.com/avatar/b8e42a8b1eb5967f80bf085adb97d613.jpg",
28
- "website": "http://rara.kom",
29
- "currency": "AUD",
30
- "timezone": {
31
- "offset": "+10:00",
32
- "name": "Australia/Melbourne"
33
- },
34
- "sites": {
35
- "count": 3,
36
- "updated_at": "2013-05-24T16:24:13+10:00"
37
- },
38
- "registers": {
39
- "count": 12,
40
- "limit": 15,
41
- "updated_at": "2013-05-22T12:18:44+10:00"
42
- },
43
- "created_at": "2013-05-08T13:56:02+10:00",
44
- "updated_at": "2013-05-22T16:21:40+10:00"
45
- }
@@ -1,39 +0,0 @@
1
- {
2
- "id": 389427,
3
- "company_id": 162,
4
- "people_id": 701892,
5
- "first_name": "Samuel",
6
- "last_name": "Richardson",
7
- "description": "The cyclist who comes in every Thursday for a muffin.",
8
- "primary_email_address": "sam@richardson.co.nz",
9
- "email_addresses": [
10
- "jamie@kounta.kom",
11
- "jamie112783@hotmail.kom"
12
- ],
13
- "phone": "+612 8765 4321",
14
- "mobile": "0405 060 708",
15
- "fax": null,
16
- "shipping_address": {
17
- "id": 198109,
18
- "lines": [
19
- "Suite 5, Level 12",
20
- "44 Mutton Street"
21
- ],
22
- "city": "Beeftown",
23
- "zone": "NSW",
24
- "postal_code": "2112",
25
- "country": "AU"
26
- },
27
- "postal_address": null,
28
- "addresses": {
29
- "count": 3,
30
- "updated_at": "2013-05-22T16:21:40+10:00"
31
- },
32
- "image": "http://www.gravatar.com/avatar/cc6f3f16c233257d437ea5163787645e.jpg",
33
- "tags": [
34
- "Gold Member",
35
- "Newsletter"
36
- ],
37
- "created_at": "2013-05-08T13:56:02+10:00",
38
- "updated_at": "2013-05-22T16:21:40+10:00"
39
- }
@@ -1,26 +0,0 @@
1
- [
2
- {
3
- "id": 389427,
4
- "company_id": 162,
5
- "first_name": "Jamie",
6
- "last_name": "McDonald",
7
- "primary_email_address": "jamie@kounta.kom",
8
- "image": "http://www.gravatar.com/avatar/cc6f3f16c233257d437ea5163787645e.jpg"
9
- },
10
- {
11
- "id": 389428,
12
- "company_id": 162,
13
- "first_name": "Sam",
14
- "last_name": "Flanders",
15
- "primary_email_address": "sam@kounta.kom",
16
- "image": null
17
- },
18
- {
19
- "id": 389426,
20
- "company_id": 162,
21
- "first_name": "Samuel",
22
- "last_name": "Richardson",
23
- "primary_email_address": "disco16@gmail.com",
24
- "image": "http://www.gravatar.com/avatar/cc6f3f16c233257d437ea5163787645e.jpg"
25
- }
26
- ]
@@ -1,10 +0,0 @@
1
- [
2
- {
3
- "id":5143,
4
- "stock": 45
5
- },
6
- {
7
- "id": 33975,
8
- "stock": 0
9
- }
10
- ]
@@ -1,7 +0,0 @@
1
- {
2
- "number": 1,
3
- "product_id": 8710,
4
- "quantity": 1,
5
- "notes": "15% surcharge for public holiday",
6
- "price_variation": 1.15
7
- }
@@ -1,67 +0,0 @@
1
- {
2
- "id": 93824701,
3
- "company_id": 162,
4
- "status": "ON_HOLD",
5
- "notes": "Take away, gold member",
6
- "customer": {
7
- "id": 3842,
8
- "first_name": "Lucy",
9
- "last_name": "Lavender",
10
- "email": "lucy@kounta.com",
11
- "image": "http://www.gravatar.com/avatar/cb9532c3d6f3f835d2253b5fcaa68340.jpg"
12
- },
13
- "register_id": 409,
14
- "site_id": 2301,
15
- "lines": [
16
- {
17
- "id": 37864193203,
18
- "number": 1,
19
- "product": {
20
- "id": 7302,
21
- "name": "Caffé Latte"
22
- },
23
- "quantity": 6,
24
- "notes": "Extra sugar please",
25
- "unit_price": 1.36,
26
- "unit_tax": 0.14
27
- },
28
- {
29
- "id": 37864193204,
30
- "number": 2,
31
- "product": {
32
- "id": 5312,
33
- "name": "Salmon Sandwich"
34
- },
35
- "quantity": 1,
36
- "price_variation": 0.9,
37
- "unit_price": 9.09,
38
- "unit_tax": 0.91
39
- }
40
- ],
41
- "payments": [
42
- {
43
- "id": 19230990,
44
- "method": {
45
- "id": 1,
46
- "name": "Cash"
47
- },
48
- "amount": 5.5,
49
- "created_at": "2013-05-29T11:14:06+10:00"
50
- },
51
- {
52
- "id": 19230996,
53
- "method": {
54
- "id": 12,
55
- "name": "PayPal"
56
- },
57
- "amount": 13.5,
58
- "created_at": "2013-05-29T13:00:00+10:00",
59
- "ref": "INV2-8M9F-B8UN-YQ5S-2G7K"
60
- }
61
- ],
62
- "callback_uri": "http://third-party.com/update_order_status.json?id=123582936748",
63
- "placed_at": "2013-05-29T11:14:06+10:00",
64
- "fulfil_at": "2013-05-29T13:00:00+10:00",
65
- "created_at": "2013-05-29T11:14:06+10:00",
66
- "updated_at": "2013-05-29T11:14:06+10:00"
67
- }