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,20 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "credit_note",
3
- "name": "credit_note",
4
5
  "description": "A credit note",
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
@@ -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,37 +90,25 @@
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"}
98
- },
99
- "client":{
100
- "description": "DEPRECATED: use contact",
101
- "readonly":true,
102
- "type":"object",
103
- "properties":{"$ref":"./client.json#properties"}
104
- },
105
- "client_id":{
106
- "description": "DEPRECATED: use contact_id",
107
- "type":"string",
108
- "maxLength": 22,
109
- "minLength":22
105
+ "$ref":"./attachment.json"
110
106
  },
111
107
  "contact":{
112
108
  "description": "The contact for the document. Use contact_id field to set a contact.",
113
- "readonly":true,
109
+ "readOnly":true,
114
110
  "type":"object",
115
- "properties":{"$ref":"./contact.json#properties"}
111
+ "$ref":"./contact.json#"
116
112
  },
117
113
  "contact_id":{
118
114
  "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.",
@@ -122,85 +118,90 @@
122
118
  },
123
119
  "team_id":{
124
120
  "description": "A team uuid taken from the contact. If set only the team and its parent teams can see the record.",
125
- "readonly" :true,
121
+ "readOnly" :true,
126
122
  "type":"string",
127
123
  "maxLength": 22,
128
124
  "minLength":22
129
125
  },
130
- "line_items":{
131
- "description": "DEPRECATED use items",
132
- "type":"array",
133
- "properties":{"$ref":"./line_item.json#properties"}
134
- },
135
126
  "items":{
136
- "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.",
127
+ "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.",
137
128
  "type":"array",
138
- "default": "any",
139
129
  "minItems": 0,
140
- "items": [{ "$ref": "./line_item.json#properties"},
141
- { "$ref": "./divider_item.json#properties"},
142
- { "$ref": "./sub_total_item.json#properties"}]
130
+ "items": {
131
+ "type" : "object",
132
+ "anyOf" : [
133
+ {
134
+ "title": "line_item",
135
+ "$ref": "./line_item.json#"
136
+ },
137
+ {
138
+ "title": "divider_item",
139
+ "$ref": "./divider_item.json#"
140
+ },
141
+ {
142
+ "title": "sub_total_item",
143
+ "$ref": "./sub_total_item.json#"
144
+ }
145
+ ]
146
+ }
143
147
  },
144
148
  "created_at":{
145
149
  "description": "Date the object was created in SK. Never changes afterwards.",
146
150
  "format":"date-time",
147
- "readonly":true,
151
+ "readOnly":true,
148
152
  "type":"string"
149
153
  },
150
154
  "updated_at":{
151
155
  "description": "Date the object was edited in SK.",
152
156
  "format":"date-time",
153
- "readonly":true,
157
+ "readOnly":true,
154
158
  "type":"string"
155
159
  },
156
160
  "lock_version":{
157
161
  "description": "Auto-incremented to prevent concurrent updates. First save wins.",
162
+ "readOnly":true,
158
163
  "type":"integer"
159
164
  },
160
- "price_total":{
161
- "description": "DEPRECATED: use net_total_base",
162
- "readonly":true,
163
- "type":"number"
164
- },
165
- "price_tax":{
166
- "description": "DEPRECATED: use tax_total",
167
- "readonly":true,
168
- "type":"number"
169
- },
170
165
  "gross_total":{
171
166
  "description": "Gross total of all line items, 2 decimals places in document currency.",
172
- "readonly":true,
167
+ "readOnly":true,
173
168
  "type":"number"
174
169
  },
175
170
  "tax_total":{
176
171
  "description": "Tax total, 2 decimals places",
177
- "readonly":true,
172
+ "readOnly":true,
178
173
  "type":"number"
179
174
  },
180
175
  "net_total":{
181
176
  "description": "Net total, 2 decimals places",
182
- "readonly":true,
177
+ "readOnly":true,
183
178
  "type":"number"
184
179
  },
185
180
  "net_total_base":{
186
181
  "description": "Net total, 6 decimal places incl. discount",
187
- "readonly":true,
182
+ "readOnly":true,
188
183
  "type":"number"
189
184
  },
190
185
  "cost_total":{
191
186
  "description": "Cost total of all line items, 2 decimals places in document currency.",
192
- "readonly":true,
187
+ "readOnly":true,
193
188
  "type":"number"
194
189
  },
195
190
  "gross_margin_total":{
196
191
  "description": "Total gross margin across all line items. Calculated from net_total-cost_total.",
197
- "readonly":true,
192
+ "readOnly":true,
198
193
  "type":"number"
199
194
  },
