sk_api_schema 0.10.6 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -2
  3. data/CHANGELOG.md +4 -0
  4. data/README.rdoc +1 -1
  5. data/Rakefile +0 -10
  6. data/json/v1.0/account.json +13 -0
  7. data/json/v1.0/contact.json +7 -1
  8. data/json/v1.0/credit_note.json +6 -0
  9. data/json/v1.0/invoice.json +6 -0
  10. data/json/v1.0/order.json +6 -0
  11. data/json/v1.0/product.json +0 -4
  12. data/json/v1.0/recurring.json +6 -0
  13. data/json/v2.0/README.md +28 -0
  14. data/json/v2.0/account.json +31 -18
  15. data/json/v2.0/account_billing.json +15 -7
  16. data/json/v2.0/account_entry.json +19 -16
  17. data/json/v2.0/address.json +7 -6
  18. data/json/v2.0/attachment.json +17 -16
  19. data/json/v2.0/auth_permission.json +6 -5
  20. data/json/v2.0/comment.json +15 -9
  21. data/json/v2.0/company.json +11 -8
  22. data/json/v2.0/contact.json +45 -49
  23. data/json/v2.0/credit_note.json +59 -84
  24. data/json/v2.0/divider_item.json +9 -8
  25. data/json/v2.0/document.json +41 -36
  26. data/json/v2.0/email.json +29 -22
  27. data/json/v2.0/email_template.json +15 -10
  28. data/json/v2.0/estimate.json +59 -76
  29. data/json/v2.0/export.json +26 -16
  30. data/json/v2.0/export_template.json +15 -9
  31. data/json/v2.0/invoice.json +62 -92
  32. data/json/v2.0/language.json +14 -6
  33. data/json/v2.0/line_item.json +14 -13
  34. data/json/v2.0/order.json +59 -75
  35. data/json/v2.0/payment.json +17 -12
  36. data/json/v2.0/payment_reminder.json +53 -71
  37. data/json/v2.0/pdf_template.json +14 -8
  38. data/json/v2.0/product.json +16 -13
  39. data/json/v2.0/recurring.json +57 -54
  40. data/json/v2.0/sub.json +14 -7
  41. data/json/v2.0/sub_total_item.json +10 -9
  42. data/json/v2.0/tag.json +13 -5
  43. data/json/v2.0/task.json +31 -16
  44. data/json/v2.0/text_template.json +16 -10
  45. data/json/v2.0/user.json +8 -8
  46. data/lib/sk_api_schema/version.rb +1 -1
  47. data/sk_api_schema.gemspec +1 -1
  48. data/spec/sk_api_schema_spec.rb +35 -19
  49. data/spec/spec_helper.rb +1 -2
  50. metadata +7 -7
  51. data/json/v2.0/client.json +0 -318
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: abde1b5b42fecd8924f6807b99891be589fd17a0
4
- data.tar.gz: 397c6504cd713e94ced42ac68b45951fe9fdeea3
3
+ metadata.gz: 247a46ed65c67e561a7d45d0835084f1b992822e
4
+ data.tar.gz: 9232c88e6b95a53dda08d2a93b01fc6760120f93
5
5
  SHA512:
6
- metadata.gz: 25bfc2130cb635266c2e9775797881bfb68c2b4e61c72babaab55405441507545746e3598a35c6f20dbf8b83a7d2b1639ada0e8281825f90b2804334f2131df2
7
- data.tar.gz: e6e78e2f97eace77224d1f552155912ab29f7355338fe0502b5b0322c7f847a249f477a6b9de858902347ddd843bd0ea9b3471ed2f0f97ba785614dc283e972f
6
+ metadata.gz: 698ad34b2abf8280e66eb9f5773ac17136c2b682bf99b6a7a38841232316c90ad30b4b83136f66a3df04a8ff304592ed9a9757a13cf8d7c46e357331e35df208
7
+ data.tar.gz: 936f38495f7dc5afa7ea7fb606d618c85fda15c43e25bd500b49a97ab7868ecad3dcf5b7b3ebf20416bf5591c456cbc6e05a4a2cbf888e7680d31076d0e5d4bf
@@ -1,5 +1,9 @@
1
1
  rvm:
2
2
  - 1.9.3
3
- - 2.0.0
3
+ - 2.2
4
4
  gemfile:
5
- - Gemfile
5
+ - Gemfile
6
+
7
+ # fix undefined spec error in ruby 1.9.3 due to outdated bundler
8
+ before_install:
9
+ - gem install bundler
@@ -3,6 +3,10 @@
3
3
  See [commit messages](https://github.com/salesking/sk_api_schema/commits/) for details.
4
4
  Also sign up to our [Developer Newsletter](http://www.salesking.eu/dev/newsletter/) to stay up-to-date!
5
5
 
6
+ ##2017-05
7
+
8
+ * Product remove lock_version
9
+
6
10
  ##2015-10
7
11
 
8
12
  * Update description to clarify number field decimal places length
@@ -163,4 +163,4 @@ course you can run them too. Install required gems with bundler and go for it:
163
163
 
164
164
  == ToDo:
165
165
 
166
- Copyright (c) 2010-2014 Georg Leciejewski, released under the MIT license
166
+ Copyright (c) 2010-2016 Georg Leciejewski, released under the MIT license
data/Rakefile CHANGED
@@ -2,17 +2,7 @@
2
2
  require 'bundler/gem_tasks'
3
3
  require 'rspec'
4
4
  require 'rspec/core/rake_task'
5
- require 'rdoc/task'
6
5
 
7
6
  desc "Run specs"
8
7
  RSpec::Core::RakeTask.new
9
8
  task :default => :spec
10
-
11
- desc 'Generate documentation.'
12
- Rake::RDocTask.new(:rdoc) do |rdoc|
13
- rdoc.rdoc_dir = 'rdoc'
14
- rdoc.title = 'SalesKing-Api JSON Schema'
15
- rdoc.options << '--line-numbers' << '--inline-source'
16
- rdoc.rdoc_files.include('README')
17
- rdoc.rdoc_files.include('lib/**/*.rb')
18
- end
@@ -46,6 +46,19 @@
46
46
  "type":"string",
47
47
  "maxLength": 30
48
48
  },
49
+ "billing_fee_name":{
50
+ "description": "Name for a billing fee line item. The item is added to the resulting document upon each account_billing creation, if billing_fee_price_single is set.",
51
+ "type":"string",
52
+ "maxLength": 255
53
+ },
54
+ "billing_fee_tax":{
55
+ "description": "Tax value for a billing fee line item. The item is added to the resulting document upon each account_billing creation.",
56
+ "type":"number"
57
+ },
58
+ "billing_fee_price_single":{
59
+ "description": "Price of a billing fee line item. This field serves as a trigger of whether to add the item. The item is added to the resulting document upon each account_billing creation.",
60
+ "type":"number"
61
+ },
49
62
  "hide_fields":{
50
63
  "description": "A list of account entry field names. The fields are hidden on account entry lists and forms so one can focus on the important inputs. For example hide: tax,description,billed_at",
51
64
  "type":"string",
@@ -186,7 +186,7 @@
186
186
  "type":"number"
187
187
  },
188
188
  "due_days":{
189
- "description": "Default due days for new invoices.",
189
+ "description": "Default due days for new documents.",
190
190
  "type":"integer"
191
191
  },
192
192
  "address_field":{
@@ -235,6 +235,12 @@
235
235
  "description": "Product of the probability and sales potential. e.g how much of the sales_potential can we get?",
236
236
  "readonly":true,
237
237
  "type":"number"
238
+ },
239
+ "tax_exemption_id":{
240
+ "description": "ID of a tax exemption. New documents inherit the tax exemption and will be created without any taxes.",
241
+ "type":"string",
242
+ "maxLength": 22,
243
+ "minLength":22
238
244
  }
239
245
  },
