sk_api_schema 0.10.6 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,30 +1,36 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "pdf_template",
3
- "name": "pdf_template",
4
5
  "description":"An PDF template. For now this is a read-only resource ONLY returning your own templates. It fits the most important use-case: A user can select a print template.",
5
6
  "properties":{
6
7
  "id":{
7
8
  "description":"Unique identifier - UUID",
8
9
  "identity":true,
9
- "readonly":true,
10
+ "readOnly":true,
11
+ "type":"string",
12
+ "maxLength": 22,
13
+ "minLength":22
14
+ },
15
+ "company_id":{
16
+ "description":"Company",
17
+ "readOnly":true,
10
18
  "type":"string",
11
19
  "maxLength": 22,
12
20
  "minLength":22
13
21
  },
14
22
  "name":{
15
23
  "description": "Name of the template as shown to the user.",
16
- "required":true,
17
24
  "type":"string",
18
25
  "maxLength": 50
19
26
  },
20
27
  "description":{
21
28
  "description": "Additional information about the template.",
22
29
  "type":"string",
23
- "format":"text"
30
+ "format":"string"
24
31
  },
25
32
  "kind":{
26
33
  "description": "Kind of object the template can be used for.",
27
- "required":true,
28
34
  "enum": ["invoice", "estimate", "credit_note", "payment_reminder", "order"],
29
35
  "type":"string"
30
36
  },
@@ -36,13 +42,13 @@
36
42
  "created_at":{
37
43
  "description": "Date the object was created in SK. Never changes afterwards",
38
44
  "format":"date-time",
39
- "readonly":true,
45
+ "readOnly":true,
40
46
  "type":"string"
41
47
  },
42
48
  "updated_at":{
43
49
  "description": "Date the object was edited in SK.",
44
50
  "format":"date-time",
45
- "readonly":true,
51
+ "readOnly":true,
46
52
  "type":"string"
47
53
  },
48
54
  "team_id":{
@@ -1,12 +1,21 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "product",
3
- "name": "product",
4
5
  "description": "A product in SK",
6
+ "required": ["price", "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,13 +28,12 @@
19
28
  "name":{
20
29
  "description": "The name of the product",
21
30
  "type":"string",
22
- "required":true,
23
31
  "maxLength": 50
24
32
  },
25
33
  "description":{
26
34
  "description": "Product description",
27
35
  "type":"string",
28
- "format":"text"
36
+ "format":"string"
29
37
  },
30
38
  "tag_list":{
31
39
  "description": "Space separated list of tags. Are split and saved as Tag objects on create, update.",
@@ -33,8 +41,7 @@
33
41
  },
34
42
  "price":{
35
43
  "description": "Net price of a single product. Max 6 decimal places.",
36
- "type":"number",
37
- "required":true
44
+ "type":"number"
38
45
  },
39
46
  "cost":{
40
47
  "description": "Cost price of a single product. Max 6 decimal places.",
@@ -57,13 +64,13 @@
57
64
  "created_at":{
58
65
  "description": "Date the object was created in SK. Never changes afterwards",
59
66
  "format":"date-time",
60
- "readonly":true,
67
+ "readOnly":true,
61
68
  "type":"string"
62
69
  },
63
70
  "updated_at":{
64
71
  "description": "Date the object was edited in SK.",
65
72
  "format":"date-time",
66
- "readonly":true,
73
+ "readOnly":true,
67
74
  "type":"string"
68
75
  },
69
76
  "team_id":{
@@ -71,10 +78,6 @@
71
78
  "type":"string",
72
79
  "maxLength": 22,
73
80
  "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
81
  }
79
82
  },
80
83
  "links":[
@@ -1,12 +1,21 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "recurring",
3
- "name": "recurring",
4
5
  "description": "An recurring is used as an template for new invoices.",
6
+ "required": ["number", "date", "final_date", "frequency" ],
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
@@ -14,7 +23,6 @@
14
23
  "number":{
15
24
  "description": "Unique name to identify the document. Unlike all other document this one has no number schema and not auto assign",
16
25
  "type":"string",
17
- "required":true,
18
26
  "maxLength": 50
19
27
  },
20
28
  "address_field":{
@@ -24,8 +32,7 @@
24
32
  "date":{
25
33
  "description": "First date the recurring is issued. Not allowed to be in the past. YYYY-MM-DD",
26
34
  "format":"date",
27
- "type":"string",
28
- "required":true
35
+ "type":"string"
29
36
  },
30
37
  "due_days":{
31
38
  "description": "Used to calculate the due date of the recurring. Useless if date and due date are present.",
@@ -34,14 +41,12 @@
34
41
  "final_date":{
35
42
  "description": "The last date the recurring is executed. YYYY-MM-DD",
36
43
  "format":"date",
37
- "type":"string",
38
- "required":true
44
+ "type":"string"
39
45
  },
40
46
  "frequency":{
41
47
  "description": "Recurring frequency",
42
48
  "enum":["yearly", "monthly", "weekly", "quarterly", "biweekly", "sixmonthly"],
43
- "type":"string",
44
- "required":true
49
+ "type":"string"
45
50
  },
46
51
  "payment_method":{
47
52
  "description": "How the document is being payed. Used in new payments.",
@@ -61,12 +66,12 @@
61
66
  "notes_before":{
62
67
  "description": "Notes shown before the line items. Normally contains salutation and other introductional information. SK placeholders can be used.",
63
68
  "type":"string",
64
- "format":"text"
69
+ "format":"string"
65
70
  },
66
71
  "notes_after":{
67
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.",
68
73
  "type":"string",
69
- "format":"text"
74
+ "format":"string"
70
75
  },
71
76
  "tag_list":{
72
77
  "description": "Space separated list of tags. Are split and saved as Tag objects on create, update.",
@@ -98,23 +103,11 @@
98
103
  "type":"string",
99
104
  "enum":["FRST","OOFF","RCUR","FNAL"]
100
105
  },
101
- "client":{
102
- "description": "DEPRECATED: use contact",
103
- "readonly":true,
104
- "type":"object",
105
- "properties":{"$ref":"./client.json#properties"}
106
- },
107
- "client_id":{
108
- "description": "DEPRECATED: use contact_id",
109
- "type":"string",
110
- "maxLength": 22,
111
- "minLength":22
112
- },
113
106
  "contact":{
114
107
  "description": "The contact for the document. Use contact_id field to set a contact.",
115
- "readonly":true,
108
+ "readOnly":true,
116
109
  "type":"object",
117
- "properties":{"$ref":"./contact.json#properties"}
110
+ "$ref":"./contact.json#"
118
111
  },
119
112
  "contact_id":{
120
113
  "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.",
@@ -124,74 +117,83 @@
124
117
  },
125
118
  "team_id":{
126
119
  "description": "A team uuid taken from the contact. If set only the team and its parent teams can see the record.",
127
- "readonly" :true,
120
+ "readOnly" :true,
128
121
  "type":"string",
129
122
  "maxLength": 22,
130
123
  "minLength":22
131
124
  },
132
- "line_items":{
133
- "description": "DEPRECATED use items",
134
- "type":"array",
135
- "properties":{"$ref":"./line_item.json#properties"}
136
- },
137
125
  "items":{
138
- "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.",
126
+ "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.",
139
127
  "type":"array",
140
- "default": "any",
141
128
  "minItems": 0,
142
- "items": [{ "$ref": "./line_item.json#properties"},
143
- { "$ref": "./divider_item.json#properties"},
144
- { "$ref": "./sub_total_item.json#properties"}]
129
+ "items": {
130
+ "type" : "object",
131
+ "anyOf" : [
132
+ {
133
+ "title": "line_item",
134
+ "$ref": "./line_item.json#"
135
+ },
136
+ {
137
+ "title": "divider_item",
138
+ "$ref": "./divider_item.json#"
139
+ },
140
+ {
141
+ "title": "sub_total_item",
142
+ "$ref": "./sub_total_item.json#"
143
+ }
144
+ ]
145
+ }
145
146
  },
146
147
  "created_at":{
147
148
  "description": "Date the object was created in SK. Never changes afterwards.",
148
149
  "format":"date-time",
149
- "readonly":true,
150
+ "readOnly":true,
150
151
  "type":"string"
151
152
  },
152
153
  "updated_at":{
153
154
  "description": "Date the object was edited in SK.",
154
155
  "format":"date-time",
155
- "readonly":true,
156
+ "readOnly":true,
156
157
  "type":"string"
157
158
  },
158
159
  "lock_version":{
159
- "description": "Auto-incremented to prevent concurrent updates. First save wins and increments version. ",
160
+ "description": "Auto-incremented to prevent concurrent updates. First save wins and increments version.",
161
+ "readOnly":true,
160
162
  "type":"integer"
161
163
  },
162
164
  "gross_total":{
163
165
  "description": "Gross total of all line items, 2 decimals places",
164
- "readonly":true,
166
+ "readOnly":true,
165
167
  "type":"number"
166
168
  },
167
169
  "tax_total":{
168
170
  "description": "Tax total, 2 decimals places",
169
- "readonly":true,
171
+ "readOnly":true,
170
172
  "type":"number"
171
173
  },
172
174
  "net_total":{
173
175
  "description": "Net total, 2 decimals places",
174
- "readonly":true,
176
+ "readOnly":true,
175
177
  "type":"number"
176
178
  },
177
179
  "net_total_base":{
178
180
  "description": "Net total, 6 decimal places incl. discount",
179
- "readonly":true,
181
+ "readOnly":true,
180
182
  "type":"number"
181
183
  },
182
184
  "cost_total":{
183
185
  "description": "Cost total of all line items, 2 decimals places in document currency.",
184
- "readonly":true,
186
+ "readOnly":true,
185
187
  "type":"number"
186
188
  },
187
189
  "gross_margin_total":{
188
190
  "description": "Total gross margin across all line items. Calculated from net_total-cost_total.",
189
- "readonly":true,
191
+ "readOnly":true,
190
192
  "type":"number"
191
193
  },
192
194
  "gross_margin_pct":{
193
195
  "description": "Percentage of gross profit to cost of items sold. Calculated from gross_margin_total/net_total*100",
194
- "readonly":true,
196
+ "readOnly":true,
195
197
  "type":"number"
196
198
  },
197
199
  "pdf_template_id":{
@@ -211,6 +213,12 @@
211
213
  "default": null,
212
214
  "type": "string",
213
215
  "enum":["email"]
216
+ },
217
+ "tax_exemption_id":{
218
+ "description": "ID of a tax exemption. When set all item taxes are omitted.",
219
+ "type":"string",
220
+ "maxLength": 22,
221
+ "minLength":22
214
222
  }
215
223
  },
216
224
  "links":[
@@ -269,11 +277,6 @@
269
277
  "description": "A list of language codes, comma separated",
270
278
  "type" : "string"
271
279
  },
272
- "filter[client_ids]":{
273
- "title" : "Clients",
274
- "description": "DEPRECATED use contact_ids",
275
- "type" : "string"
276
- },
277
280
  "filter[contact_ids]":{
278
281
  "title" : "Contacts",
279
282
  "description": "Find objects belonging to a single or a list of contacts, use ids comma separated.",
@@ -331,10 +334,10 @@
331
334
  "href": "invoices?filter[recurring_ids]={id}"
332
335
  },
333
336
  { "rel": "attachments",
334
- "href": "recurrings/{id}/attachments"
337
+ "href": "attachments?filter[related_object_ids]={id}"
335
338
  },
336
339
  { "rel": "comments",
337
- "href": "recurrings/{id}/comments"
340
+ "href": "comments?filter[related_object_ids]={id}"
338
341
  }
339
342
  ]
340
343
  }
@@ -1,19 +1,27 @@
1
- {"type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "sub",
3
- "name": "sub",
4
5
  "description": "Subscribe to push notifications(webhooks) about object livecycle events like new, update or delete. Only returns subscription for the current app, so you MUST be using oAuth. When a user removes your app its subs are also deleted. <br/>To register you must supply <br/>- callback_url: receives a base64 encode string containing a JSON object with the object in it's latest state, the user_id & subdomain, company_id, hmac-signed with your app secret.<br/>- channel: defining the event, made up of the SINGULAR object name and the action: invoice.delete, payment.new<br/> - register auth_permissions: An app MUST request non-api permissions f.ex.: clients:create. Perms(on company,app,user,team) are checked before any publishing, so if a user cannot create clients in the interface, his apps will not receive any callbacks.",
6
+ "required": ["channel", "callback_url"],
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
  "channel":{
15
24
  "description": "The channel to which to subscribe. See available at subs/channels.",
16
- "required":true,
17
25
  "type":"string",
18
26
  "maxLength": 100
19
27
  },
@@ -21,19 +29,18 @@
21
29
  "description": "An url receiving the notification. The url MUST be within the url of the current app and receives a POST with a single signed_request parameter containing an base64 encoded JSON object.",
22
30
  "type":"string",
23
31
  "format":"uri",
24
- "required":true,
25
32
  "maxLength": 100
26
33
  },
27
34
  "created_at":{
28
35
  "description": "Date the record was created in SK. Never changes afterwards.",
29
36
  "format":"date-time",
30
- "readonly":true,
37
+ "readOnly":true,
31
38
  "type":"string"
32
39
  },
33
40
  "updated_at":{
34
41
  "description": "Last date when the record was edited.",
35
42
  "format":"date-time",
36
- "readonly":true,
43
+ "readOnly":true,
37
44
  "type":"string"
38
45
  }
39
46
  },
@@ -1,20 +1,21 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "sub_total_item",
3
- "name": "sub_total_item",
4
5
  "description": "A sub-total item shows a sum of the previous line items, e.g. to distinguish hardware and service costs on a document.",
6
+ "required" : ["position"],
5
7
  "properties":{
6
8
  "id":{
7
9
  "description":"Unique identifier - UUID",
8
10
  "identity":true,
9
- "readonly":true,
11
+ "readOnly":true,
10
12
  "type":"string",
11
13
  "maxLength": 22,
12
14
  "minLength":22
13
15
  },
14
16
  "position":{
15
17
  "description": "Required since items are sorted by position.",
16
- "type":"integer",
17
- "required":true
18
+ "type":"integer"
18
19
  },
19
20
  "name":{
20
21
  "description": "Title of the sub-total e.g. Hardware total",
@@ -29,23 +30,23 @@
29
30
  "net_total":{
30
31
  "description": "Net sub-total",
31
32
  "type":"number",
32
- "readonly":true
33
+ "readOnly":true
33
34
  },
34
35
  "gross_total":{
35
36
  "description": "Gross sub-total",
36
37
  "type":"number",
37
- "readonly":true
38
+ "readOnly":true
38
39
  },
39
40
  "created_at":{
40
41
  "description": "Date the object was created in SK. Never changes afterwards",
41
42
  "format":"date-time",
42
- "readonly":true,
43
+ "readOnly":true,
43
44
  "type":"string"
44
45
  },
45
46
  "updated_at":{
46
47
  "description": "Date the object was edited in SK.",
47
48
  "format":"date-time",
48
- "readonly":true,
49
+ "readOnly":true,
49
50
  "type":"string"
50
51
  },
51
52
  "_destroy":{