200
195
  "gross_margin_pct":{
201
196
  "description": "Percentage of gross profit to cost of items sold. Calculated from gross_margin_total/net_total*100",
202
- "readonly":true,
197
+ "readOnly":true,
203
198
  "type":"number"
199
+ },
200
+ "tax_exemption_id":{
201
+ "description": "ID of a tax exemption. When set all item taxes are omitted.",
202
+ "type":"string",
203
+ "maxLength": 22,
204
+ "minLength":22
204
205
  }
205
206
  },
206
207
  "links":[
@@ -325,41 +326,16 @@
325
326
  }
326
327
  },
327
328
  { "rel": "attachments",
328
- "href": "credit_notes/{id}/attachments"
329
+ "href": "attachments?filter[related_object_ids]={id}"
329
330
  },
330
331
  { "rel": "payments",
331
- "href": "credit_notes/{id}/payments"
332
+ "href": "payments?filter[related_object_ids]={id}"
332
333
  },
333
334
  { "rel": "comments",
334
- "href": "credit_notes/{id}/comments"
335
+ "href": "comments?filter[related_object_ids]={id}"
335
336
  },
336
337
  { "rel": "emails",
337
- "href": "credit_notes/{id}/emails"
338
- },
339
- { "rel": "emails create",
340
- "href": "credit_notes/{id}/emails",
341
- "method": "POST",
342
- "properties" : {
343
- "template_id":{
344
- "title" : "Template",
345
- "description": "UUID of an email template to use. If present template fields like subject, body, attachments are used for the current email.",
346
- "type":"string",
347
- "maxLength": 22,
348
- "minLength":22
349
- },
350
- "send":{
351
- "title" : "Send email",
352
- "description": "Schedule email for sending. Omit this parameter or set value to 0 or false(String or Integer) to keep email as draft."
353
- },
354
- "archived_pdf":{
355
- "title" : "Attach archived pdf",
356
- "description": "Adds the archived pdf from the related resource(if it has one)."
357
- }
358
- }
359
- },
360
- { "rel": "payment create",
361
- "href": "invoices/{id}/payments",
362
- "method": "POST"
338
+ "href": "emails?filter[related_object_ids]={id}"
363
339
  },