240
246
  "links":[
@@ -201,6 +201,12 @@
201
201
  "description": "Percentage of gross profit to cost of items sold. Calculated from gross_margin_total/net_total*100",
202
202
  "readonly":true,
203
203
  "type":"number"
204
+ },
205
+ "tax_exemption_id":{
206
+ "description": "ID of a tax exemption. When set all item taxes are omitted.",
207
+ "type":"string",
208
+ "maxLength": 22,
209
+ "minLength":22
204
210
  }
205
211
  },
206
212
  "links":[
@@ -223,6 +223,12 @@
223
223
  "type":"string",
224
224
  "maxLength": 22,
225
225
  "minLength": 22
226
+ },
227
+ "tax_exemption_id":{
228
+ "description": "ID of a tax exemption. When set all item taxes are omitted.",
229
+ "type":"string",
230
+ "maxLength": 22,
231
+ "minLength":22
226
232
  }
227
233
  },
228
234
  "links":[
@@ -198,6 +198,12 @@
198
198
  "description": "Percentage of gross profit to cost of items sold. Calculated from gross_margin_total/net_total*100",
199
199
  "readonly":true,
200
200
  "type":"number"
201
+ },
202
+ "tax_exemption_id":{
203
+ "description": "ID of a tax exemption. When set all item taxes are omitted.",
204
+ "type":"string",
205
+ "maxLength": 22,
206
+ "minLength":22
201
207
  }
202
208
  },
203
209
  "links":[
@@ -71,10 +71,6 @@
71
71
  "type":"string",
72
72
  "maxLength": 22,
73
73
  "minLength":22
74
- },
75
- "lock_version":{
76
- "description": "Increased on every edit, so SK can detect/prevent a concurrent edit by another user. First save wins.",
77
- "type":"integer"
78
74
  }
79
75
  },
80
76
  "links":[
@@ -211,6 +211,12 @@
211
211
  "default": null,
212
212
  "type": "string",
213
213
  "enum":["email"]
214
+ },
215
+ "tax_exemption_id":{
216
+ "description": "ID of a tax exemption. When set all item taxes are omitted.",
217
+ "type":"string",
218
+ "maxLength": 22,
219
+ "minLength":22
214
220
  }
215
221
  },
