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
@@ -1,12 +1,21 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "export",
3
- "name": "export",
4
- "description":"An export in SK",
5
+ "description":"An export of SalesKing data",
6
+ "required": ["collection_ids", "kind"],
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
@@ -18,13 +27,11 @@
18
27
  },
19
28
  "collection_ids":{
20
29
  "description": "Comma separated uuid's of the export objects. The backend uses a mysql text-column limited to ~64kb. 100 uuids are ~2.5kb",
21
- "required":true,
22
30
  "type":"string",
23
- "format":"text"
31
+ "format":"string"
24
32
  },
25
33
  "kind":{
26
34
  "description": "The export type. text: uses an export template defined by a template_id. archived_pdf: zip with archived PDF(documents only). allinone_pdf: All archived PDF(Documents) in one big PDF. attachments: All attachments of the given objects as zip. SEPA: bank exports, relies on valid bank information in your company, the exported document and the contact.",
27
- "required":true,
28
35
  "enum": ["text", "archived_pdf", "attachments", "allinone_pdf", "sepa_debit", "sepa_credit"],
29
36
  "type":"string"
30
37
  },
@@ -42,44 +49,47 @@
42
49
  },
43
50
  "status":{
44
51
  "description": "The export status",
45
- "readonly":true,
52
+ "readOnly":true,
46
53
  "enum": ["pending", "in_progress", "failed", "success"],
47
54
  "type":"string"
48
55
  },
49
56
  "log":{
50
57
  "description": "Errors and warnings, can contain html markup f.ex. links to contacts with invalid back accounts when doing dtaus export",
51
- "readonly":true,
58
+ "readOnly":true,
52
59
  "type":"string",
53
- "format": "text"
60
+ "format": "string"
54
61
  },
55
62
  "attachments":{
56
63
  "description": "The exported data as attachment.",
57
- "readonly":true,
64
+ "readOnly":true,
58
65
  "type":"array",
59
- "properties":{"$ref":"./attachment.json#properties"}
66
+ "items": {
67
+ "type": "object",
68
+ "$ref" : "./attachment.json#"
69
+ }
60
70
  },
61
71
  "started_at":{
62
72
  "description": "Date the was started",
63
73
  "format":"date-time",
64
- "readonly":true,
74
+ "readOnly":true,
65
75
  "type":"string"
66
76
  },
67
77
  "finished_at":{
68
78
  "description": "Date the was finished",
69
79
  "format":"date-time",
70
- "readonly":true,
80
+ "readOnly":true,
71
81
  "type":"string"
72
82
  },
73
83
  "created_at":{
74
84
  "description": "Date the object was created in SK. Never changes afterwards",
75
85
  "format":"date-time",
76
- "readonly":true,
86
+ "readOnly":true,
77
87
  "type":"string"
78
88
  },
79
89
  "updated_at":{
80
90
  "description": "Date the object was edited in SK.",
81
91
  "format":"date-time",
82
- "readonly":true,
92
+ "readOnly":true,
83
93
  "type":"string"
84
94
  }
85
95
  },
@@ -1,31 +1,37 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "export_template",
3
- "name": "export_template",
4
5
  "description":"An export_template in SK",
6
+ "required": ["name", "text", "kind"],
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
  "name":{
15
24
  "description": "A meaningful name.",
16
- "required":true,
17
25
  "type":"string",
18
26
  "maxLength": 50
19
27
  },
20
28
  "text":{
21
29
  "description": "Text with placeholders, replaced when the template is used.",
22
- "required":true,
23
30
  "type":"string",
24
- "format":"text"
31
+ "format":"string"
25
32
  },
26
33
  "kind":{
27
34
  "description": "Kind of object the template can be used for.",
28
- "required":true,
29
35
  "enum": ["invoice", "estimate", "credit_note", "payment_reminder", "order", "contact", "payment", "comment", "email", "history", "product","recurring"],
30
36
  "type":"string"
31
37
  },
@@ -37,13 +43,13 @@
37
43
  "created_at":{
38
44
  "description": "Date the object was created in SK. Never changes afterwards",
39
45
  "format":"date-time",
40
- "readonly":true,
46
+ "readOnly":true,
41
47
  "type":"string"
42
48
  },