364
340
  { "rel": "print",
365
341
  "href": "credit_notes/{id}/print",
@@ -367,8 +343,7 @@
367
343
  "properties" : {
368
344
  "template_id" : {
369
345
  "title" : "PDF template used for printing",
370
- "description": "UUID of a pdf template used to print the document. MUST be present",
371
- "required":true
346
+ "description": "UUID of a pdf template used to print the document. MUST be present"
372
347
  },
373
348
  "base64" : {
374
349
  "title" : "Return the created pdf base64 encoded",
@@ -1,20 +1,21 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "divider_item",
3
- "name": "divider_item",
4
- "description": "A divider item serves as a separator or headline between line items, e.g. to distinguish hardware and service products on a document. Access and creation is done via documents.items(instead of line_items) where each item has a 'type' field set to its CamelCased class name.",
5
+ "description": "A divider item serves as a separator or headline between line items, e.g. to distinguish hardware and service products on a document. Access and creation is done via documents.items where each item has a 'type' field containing the CamelCased class name.",
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": "The divider text",
@@ -29,13 +30,13 @@
29
30
  "created_at":{
30
31
  "description": "Date the object was created in SK. Never changes afterwards",
31
32
  "format":"date-time",
32
- "readonly":true,
33
+ "readOnly":true,
33
34
  "type":"string"
34
35
  },
35
36
  "updated_at":{
36
37
  "description": "Date the object was edited in SK.",
37
38
  "format":"date-time",
38
- "readonly":true,
39
+ "readOnly":true,
39
40
  "type":"string"
40
41
  },
41
42
  "_destroy":{
@@ -1,16 +1,24 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "document",
3
- "name": "document",
4
- "description": "This resource is readonly and serves as a convenient way to query documents independent of their type(invoice, order,..). The specific document type is set in each object in the result-set. Internally Document is the base class for all types and special fields are defined in each child-class. Due to this some fields might be missing if you are using this meta-class in queries.",
5
+ "description": "This resource is readOnly and serves as a convenient way to query documents independent of their type(invoice, order,..). The specific document type is set in each object in the result-set. Internally Document is the base class for all types and special fields are defined in each child-class. Due to this some fields might be missing if you are using this meta-class in queries.",
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
  "object_type":{
15
23
  "description": "The specific type of the document singular CamelCased: Invoice, PaymentReminder",
16
24
  "type":"string"
@@ -42,23 +50,17 @@
42
50
  "notes_before":{
43
51
  "description": "Notes shown before the line items. Normally contains salutation and other introductional information. SK placeholders can be used.",
44
52
  "type":"string",
45
- "format":"text"
53
+ "format":"string"
46
54
  },
47
55
  "notes_after":{
48
56
  "description": "Notes shown after the line items. Can contain information about payments, bank account or a thank-you message. SK placeholders can be used.",
49
57
  "type":"string",
50
- "format":"text"
58
+ "format":"string"
51
59
  },
52
60
  "tag_list":{
53
61
  "description": "Space separated list of tags. Are split and saved as Tag objects on create, update.",
54
62
  "type":"string"
55
63
  },
56
- "client_id":{
57
- "description": "DEPRECATED: use contact_id",
58
- "type":"string",
59
- "maxLength": 22,
60
- "minLength":22
61
- },
62
64
  "contact_id":{
63
65
  "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.",
64
66
  "type":"string",
@@ -67,55 +69,63 @@
67
69
  },
68
70
  "team_id":{
69
71
  "description": "A team uuid taken from the contact. If set only the team and its parent teams can see the record.",
70
- "readonly" :true,
72
+ "readOnly" :true,
71
73
  "type":"string",
72
74
  "maxLength": 22,
73
75
  "minLength":22
74
76
  },
75
- "line_items":{
76
- "description": "Line items for the document",
77
- "type":"array",
78
- "items":{"$ref":"./line_items.json#properties"}
79
- },
80
77
  "items":{
81
- "description": "Items for the document. Access items of all types including divider and sub_total items.",
78
+ "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.",
82
79
  "type":"array",
83
- "default": "any",
84
80
  "minItems": 0,
85
- "items": [{ "$ref": "./line_item.json#properties"},
86
- { "$ref": "./divider_item.json#properties"},
87
- { "$ref": "./sub_total_item.json#properties"}]
81
+ "items": {
82
+ "type" : "object",
83
+ "anyOf" : [
84
+ {
85
+ "title": "line_item",
86
+ "$ref": "./line_item.json#"
87
+ },
88
+ {
89
+ "title": "divider_item",
90
+ "$ref": "./divider_item.json#"
91
+ },
92
+ {
93
+ "title": "sub_total_item",
94
+ "$ref": "./sub_total_item.json#"
95
+ }
96
+ ]
97
+ }
88
98
  },
89
99
  "created_at":{
90
100
  "description": "Date the object was created in SK. Never changes afterwards.",
91
101
  "format":"date-time",
92
- "readonly":true,
102
+ "readOnly":true,
93
103
  "type":"string"
94
104
  },
95
105
  "updated_at":{
96
106
  "description": "Date the object was edited in SK.",
97
107
  "format":"date-time",
98
- "readonly":true,
108
+ "readOnly":true,
99
109
  "type":"string"
100
110
  },
101
111
  "gross_total":{
102
112
  "description": "Gross total of all line items, 2 decimals places in document currency.",
103
- "readonly":true,
113
+ "readOnly":true,
104
114
  "type":"number"
105
115
  },
106
116
  "tax_total":{
107
117
  "description": "Tax total, 2 decimals places",
108
- "readonly":true,
118
+ "readOnly":true,
109
119
  "type":"number"
110
120
  },
111
121
  "net_total":{
112
122
  "description": "Net total, 2 decimals places",
113
- "readonly":true,
123
+ "readOnly":true,
114
124
  "type":"number"
115
125
  },
116
126
  "net_total_base":{
117
127
  "description": "Net total, 6 decimal places incl. discount",
118
- "readonly":true,
128
+ "readOnly":true,
119
129
  "type":"number"
120
130
  },
121
131
  "currency":{
@@ -126,12 +136,12 @@
126
136
  },
127
137
  "exchange_rate":{
128
138
  "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. ",
129
- "readonly":true,
139
+ "readOnly":true,
130
140
  "type":"number"
131
141
  },
132
142
  "gross_total_exchanged":{
133
143
  "description": "Exchanged gross total, in your company currency.",
134
- "readonly":true,
144
+ "readOnly":true,
135
145
  "type":"number"
136
146
  },
137
147
  "language":{
@@ -202,11 +212,6 @@
202
212
  "description": "A list of language codes, comma separated",
203
213
  "type" : "string"
204
214
  },
205
- "filter[client_ids]":{
206
- "title" : "Clients",
207
- "description": "DEPRECATED use contact_ids",
208
- "type" : "string"
209
- },
210
215
  "filter[contact_ids]":{
211
216
  "title" : "Contacts",
212
217
  "description": "Find objects belonging to a single or a list of contacts, use ids comma separated.",