216
222
  "links":[
@@ -0,0 +1,28 @@
1
+ # V2.0 SalesKing API Schema
2
+
3
+ The new version is not live yet! We put it here so one can follow the changes.
4
+
5
+ The following todo's are some of the things we are going to tackle.
6
+
7
+ ## TODO
8
+
9
+ - [x] remove all deprecations
10
+ - [x] move required attributes markup to top level object definition
11
+ - [x] add schema validation to specs
12
+ - [x] revise schema definitions for nested objects
13
+ - [x] use anyOf definitions for nested line items
14
+ - [x] add type to nested objects reflecting the class
15
+ - [x] add company_id to all resources
16
+ - [ ] revise filter methods
17
+ - [ ] remove nested url's in favour of filter links instead e.g /emails?filter[contact_ids]=ID
18
+ - [ ] change to/from filters to to_date/from_date
19
+ - [ ] add /teams
20
+ - [x] move collection info to header
21
+ - [ ] define error object
22
+ - ..
23
+
24
+ ## Server Side TODO
25
+
26
+ - [ ] remove prefixed nesting
27
+ - [ ] be more strict about validations e.g field length, strings vs number
28
+ - [ ] remove links in returned objects
@@ -1,12 +1,21 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "account",
3
- "name": "account",
4
- "description": "BETA An account to track times, expenses, projects, usages, etc. Those are single entry accounts, opposed to double entry accounting in bookkeeping accounts.",
5
+ "description": "An account to track times, expenses, projects, usages, etc. Those are single entry accounts, opposed to double entry accounting in bookkeeping accounts.",
6
+ "required": ["name"],
5
7
  "properties":{
6
8
  "id":{
7
9
  "description":"Unique identifier - UUID",
8
10
  "identity":true,
9
- "readonly":true,
11
+ "readOnly":true,
12
+ "type":"string",
13
+ "maxLength": 22,
14
+ "minLength":22
15
+ },
16
+ "company_id":{
17
+ "description":"Company",
18
+ "readOnly":true,
10
19
  "type":"string",
11
20
  "maxLength": 22,
12
21
  "minLength":22
@@ -19,19 +28,17 @@
19
28
  "name":{
20
29
  "description": "The name of the account",
21
30
  "type":"string",
22
- "required":true,
23
31
  "maxLength": 100
24
32
  },
25
33
  "description":{
26
34
  "description": "Account description",
27
35
  "type":"string",
28
- "format":"text",
29
36
  "maxLength": 255
30
37
  },
31
38
  "balance":{
32
39
  "description": "The account balance is the sum of all entries, also those from sub-accounts.",
33
40
  "type":"number",
34
- "readonly":true
41
+ "readOnly":true
35
42
  },
36
43
  "budget":{
37
44
  "description": "If an account is used to track budgetary things f.ex. projects, this fields can be used to perform calculations like: Are we still inside the allowed budget?",
@@ -46,11 +53,23 @@
46
53
  "type":"string",
47
54
  "maxLength": 30
48
55
  },
49
- "hide_fields":{
50
- "description": "A list of account entry field names. The fields are hidden on account entry lists and forms so one can focus on the important inputs. For example hide: tax,description,billed_at",
56
+ "default_tax":{
57
+ "description": "The default tax for new account entries, if tax is empty on create.",
58
+ "type":"number"
59
+ },
60
+ "billing_fee_name":{
61
+ "description": "Name for a billing fee line item. The item is added to the resulting document upon each account_billing creation, if billing_fee_price_single is set.",
51
62
  "type":"string",
52
63
  "maxLength": 255
53
64
  },
65
+ "billing_fee_tax":{
66
+ "description": "Tax value for a billing fee line item. The item is added to the resulting document upon each account_billing creation.",
67
+ "type":"number"
68
+ },
69
+ "billing_fee_price_single":{
70
+ "description": "Price of a billing fee line item. This field serves as a trigger of whether to add the item. The item is added to the resulting document upon each account_billing creation.",
71
+ "type":"number"
72
+ },
54
73
  "contact_id":{
55
74
  "description": "The contacts uuid to which the account is related.",
56
75
  "type":"string",
@@ -66,13 +85,13 @@
66
85
  "created_at":{
67
86
  "description": "Date the object was created in SK. Never changes afterwards",
68
87
  "format":"date-time",
69
- "readonly":true,
88
+ "readOnly":true,
70
89
  "type":"string"
71
90
  },
72
91
  "updated_at":{
73
92
  "description": "Date the object was edited in SK.",
74
93
  "format":"date-time",
75
- "readonly":true,
94
+ "readOnly":true,
76
95
  "type":"string"
77
96
  },
78
97
  "team_id":{
@@ -86,7 +105,7 @@
86
105
  "type":"string",
87
106
  "maxLength": 22,
88
107
  "minLength":22,
89
- "readonly":true
108
+ "readOnly":true
90
109
  }
91
110
  },
92
111
  "links":[
@@ -161,12 +180,6 @@
161
180
  { "rel": "create",
162
181
  "href": "accounts",
163
182
  "method": "POST"
164
- },
165
- { "rel": "account_entries",
166
- "href": "accounts/{id}/account_entries"
167
- },
168
- { "rel": "account_billings",
169
- "href": "accounts/{id}/account_billings"
170
183
  }
171
184
  ]
172
185
  }
@@ -1,12 +1,21 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "account_billing",
3
- "name": "account_billing",
4
5
  "description": "BETA An account billing serves as the glue between an account a document and their related account entries and line items. It also lets one keep track of who billed what and when. A billing is created from billable account entries, which are turned into line items for a document.",
6
+ "required": ["account_id"],
5
7
  "properties":{
6
8
  "id":{
7
9
  "description":"Unique identifier - UUID",
8
10
  "identity":true,
9
- "readonly":true,
11
+ "readOnly":true,
12
+ "type":"string",
13
+ "maxLength": 22,
14
+ "minLength":22
15
+ },
16
+ "company_id":{
17
+ "description":"Company",
18
+ "readOnly":true,
10
19
  "type":"string",
11
20
  "maxLength": 22,
12
21
  "minLength":22
@@ -19,7 +28,6 @@
19
28
  "account_id":{
20
29
  "description": "The related account. Must be set for entries to be found.",
21
30
  "type":"string",
22
- "required":true,
23
31
  "maxLength": 22,
24
32
  "minLength":22
25
33
  },
@@ -42,14 +50,14 @@
42
50
  "document_id":{
43
51
  "description": "The document created by the billing.",
44
52
  "type":"string",
45
- "readonly": true,
53
+ "readOnly": true,
46
54
  "maxLength": 22,
47
55
  "minLength":22
48
56
  },
49
57
  "created_at":{
50
58
  "description": "Date the object was created in SK. Never changes afterwards",
51
59
  "format":"date-time",
52
- "readonly":true,
60
+ "readOnly":true,
53
61
  "type":"string"
54
62
  },
55
63
  "team_id":{
@@ -63,7 +71,7 @@
63
71
  "type":"string",
64
72
  "maxLength": 22,
65
73
  "minLength":22,
66
- "readonly":true
74
+ "readOnly":true
67
75
  }
68
76
  },
69
77
  "links":[
@@ -1,33 +1,41 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "account_entry",
3
- "name": "account_entry",
4
5
  "description": "A entry for an account",
6
+ "required": ["account_id", "price_single"],
5
7
  "properties":{
6
8
  "id":{
7
9
  "description":"Unique identifier - UUID",
8
10
  "identity":true,
9
- "readonly":true,
11
+ "readOnly":true,
12
+ "type":"string",
13
+ "maxLength": 22,
14
+ "minLength":22
15
+ },
16
+ "company_id":{
17
+ "description":"Company",
18
+ "readOnly":true,
10
19
  "type":"string",
11
20
  "maxLength": 22,
12
21
  "minLength":22
13
22
  },
14
23
  "account_id":{
15
24
  "description":"Account the entry belongs to.",
16
- "required":true,
17
25
  "type":"string",
18
26
  "maxLength": 22,
19
27
  "minLength":22
20
28
  },
21
29
  "document_id":{
22
30
  "description":"Document the entry is related to. This relation is set by an account billing.",
23
- "readonly":true,
31
+ "readOnly":true,
24
32
  "type":"string",
25
33
  "maxLength": 22,
26
34
  "minLength":22
27
35
  },
28
36
  "item_id":{
29
37
  "description":"Line item on the document the entry is related to. This relation is set by an account billing or when a document is booked onto an account.",
30
- "readonly":true,
38
+ "readOnly":true,
31
39
  "type":"string",
32
40
  "maxLength": 22,
33
41
  "minLength":22
@@ -40,16 +48,15 @@
40
48
  "description":{
41
49
  "description": "Entry description",
42
50
  "type":"string",
43
- "format": "text"
51
+ "format": "string"
44
52
  },
45
53
  "price_single":{
46
54
  "description": "Net price of a single entry. If a product id is given, price_single is taken from the product if not set.",
47
- "type":"number",
48
- "required" : true
55
+ "type":"number"
49
56
  },
50
57
  "net_total":{
51
58
  "description": "Net price of a single entry. Calculated from price_single * quantity",
52
- "readonly":true,
59
+ "readOnly":true,
53
60
  "type":"number"
54
61
  },
55
62
  "tax":{
@@ -84,18 +91,14 @@
84
91
  "created_at":{
85
92
  "description": "Date the object was created. Never changes afterwards",
86
93
  "format":"date-time",
87
- "readonly":true,
94
+ "readOnly":true,
88
95
  "type":"string"
89
96
  },
90
97
  "updated_at":{
91
98
  "description": "Date the object was edited.",
92
99
  "format":"date-time",
93
- "readonly":true,
100
+ "readOnly":true,
94
101
  "type":"string"
95
- },
96
- "_destroy":{
97
- "description": "When set an existing entry will be deleted. This switch is used for entries passed during batch operations.",
98
- "type":"boolean"
99
102
  }
100
103
  },
101
104
  "links":[