43
49
  "updated_at":{
44
50
  "description": "Date the object was edited in SK.",
45
51
  "format":"date-time",
46
- "readonly":true,
52
+ "readOnly":true,
47
53
  "type":"string"
48
54
  },
49
55
  "team_id":{
@@ -1,16 +1,24 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "invoice",
3
- "name": "invoice",
4
5
  "description": "An invoice",
5
6
  "properties":{
6
7
  "id":{
7
8
  "description":"Unique identifier - UUID",
8
9
  "identity":true,
9
- "readonly":true,
10
+ "readOnly":true,
10
11
  "type":"string",
11
12
  "maxLength": 22,
12
13
  "minLength": 22
13
14
  },
15
+ "company_id":{
16
+ "description":"Company",
17
+ "readOnly":true,
18
+ "type":"string",
19
+ "maxLength": 22,
20
+ "minLength":22
21
+ },
14
22
  "number":{
15
23
  "description": "Unique number assigned by SK invoice number schema. Auto-assigned when invoice is opened. Required unless doc status is draft.",
16
24
  "type":"string",
@@ -58,12 +66,12 @@
58
66
  "notes_before":{
59
67
  "description": "Notes shown before the line items. Normally contains salutation and other introductional information. SK placeholders can be used.",
60
68
  "type":"string",
61
- "format":"text"
69
+ "format":"string"
62
70
  },
63
71
  "notes_after":{
64
72
  "description": "Notes shown after the line items. Can contain information about payments, bank account or a thank-you message. SK placeholders can be used.",
65
73
  "type":"string",
66
- "format":"text"
74
+ "format":"string"
67
75
  },
68
76
  "tag_list":{
69
77
  "description": "Space separated list of tags. Are split and saved as Tag objects on create, update.",
@@ -82,19 +90,19 @@
82
90
  },
83
91
  "exchange_rate":{
84
92
  "description": "The exchange rate from the foreign document currency(eg. USD) to the company currency(EUR). If the rate is empty we use the exchange rate on the document date or today if doc.date is empty. If there is no rate for this day, say on weekends, the closest previous day is taken(Sunday->Friday). If you open the doc at a later time make sure to manually refresh the rate, as we dont change it. ",
85
- "readonly":true,
93
+ "readOnly":true,
86
94
  "type":"number"
87
95
  },
88
96
  "gross_total_exchanged":{
89
97
  "description": "Exchanged gross total, in your company currency.",
90
- "readonly":true,
98
+ "readOnly":true,
91
99
  "type":"number"
92
100
  },
93
101
  "archived_pdf":{
94
102
  "description": "Archived PDF version of the document. Is created when an document is printed and archived. A document can have multiple archived versions. This only returns the most recent one. ",
95
- "readonly":true,
103
+ "readOnly":true,
96
104
  "type":"object",
97
- "properties":{"$ref":"./attachment.json#properties"}
105
+ "$ref":"./attachment.json#"
98
106
  },
99
107
  "sepa_mandate_id":{
100
108
  "description": "SEPA mandate identifier needed in direct debit transactions. This is a unique id given by you to the customer beforehand.",
@@ -111,23 +119,11 @@
111
119
  "type":"string",
112
120
  "enum":["FRST","OOFF","RCUR","FNAL"]
113
121
  },
114
- "client":{
115
- "description": "DEPRECATED: use contact",
116
- "readonly":true,
117
- "type":"object",
118
- "properties":{"$ref":"./client.json#properties"}
119
- },
120
- "client_id":{
121
- "description": "DEPRECATED: use contact_id",
122
- "type":"string",
123
- "maxLength": 22,
124
- "minLength":22
125
- },
126
122
  "contact":{
127
123
  "description": "The contact for the document. Use contact_id field to set a contact.",
128
- "readonly":true,
124
+ "readOnly":true,
129
125
  "type":"object",
130
- "properties":{"$ref":"./contact.json#properties"}
126
+ "$ref":"./contact.json#"
131
127
  },
132
128
  "contact_id":{
133
129
  "description": "The contact uuid. When assigning a contact its language, currency, address_field (due days, cash discount) values are used for the document if those doc-fields are not set.",
@@ -137,92 +133,97 @@
137
133
  },
138
134
  "team_id":{
139
135
  "description": "A team uuid taken from the contact. If set only the team and its parent teams can see the record.",
140
- "readonly" :true,
136
+ "readOnly" :true,
141
137
  "type":"string",
142
138
  "maxLength": 22,
143
139
  "minLength":22
144
140
  },
145
- "line_items":{
146
- "description": "DEPRECATED use items",
147
- "type":"array",
148
- "properties":{"$ref":"./line_item.json#properties"}
149
- },
150
141
  "items":{
151
- "description": "Items for the document. Access items of all types including divider and sub_total items. GOTCHAs when using items instead of line_items: You MUST set the type field(CamelCasesItem class name) on each item. You cannot use both, the line_items array is stronger for backward compat.",
142
+ "description": "Items for the document, including divider and sub_total items. You MUST set the type field(CamelCasedItem class name) on each item on creation.",
152
143
  "type":"array",
153
- "default": "any",
154
144
  "minItems": 0,
155
- "items": [{ "$ref": "./line_item.json#properties"},
156
- { "$ref": "./divider_item.json#properties"},
157
- { "$ref": "./sub_total_item.json#properties"}]
145
+ "items": {
146
+ "type" : "object",
147
+ "anyOf" : [
148
+ {
149
+ "title": "line_item",
150
+ "$ref": "./line_item.json#"
151
+ },
152
+ {
153
+ "title": "divider_item",
154
+ "$ref": "./divider_item.json#"
155
+ },
156
+ {
157
+ "title": "sub_total_item",
158
+ "$ref": "./sub_total_item.json#"
159
+ }
160
+ ]
161
+ }
158
162
  },
159
163
  "created_at":{
160
164
  "description": "Date the object was created in SK. Never changes afterwards.",
161
165
  "format":"date-time",
162
- "readonly":true,
166
+ "readOnly":true,
163
167
  "type":"string"
164
168
  },
165
169
  "updated_at":{
166
170
  "description": "Date the object was edited in SK.",
167
171
  "format":"date-time",
168
- "readonly":true,
172
+ "readOnly":true,
169
173
  "type":"string"
170
174
  },
171
175
  "lock_version":{
172
176
  "description": "Auto-incremented to prevent concurrent updates. First save wins and increments version. ",
177
+ "readOnly":true,
173
178
  "type":"integer"
174
179
  },
175
- "price_total":{
176
- "description": "DEPRECATED use net_total_base",
177
- "readonly":true,
178
- "type":"number"
179
- },
180
- "price_tax":{
181
- "description": "DEPRECATED: use tax_total",
182
- "readonly":true,
183
- "type":"number"
184
- },
185
180
  "gross_total":{
186
181
  "description": "Gross total of all line items, 2 decimals places in document currency.",
187
- "readonly":true,
182
+ "readOnly":true,
188
183
  "type":"number"
189
184
  },
190
185
  "tax_total":{
191
186
  "description": "Tax total, 2 decimals places",
192
- "readonly":true,
187
+ "readOnly":true,
193
188
  "type":"number"
194
189
  },
195
190
  "net_total":{
196
191
  "description": "Net total, 2 decimals places",
197
- "readonly":true,
192
+ "readOnly":true,
198
193
  "type":"number"
199
194
  },
200
195
  "net_total_base":{
201
196
  "description": "Net total, 6 decimal places incl. discount",
202
- "readonly":true,
197
+ "readOnly":true,
203
198
  "type":"number"
204
199
  },
205
200
  "cost_total":{
206
201
  "description": "Cost total of all line items, 2 decimals places in document currency.",
207
- "readonly":true,
202
+ "readOnly":true,
208
203
  "type":"number"
209
204
  },
210
205
  "gross_margin_total":{
211
206
  "description": "Total gross margin across all line items. Calculated from net_total-cost_total.",
212
- "readonly":true,
207
+ "readOnly":true,
213
208
  "type":"number"
214
209
  },
215
210
  "gross_margin_pct":{
216
211
  "description": "Percentage of gross profit to cost of items sold. Calculated from gross_margin_total/net_total*100",
217
- "readonly":true,
212
+ "readOnly":true,
218
213
  "type":"number"
219
214
  },
220
215
  "recurring_id":{
221
216
  "description":"Recurring document ID, if the invoice was created from a recurring.",
222
- "readonly":true,
217
+ "readOnly":true,
223
218
  "type":"string",
224
219
  "maxLength": 22,
225
220
  "minLength": 22
221
+ },
222
+ "tax_exemption_id":{
223
+ "description": "ID of a tax exemption. When set all item taxes are omitted.",
224
+ "type":"string",
225
+ "maxLength": 22,
226
+ "minLength":22
226
227
  }
227
228
  },
228
229
  "links":[
@@ -279,11 +280,6 @@
279
280
  "description": "A list of language codes, comma separated",
280
281
  "type" : "string"
281
282
  },
282
- "filter[client_ids]":{
283
- "title" : "Clients",
284
- "description": "DEPRECATED use contact_ids",
285
- "type" : "string"
286
- },
287
283
  "filter[contact_ids]":{
288
284
  "title" : "Contacts",
289
285
  "description": "Find objects belonging to a single or a list of contacts, use ids comma separated.",
@@ -349,44 +345,19 @@
349
345
  }
350
346
  },
351
347
  { "rel": "attachments",
352
- "href": "invoices/{id}/attachments"
348
+ "href": "attachments?filter[related_object_ids]={id}"
353
349
  },
354
350
  { "rel": "payments",
355
- "href": "invoices/{id}/payments"
356
- },
357
- { "rel": "payment_reminders",
358
- "href": "invoices/{id}/payment_reminders"
351
+ "href": "payments?filter[related_object_ids]={id}"
359
352
  },
360
353
  { "rel": "comments",
361
- "href": "invoices/{id}/comments"
354
+ "href": "comments?filter[related_object_ids]={id}"
362
355
  },
363
356
  { "rel": "emails",
364
- "href": "invoices/{id}/emails"
357
+ "href": "emails?filter[related_object_ids]={id}"
365
358
  },
366
- { "rel": "emails create",
367
- "href": "invoices/{id}/emails",
368
- "method": "POST",
369
- "properties" : {
370
- "template_id":{
371
- "title" : "Template",
372
- "description": "UUID of an email template to use. If present template fields like subject, body, attachments are used for the current email.",
373
- "type":"string",
374
- "maxLength": 22,
375
- "minLength":22
376
- },
377
- "send":{
378
- "title" : "Send email",
379
- "description": "Schedule email for sending. Omit this parameter or set value to 0 or false(String or Integer) to keep email as draft."
380
- },
381
- "archived_pdf":{
382
- "title" : "Attach archived pdf",
383
- "description": "Adds the archived pdf from the related resource(if it has one)."
384
- }
385
- }
386
- },
387
- { "rel": "payment create",
388
- "href": "invoices/{id}/payments",
389
- "method": "POST"
359
+ { "rel": "payment_reminders",
360
+ "href": "invoices/{id}/payment_reminders"
390
361
  },
391
362
  { "rel": "print",
392
363
  "href": "invoices/{id}/print",
@@ -394,8 +365,7 @@
394
365
  "properties" : {
395
366
  "template_id" : {
396
367
  "title" : "PDF template used for printing",
397
- "description": "UUID of a pdf template used to print the document. MUST be present",
398
- "required":true
368
+ "description": "UUID of a pdf template used to print the document. MUST be present"
399
369
  },
400
370
  "base64" : {
401
371
  "title" : "Return the created pdf base64 encoded",
@@ -1,12 +1,21 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "language",
3
- "name": "language",
4
5
  "description": "A language in SK can be assigned to documents, contacts and templates. When creating new documents, emails or PDF the language is used to select a specific template or language agnostic defaults. A language has many translations.",
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,18 @@
19
28
  "name":{
20
29
  "description": "The name of the language, shown in the interface",
21
30
  "type":"string",
22
- "required":true,
23
31
  "maxLength": 30
24
32
  },
25
33
  "created_at":{
26
34
  "description": "Date the object was created in SK. Never changes afterwards",
27
35
  "format":"date-time",
28
- "readonly":true,
36
+ "readOnly":true,
29
37
  "type":"string"
30
38
  },
31
39
  "updated_at":{
32
40
  "description": "Date the object was edited in SK.",
33
41
  "format":"date-time",
34
- "readonly":true,
42
+ "readOnly":true,
35
43
  "type":"string"
36
44
  }
37
45
  },