sk_api_schema 0.10.5 → 0.10.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -1
  3. data/README.rdoc +1 -1
  4. data/json/v1.0/account.json +2 -2
  5. data/json/v1.0/contact.json +2 -2
  6. data/json/v1.0/line_item.json +3 -3
  7. data/json/v1.0/product.json +2 -2
  8. data/json/v1.0/sub.json +3 -3
  9. data/json/v2.0/account.json +172 -0
  10. data/json/v2.0/account_billing.json +131 -0
  11. data/json/v2.0/account_entry.json +212 -0
  12. data/json/v2.0/address.json +85 -0
  13. data/json/v2.0/attachment.json +133 -0
  14. data/json/v2.0/auth_permission.json +75 -0
  15. data/json/v2.0/client.json +318 -0
  16. data/json/v2.0/comment.json +122 -0
  17. data/json/v2.0/company.json +141 -0
  18. data/json/v2.0/contact.json +418 -0
  19. data/json/v2.0/credit_note.json +380 -0
  20. data/json/v2.0/divider_item.json +47 -0
  21. data/json/v2.0/document.json +240 -0
  22. data/json/v2.0/email.json +191 -0
  23. data/json/v2.0/email_template.json +132 -0
  24. data/json/v2.0/estimate.json +408 -0
  25. data/json/v2.0/export.json +142 -0
  26. data/json/v2.0/export_template.json +100 -0
  27. data/json/v2.0/invoice.json +407 -0
  28. data/json/v2.0/language.json +82 -0
  29. data/json/v2.0/line_item.json +121 -0
  30. data/json/v2.0/order.json +373 -0
  31. data/json/v2.0/payment.json +148 -0
  32. data/json/v2.0/payment_reminder.json +301 -0
  33. data/json/v2.0/pdf_template.json +99 -0
  34. data/json/v2.0/product.json +144 -0
  35. data/json/v2.0/recurring.json +340 -0
  36. data/json/v2.0/sub.json +60 -0
  37. data/json/v2.0/sub_total_item.json +57 -0
  38. data/json/v2.0/tag.json +76 -0
  39. data/json/v2.0/task.json +229 -0
  40. data/json/v2.0/text_template.json +95 -0
  41. data/json/v2.0/user.json +103 -0
  42. data/lib/sk_api_schema/version.rb +1 -1
  43. metadata +35 -2
@@ -0,0 +1,82 @@
1
+ { "type":"object",
2
+ "title": "language",
3
+ "name": "language",
4
+ "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.",
5
+ "properties":{
6
+ "id":{
7
+ "description":"Unique identifier - UUID",
8
+ "identity":true,
9
+ "readonly":true,
10
+ "type":"string",
11
+ "maxLength": 22,
12
+ "minLength":22
13
+ },
14
+ "code":{
15
+ "description": "Language short-code",
16
+ "type":"string",
17
+ "maxLength": 10
18
+ },
19
+ "name":{
20
+ "description": "The name of the language, shown in the interface",
21
+ "type":"string",
22
+ "required":true,
23
+ "maxLength": 30
24
+ },
25
+ "created_at":{
26
+ "description": "Date the object was created in SK. Never changes afterwards",
27
+ "format":"date-time",
28
+ "readonly":true,
29
+ "type":"string"
30
+ },
31
+ "updated_at":{
32
+ "description": "Date the object was edited in SK.",
33
+ "format":"date-time",
34
+ "readonly":true,
35
+ "type":"string"
36
+ }
37
+ },
38
+ "links":[
39
+ { "rel": "self",
40
+ "href": "languages/{id}"
41
+ },
42
+ { "rel": "instances",
43
+ "href": "languages",
44
+ "properties" : {
45
+ "page":{
46
+ "title" : "Page",
47
+ "description": "In paginated results set the page to look for",
48
+ "type":"number"
49
+ },
50
+ "per_page":{
51
+ "title" : "Per page",
52
+ "description": "Results per page. Default is 50, max is 200",
53
+ "type":"number"
54
+ },
55
+ "sort_by":{
56
+ "title" : "Sort by",
57
+ "description": "Sort the results by the given field => code",
58
+ "enum":["name","code", "created_at", "updated_at"],
59
+ "type": "string"
60
+ },
61
+ "sort":{
62
+ "title" : "Sort",
63
+ "enum":["ASC","DESC"],
64
+ "description": "Sort the results in ASC or DESC",
65
+ "type": "string"
66
+ }
67
+ }
68
+ },
69
+ { "rel": "destroy",
70
+ "href": "languages/{id}",
71
+ "method": "DELETE"
72
+ },
73
+ { "rel": "update",
74
+ "href": "languages/{id}",
75
+ "method": "PUT"
76
+ },
77
+ { "rel": "create",
78
+ "href": "languages",
79
+ "method": "POST"
80
+ }
81
+ ]
82
+ }
@@ -0,0 +1,121 @@
1
+ { "type":"object",
2
+ "title": "line_item",
3
+ "name": "line_item",
4
+ "description": "A line item for a document",
5
+ "properties":{
6
+ "id":{
7
+ "description":"Unique identifier - UUID",
8
+ "identity":true,
9
+ "readonly":true,
10
+ "type":"string",
11
+ "maxLength": 22,
12
+ "minLength":22
13
+ },
14
+ "position":{
15
+ "description": "Position by which the items are sorted. Two items can have the same position(if you dont care) and numbers dont need to continuous",
16
+ "type":"integer",
17
+ "default": 1
18
+ },
19
+ "name":{
20
+ "description": "The name of an item",
21
+ "type":"string",
22
+ "maxLength": 50
23
+ },
24
+ "type":{
25
+ "description": "The item type: LineItem. Must be set when creating new items via document.items array",
26
+ "type":"string",
27
+ "maxLength": 20
28
+ },
29
+ "external_ref":{
30
+ "description": "Arbitrary number e.g. external product reference.",
31
+ "type":"string",
32
+ "maxLength": 255
33
+ },
34
+ "description":{
35
+ "description": "Item description",
36
+ "type":"string",
37
+ "format": "text"
38
+ },
39
+ "price_single":{
40
+ "description": "Net price of a single item. If a product id is given, price_single is taken from the product if not set. Max 6 decimal places.",
41
+ "type":"number",
42
+ "required" : true
43
+ },
44
+ "cost":{
45
+ "description": "Cost price for a single item. Used to calculate the gross margin. Max 6 decimal places.",
46
+ "type":"number"
47
+ },
48
+ "cost_total":{
49
+ "description": "Total costs. Calculated from cost_single * quantity",
50
+ "readonly":true,
51
+ "type":"number"
52
+ },
53
+ "gross_margin_total":{
54
+ "description": "Gross margin, the difference between revenue and cost before accounting for certain other costs. Calculated from net_total - cost_total",
55
+ "readonly":true,
56
+ "type":"number"
57
+ },
58
+ "gross_margin_pct":{
59
+ "description": "Gross margin percentage. Calculated from gross_margin_total/cost_total",
60
+ "readonly":true,
61
+ "type":"number"
62
+ },
63
+ "net_total":{
64
+ "description": "Net price of a single item. Calculated from price_single * quantity * discount",
65
+ "readonly":true,
66
+ "type":"number"
67
+ },
68
+ "gross_total":{
69
+ "description": "Gross price. Net total with taxes applied.",
70
+ "readonly":true,
71
+ "type":"number"
72
+ },
73
+ "tax":{
74
+ "description": "Tax percent for a single item.",
75
+ "type":"number"
76
+ },
77
+ "discount":{
78
+ "description": "Discount in percent applied to the items net total. Can also be negative if you want to add additional charges.",
79
+ "type":"number"
80
+ },
81
+ "quantity_unit":{
82
+ "description": "Quantity unit: kg, days, month.",
83
+ "type":"string",
84
+ "maxLength": 30
85
+ },
86
+ "quantity":{
87
+ "description": "Quantity of the item. Must be >= 0. Max 6 decimal places.",
88
+ "type":"number",
89
+ "minimum":0,
90
+ "default": 1
91
+ },
92
+ "product_id":{
93
+ "description": "A uuid of a product, used by this item. If set or changed, the product fields (name, description, quantity, unit, price, cost price) are copied if the according item fields are missing/blank. Besides this product link makes it possible to track a products turnover and find the documents it is used on.",
94
+ "type":"string",
95
+ "maxLength": 22,
96
+ "minLength":22
97
+ },
98
+ "product_from_line_item":{
99
+ "description": "Saves and associates an instance of a Product from LineItem fields (name, description, quantity, unit, price, cost price), if no Product association is found. Accepted values to trigger this behaviour: 1, true",
100
+ "type":"boolean",
101
+ "default": false
102
+ },
103
+ "created_at":{
104
+ "description": "Date the object was created in SK. Never changes afterwards",
105
+ "format":"date-time",
106
+ "readonly":true,
107
+ "type":"string"
108
+ },
109
+ "updated_at":{
110
+ "description": "Date the object was edited in SK.",
111
+ "format":"date-time",
112
+ "readonly":true,
113
+ "type":"string"
114
+ },
115
+ "_destroy":{
116
+ "description": "When set an existing item will be deleted. This switch is used for items passed-in nested inside their parent object(a document), which is default as long as there is no line item endpoint available.",
117
+ "type":"boolean"
118
+ }
119
+ },
120
+ "links":[]
121
+ }
@@ -0,0 +1,373 @@
1
+ { "type":"object",
2
+ "title": "order",
3
+ "name": "order",
4
+ "description": "An order",
5
+ "properties":{
6
+ "id":{
7
+ "description":"Unique identifier - UUID",
8
+ "identity":true,
9
+ "readonly":true,
10
+ "type":"string",
11
+ "maxLength": 22,
12
+ "minLength":22
13
+ },
14
+ "number":{
15
+ "description": "Unique number assigned by SK order number schema. Auto-assigned when order is opened. Required unless doc status is draft.",
16
+ "type":"string",
17
+ "maxLength": 50
18
+ },
19
+ "address_field":{
20
+ "description": "Receiver address, normally shown in envelope window. Defaults to client address_field if empty and client_id present.",
21
+ "type":"string"
22
+ },
23
+ "date":{
24
+ "description": "Date the order is issued. Automatically set when order is opened. Required for non-draft documents. YYYY-MM-DD",
25
+ "format":"date",
26
+ "type":"string"
27
+ },
28
+ "due_days":{
29
+ "description": "Used to calculate the due date for the document. Useless if date and due date are present.",
30
+ "type":"integer"
31
+ },
32
+ "due_date":{
33
+ "description": "Auto-calculated from date + due days if empty and the document is opened. YYYY-MM-DD",
34
+ "format":"date",
35
+ "type":"string"
36
+ },
37
+ "status":{
38
+ "description": "Defaults to draft for new documents, unless otherwise stated. For new documents with status 'open' or 'closed' or doc where the status changes away from draft, following fields are set if empty: number(next in number schema), date(today), due date(due_days must be given). Only draft documents can be deleted.",
39
+ "default":"draft",
40
+ "enum":["draft","open","closed"],
41
+ "type":"string"
42
+ },
43
+ "external_ref":{
44
+ "description": "Some external reference, whatever this may be.",
45
+ "type":"string",
46
+ "maxLength": 255
47
+ },
48
+ "payment_method":{
49
+ "description": "How the document is being payed. Used in new payments.",
50
+ "enum":["cash","bank_transfer","credit_card","paypal","direct_debit","cheque", "moneybookers", "premium_sms"],
51
+ "type":"string"
52
+ },
53
+ "title":{
54
+ "description": "The headline of a document. Use SK placeholders to prevent excessive typing e.g. 'Your order [number]'",
55
+ "type":"string",
56
+ "maxLength": 255
57
+ },
58
+ "notes_before":{
59
+ "description": "Notes shown before the line items. Normally contains salutation and other introductional information. SK placeholders can be used.",
60
+ "type":"string",
61
+ "format":"text"
62
+ },
63
+ "notes_after":{
64
+ "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
+ "type":"string",
66
+ "format":"text"
67
+ },
68
+ "tag_list":{
69
+ "description": "Space separated list of tags. Are split and saved as Tag objects on create, update.",
70
+ "type":"string"
71
+ },
72
+ "language":{
73
+ "description": "Should be a valid language short-code: de-DE, fr, en-GB; like defined in your account language menu. When the document is emailed or printed, a localized version of a multi-language template(email, pdf) will be used if available. Defaults to the clients language, if empty and a client is assigned.",
74
+ "type":"string",
75
+ "maxLength": 10
76
+ },
77
+ "currency":{
78
+ "description": "Currency code as defined by the ISO 4217 standard (3-letter UPCASE: EUR, USD)",
79
+ "type":"string",
80
+ "maxLength": 3,
81
+ "minLength": 3
82
+ },
83
+ "exchange_rate":{
84
+ "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,
86
+ "type":"number"
87
+ },
88
+ "gross_total_exchanged":{
89
+ "description": "Exchanged gross total, in your company currency.",
90
+ "readonly":true,
91
+ "type":"number"
92
+ },
93
+ "archived_pdf":{
94
+ "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,
96
+ "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
110
+ },
111
+ "contact":{
112
+ "description": "The contact for the document. Use contact_id field to set a contact.",
113
+ "readonly":true,
114
+ "type":"object",
115
+ "properties":{"$ref":"./contact.json#properties"}
116
+ },
117
+ "contact_id":{
118
+ "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.",
119
+ "type":"string",
120
+ "maxLength": 22,
121
+ "minLength":22
122
+ },
123
+ "estimate_id":{
124
+ "description":"Estimate document ID, if the order was created from a estimate.",
125
+ "readonly":true,
126
+ "type":"string",
127
+ "maxLength": 22,
128
+ "minLength": 22
129
+ },
130
+ "team_id":{
131
+ "description": "A team uuid taken from the contact. If set only the team and its parent teams can see the record.",
132
+ "readonly" :true,
133
+ "type":"string",
134
+ "maxLength": 22,
135
+ "minLength":22
136
+ },
137
+ "line_items":{
138
+ "description": "DEPRECATED use items",
139
+ "type":"array",
140
+ "properties":{"$ref":"./line_item.json#properties"}
141
+ },
142
+ "items":{
143
+ "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.",
144
+ "type":"array",
145
+ "default": "any",
146
+ "minItems": 0,
147
+ "items": [{ "$ref": "./line_item.json#properties"},
148
+ { "$ref": "./divider_item.json#properties"},
149
+ { "$ref": "./sub_total_item.json#properties"}]
150
+ },
151
+ "created_at":{
152
+ "description": "Date the object was created in SK. Never changes afterwards.",
153
+ "format":"date-time",
154
+ "readonly":true,
155
+ "type":"string"
156
+ },
157
+ "updated_at":{
158
+ "description": "Date the object was edited in SK.",
159
+ "format":"date-time",
160
+ "readonly":true,
161
+ "type":"string"
162
+ },
163
+ "lock_version":{
164
+ "description": "Auto-incremented to prevent concurrent updates. First save wins and increments version.",
165
+ "type":"integer"
166
+ },
167
+ "gross_total":{
168
+ "description": "Gross total of all line items, 2 decimals places in document currency.",
169
+ "readonly":true,
170
+ "type":"number"
171
+ },
172
+ "tax_total":{
173
+ "description": "Tax total, 2 decimals places",
174
+ "readonly":true,
175
+ "type":"number"
176
+ },
177
+ "net_total":{
178
+ "description": "Net total, 2 decimals places",
179
+ "readonly":true,
180
+ "type":"number"
181
+ },
182
+ "net_total_base":{
183
+ "description": "Net total, 6 decimal places incl. discount",
184
+ "readonly":true,
185
+ "type":"number"
186
+ },
187
+ "cost_total":{
188
+ "description": "Cost total of all line items, 2 decimals places in document currency.",
189
+ "readonly":true,
190
+ "type":"number"
191
+ },
192
+ "gross_margin_total":{
193
+ "description": "Total gross margin across all line items. Calculated from net_total-cost_total.",
194
+ "readonly":true,
195
+ "type":"number"
196
+ },
197
+ "gross_margin_pct":{
198
+ "description": "Percentage of gross profit to cost of items sold. Calculated from gross_margin_total/net_total*100",
199
+ "readonly":true,
200
+ "type":"number"
201
+ }
202
+ },
203
+ "links":[
204
+ { "rel": "self",
205
+ "href": "orders/{id}"
206
+ },
207
+ { "rel": "instances",
208
+ "href": "orders",
209
+ "properties" : {
210
+ "page":{
211
+ "title" : "Page",
212
+ "description": "In paginated results set the page to look for",
213
+ "type":"number"
214
+ },
215
+ "per_page":{
216
+ "title" : "Per page",
217
+ "description": "Results per page. Default is 50, max is 200",
218
+ "type":"number"
219
+ },
220
+ "filter[q]":{
221
+ "title" : "Search",
222
+ "description": "Search in title, number, address field",
223
+ "type":"string"
224
+ },
225
+ "filter[status]":{
226
+ "title" : "Status",
227
+ "description": "A single or a list of status, comma separated: open,close,draft",
228
+ "type" : "string"
229
+ },
230
+ "filter[number]":{
231
+ "title" : "Number",
232
+ "description": "Find by exact number",
233
+ "type":"string"
234
+ },
235
+ "filter[tags]":{
236
+ "title" : "Tags",
237
+ "description": "Filter by a space delimited list of tags",
238
+ "type":"string"
239
+ },
240
+ "filter[from]":{
241
+ "title" : "From date",
242
+ "description": "Objects with a date after the date. YYYY-MM-DD",
243
+ "format" : "date",
244
+ "type" : "string"
245
+ },
246
+ "filter[to]":{
247
+ "title" : "To date",
248
+ "description": "Objects with date before the date. YYYY-MM-DD",
249
+ "format" : "date",
250
+ "type" : "string"
251
+ },
252
+ "filter[created_at_from]":{
253
+ "title" : "From date",
254
+ "description": "Objects with a creation on/after the date(>=). ISO 8601 format YYY-MM-DDThh:mm:ss+z or just a date YYY-MM-DD. If date is given the time is set to the start of the day(00:00:00) so all objects created on this day are included. A time should be already utc time",
255
+ "format" : "date-time",
256
+ "type" : "string"
257
+ },
258
+ "filter[created_at_to]":{
259
+ "title" : "To date",
260
+ "description": "Objects with a creation until the date(<=). ISO 8601 format YYY-MM-DDThh:mm:ss+z or just a date YYY-MM-DD. If date is given the time is set to the end of the day(23:59:59) so all objects created on that day are included. A time should be already utc time.",
261
+ "format" : "date-time",
262
+ "type" : "string"
263
+ },
264
+ "filter[languages]":{
265
+ "title" : "Languages",
266
+ "description": "A list of language codes, comma separated",
267
+ "type" : "string"
268
+ },
269
+ "filter[client_ids]":{
270
+ "title" : "Clients",
271
+ "description": "DEPRECATED use contact_ids",
272
+ "type" : "string"
273
+ },
274
+ "filter[contact_ids]":{
275
+ "title" : "Contacts",
276
+ "description": "Find objects belonging to a single or a list of contacts, use ids comma separated.",
277
+ "type" : "string"
278
+ },
279
+ "filter[ids]":{
280
+ "title" : "Documents",
281
+ "description": "A single or a list of document uuids, comma separated",
282
+ "type" : "string"
283
+ },
284
+ "filter[creator_ids]":{
285
+ "title" : "Creator",
286
+ "description": "Objects created by the given users uuids, comma separated",
287
+ "type" : "string"
288
+ },
289
+ "filter[product_ids]":{
290
+ "title" : "Products",
291
+ "description": "Documents using the given product uuids(comma separated) in their line items.",
292
+ "type" : "string"
293
+ },
294
+ "sort_by":{
295
+ "title" : "Sort by",
296
+ "description": "Sort the results by the given field => number",
297
+ "enum":["title", "number", "created_at", "updated_at", "price_total", "price_tax", "date", "due_date"],
298
+ "type": "string"
299
+ },
300
+ "sort":{
301
+ "title" : "Sort",
302
+ "enum":["ASC","DESC"],
303
+ "description": "Sort the results in ASC or DESC",
304
+ "type": "string"
305
+ }
306
+ }
307
+ },
308
+ { "rel": "destroy",
309
+ "href": "orders/{id}",
310
+ "method": "DELETE"
311
+ },
312
+ { "rel": "update",
313
+ "href": "orders/{id}",
314
+ "method": "PUT"
315
+ },
316
+ { "rel": "create",
317
+ "href": "orders",
318
+ "method": "POST",
319
+ "properties" : {
320
+ "source" : {
321
+ "title" : "Source document id",
322
+ "description": "Copies the source(excl. number,date) and returns a new draft document. You can pass any document type(e.g. invoice, order). Fields passed with the object(e.g. notes, title, address_field) are not overwritten.",
323
+ "type" : "string"
324
+ }
325
+ }
326
+ },
327
+ { "rel": "attachments",
328
+ "href": "orders/{id}/attachments"
329
+ },
330
+ { "rel": "comments",
331
+ "href": "orders/{id}/comments"
332
+ },
333
+ { "rel": "emails",
334
+ "href": "orders/{id}/emails"
335
+ },
336
+ { "rel": "emails create",
337
+ "href": "orders/{id}/emails",
338
+ "method": "POST",
339
+ "properties" : {
340
+ "template_id":{
341
+ "title" : "Template",
342
+ "description": "UUID of an email template to use. If present template fields like subject, body, attachments are used for the current email.",
343
+ "type":"string",
344
+ "maxLength": 22,
345
+ "minLength":22
346
+ },
347
+ "send":{
348
+ "title" : "Send email",
349
+ "description": "Schedule email for sending. Omit this parameter or set value to 0 or false(String or Integer) to keep email as draft."
350
+ },
351
+ "archived_pdf":{
352
+ "title" : "Attach archived pdf",
353
+ "description": "Adds the archived pdf from the related resource(if it has one)."
354
+ }
355
+ }
356
+ },
357
+ { "rel": "print",
358
+ "href": "orders/{id}/print",
359
+ "method": "POST",
360
+ "properties" : {
361
+ "template_id" : {
362
+ "title" : "PDF template used for printing",
363
+ "description": "UUID of a pdf template used to print the document. MUST be present",
364
+ "required":true
365
+ },
366
+ "base64" : {
367
+ "title" : "Return the created pdf base64 encoded",
368
+ "description": "If set the new pdf is returned inside the attachment JSON within 'base64' key. Leave empty to save traffic."
369
+ }
370
+ }
371
+ }
372
+ ]
373
+ }