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": "email",
3
- "name": "email",
4
5
  "description":"An email in SK must always be related to an object. Receivers are limited to 5 per address field.",
6
+ "required": ["to_addr", "subject", "body", "related_object_type", "related_object_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
@@ -14,12 +23,12 @@
14
23
  "bcc_addr":{
15
24
  "description": "BCC addresses, comma separated. Max 5, format: a@b.de,'George'<georg@sk.eu>",
16
25
  "type":"string",
17
- "format":"text"
26
+ "format":"string"
18
27
  },
19
28
  "cc_addr":{
20
29
  "description": "CC addresses, comma separated. Max 5, format: a@b.de,'George'<georg@sk.eu>",
21
30
  "type":"string",
22
- "format":"text"
31
+ "format":"string"
23
32
  },
24
33
  "from_addr":{
25
34
  "description": "From address. If empty the email of the current user is taken.",
@@ -28,71 +37,69 @@
28
37
  },
29
38
  "to_addr":{
30
39
  "description": "TO addresses, comma separated. Max 5, format: a@b.de,'George'<georg@sk.eu>",
31
- "required":true,
32
40
  "type":"string",
33
- "format":"text"
41
+ "format":"string"
34
42
  },
35
43
  "subject":{
36
44
  "description": "The email subject.",
37
- "required":true,
38
45
  "type":"string",
39
46
  "maxLength": 255
40
47
  },
41
48
  "body":{
42
49
  "description": "The email text.",
43
- "required":true,
44
50
  "type":"string",
45
- "format":"text"
51
+ "format":"string"
46
52
  },
47
53
  "attachments":{
48
54
  "description": "The emails attachments.",
49
- "readonly":true,
55
+ "readOnly":true,
50
56
  "type":"array",
51
- "properties":{"$ref":"./attachment.json#properties"}
57
+ "items": {
58
+ "type": "object",
59
+ "$ref":"./attachment.json#"
60
+ }
52
61
  },
53
62
  "related_object_type":{
54
63
  "description": "Object type of the emails parent. Is the camelcased base class name: Document for invoice, credit_note, contact,..",
55
- "required":true,
56
64
  "type":"string"
57
65
  },
58
66
  "related_object_id":{
59
67
  "description": "uuid of the emails parent object.",
60
- "required":true,
61
68
  "type":"string",
62
69
  "maxLength": 22,
63
70
  "minLength":22
64
71
  },
65
72
  "in_progress":{
66
73
  "description": "Is set after an email has been scheduled for sending until it has been sent.",
67
- "readonly":true,
74
+ "readOnly":true,
68
75
  "type":"boolean"
69
76
  },
70
77
  "log":{
71
78
  "description": "Logs error message when sending failed.",
72
- "readonly":true,
73
- "type":"text"
79
+ "readOnly":true,
80
+ "type":"string"
74
81
  },
75
82
  "delivered_at":{
76
83
  "description": "Date the email was delivered by SK. If set, the message cannot be edited anymore.",
77
84
  "format":"date-time",
78
- "readonly":true,
85
+ "readOnly":true,
79
86
  "type":"string"
80
87
  },
81
88
  "created_at":{
82
89
  "description": "Date the object was created in SK. Never changes afterwards",
83
90
  "format":"date-time",
84
- "readonly":true,
91
+ "readOnly":true,
85
92
  "type":"string"
86
93
  },
87
94
  "updated_at":{
88
95
  "description": "Date the object was edited in SK.",
89
96
  "format":"date-time",
90
- "readonly":true,
97
+ "readOnly":true,
91
98
  "type":"string"
92
99
  },
93
100
  "team_id":{
94
101
  "description": "A team uuid taken from the related object. If set only the team and its parent teams can see the record.",
95
- "readonly" :true,
102
+ "readOnly" :true,
96
103
  "type":"string",
97
104
  "maxLength": 22,
98
105
  "minLength":22
@@ -156,7 +163,7 @@
156
163
  }
157
164
  },
158
165
  { "rel": "attachments",
159
- "href": "emails/{id}/attachments"
166
+ "href": "attachments?filter[related_object_ids]={id}"
160
167
  },
161
168
  { "rel": "destroy",
162
169
  "href": "emails/{id}",
@@ -1,33 +1,39 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "email_template",
3
- "name": "email_template",
4
5
  "description":"An email_template is used to simplify the creation of emails. When creating a new email just pass template id and all fields from the template are copied to the new email. The fields are NOT merged with present values in a new email object!",
6
+ "required": ["name", "subject", "body", "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
  "subject":{
21
29
  "description": "Subject containing placeholders, replaced when the template is used.",
22
- "required":true,
23
30
  "type":"string",
24
31
  "maxLength": 255
25
32
  },
26
33
  "body":{
27
34
  "description": "Body with placeholders, replaced when the template is used.",
28
- "required":true,
29
35
  "type":"string",
30
- "format":"text"
36
+ "format":"string"
31
37
  },
32
38
  "from_addr":{
33
39
  "description": "Default from address. A valid email address. Make sure your server(if custom SMPT settings for the API user) allows sending with this address.",
@@ -46,7 +52,6 @@
46
52
  },
47
53
  "kind":{
48
54
  "description": "Kind of object the template can be used for.",
49
- "required":true,
50
55
  "enum": ["invoice", "estimate", "credit_note", "payment_reminder", "order", "contact"],
51
56
  "type":"string"
52
57
  },
@@ -58,13 +63,13 @@
58
63
  "created_at":{
59
64
  "description": "Date the object was created in SK. Never changes afterwards",
60
65
  "format":"date-time",
61
- "readonly":true,
66
+ "readOnly":true,
62
67
  "type":"string"
63
68
  },
64
69
  "updated_at":{
65
70
  "description": "Date the object was edited in SK.",
66
71
  "format":"date-time",
67
- "readonly":true,
72
+ "readOnly":true,
68
73
  "type":"string"
69
74
  },
70
75
  "team_id":{
@@ -1,12 +1,20 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "estimate",
3
- "name": "estimate",
4
5
  "description": "An estimate",
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
@@ -53,12 +61,12 @@
53
61
  "notes_before":{
54
62
  "description": "Notes shown before the line items. Normally contains salutation and other introductional information. SK placeholders can be used.",
55
63
  "type":"string",
56
- "format":"text"
64
+ "format":"string"
57
65
  },
58
66
  "notes_after":{
59
67
  "description": "Notes shown after the line items. Can contain information about payments, bank account or a thank-you message. SK placeholders can be used.",
60
68
  "type":"string",
61
- "format":"text"
69
+ "format":"string"
62
70
  },
63
71
  "tag_list":{
64
72
  "description": "Space separated list of tags. Are split and saved as Tag objects on create, update.",
@@ -77,37 +85,25 @@
77
85
  },
78
86
  "exchange_rate":{
79
87
  "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. ",
80
- "readonly":true,
88
+ "readOnly":true,
81
89
  "type":"number"
82
90
  },
83
91
  "gross_total_exchanged":{
84
92
  "description": "Exchanged gross total, in your company currency.",
85
- "readonly":true,
93
+ "readOnly":true,
86
94
  "type":"number"
87
95
  },
88
96
  "archived_pdf":{
89
97
  "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. ",
90
- "readonly":true,
98
+ "readOnly":true,
91
99
  "type":"object",
92
- "properties":{"$ref":"./attachment.json#properties"}
93
- },
94
- "client":{
95
- "description": "DEPRECATED: use contact",
96
- "readonly":true,
97
- "type":"object",
98
- "properties":{"$ref":"./client.json#properties"}
99
- },
100
- "client_id":{
101
- "description": "DEPRECATED: use contact_id",
102
- "type":"string",
103
- "maxLength": 22,
104
- "minLength":22
100
+ "$ref":"./attachment.json#"
105
101
  },
106
102
  "contact":{
107
103
  "description": "The contact for the document. Use contact_id field to set a contact.",
108
- "readonly":true,
104
+ "readOnly":true,
109
105
  "type":"object",
110
- "properties":{"$ref":"./contact.json#properties"}
106
+ "$ref":"./contact.json#"
111
107
  },
112
108
  "contact_id":{
113
109
  "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.",
@@ -117,74 +113,83 @@
117
113
  },
118
114
  "team_id":{
119
115
  "description": "A team uuid taken from the contact. If set only the team and its parent teams can see the record.",
120
- "readonly" :true,
116
+ "readOnly" :true,
121
117
  "type":"string",
122
118
  "maxLength": 22,
123
119
  "minLength":22
124
120
  },
125
- "line_items":{
126
- "description": "DEPRECATED use items",
127
- "type":"array",
128
- "properties":{"$ref":"./line_item.json#properties"}
129
- },
130
121
  "items":{
131
- "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.",
122
+ "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.",
132
123
  "type":"array",
133
- "default": "any",
134
124
  "minItems": 0,
135
- "items": [{ "$ref": "./line_item.json#properties"},
136
- { "$ref": "./divider_item.json#properties"},
137
- { "$ref": "./sub_total_item.json#properties"}]
125
+ "items": {
126
+ "type" : "object",
127
+ "anyOf" : [
128
+ {
129
+ "title": "line_item",
130
+ "$ref": "./line_item.json#"
131
+ },
132
+ {
133
+ "title": "divider_item",
134
+ "$ref": "./divider_item.json#"
135
+ },
136
+ {
137
+ "title": "sub_total_item",
138
+ "$ref": "./sub_total_item.json#"
139
+ }
140
+ ]
141
+ }
138
142
  },
139
143
  "created_at":{
140
144
  "description": "Date the object was created in SK. Never changes afterwards.",
141
145
  "format":"date-time",
142
- "readonly":true,
146
+ "readOnly":true,
143
147
  "type":"string"
144
148
  },
145
149
  "updated_at":{
146
150
  "description": "Date the object was edited in SK.",
147
151
  "format":"date-time",
148
- "readonly":true,
152
+ "readOnly":true,
149
153
  "type":"string"
150
154
  },
151
155
  "lock_version":{
152
156
  "description": "Auto-incremented to prevent concurrent updates. First save wins and increments version.",
157
+ "readOnly":true,
153
158
  "type":"integer"
154
159
  },
155
160
  "gross_total":{
156
161
  "description": "Gross total of all line items, 2 decimals places in document currency.",
157
- "readonly":true,
162
+ "readOnly":true,
158
163
  "type":"number"
159
164
  },
160
165
  "tax_total":{
161
166
  "description": "Tax total, 2 decimals places",
162
- "readonly":true,
167
+ "readOnly":true,
163
168
  "type":"number"
164
169
  },
165
170
  "net_total":{
166
171
  "description": "Net total, 2 decimals places",
167
- "readonly":true,
172
+ "readOnly":true,
168
173
  "type":"number"
169
174
  },
170
175
  "net_total_base":{
171
176
  "description": "Net total, 6 decimal places incl. discount",
172
- "readonly":true,
177
+ "readOnly":true,
173
178
  "type":"number"
174
179
  },
175
180
  "cost_total":{
176
181
  "description": "Cost total of all line items, 2 decimals places in document currency.",
177
- "readonly":true,
182
+ "readOnly":true,
178
183
  "type":"number"
179
184
  },
180
185
  "gross_margin_total":{
181
186
  "description": "Total gross margin across all line items. Calculated from net_total-cost_total.",
182
- "readonly":true,
187
+ "readOnly":true,
183
188
  "type":"number"
184
189
  },
185
190
  "gross_margin_pct":{
186
191
  "description": "Percentage of gross profit to cost of items sold. Calculated from gross_margin_total/net_total*100",
187
- "readonly":true,
192
+ "readOnly":true,
188
193
  "type":"number"
189
194
  },
190
195
  "probability":{
@@ -193,7 +198,7 @@
193
198
  },
194
199
  "expected_revenue":{
195
200
  "description": "Product of the probability and net total. In company currency.",
196
- "readonly":true,
201
+ "readOnly":true,
197
202
  "type":"number"
198
203
  },
199
204
  "close_date":{
@@ -301,11 +306,6 @@
301
306
  "description": "A list of language codes, comma separated",
302
307
  "type" : "string"
303
308
  },
304
- "filter[client_ids]":{
305
- "title" : "Clients",
306
- "description": "DEPRECATED use contact_ids",
307
- "type" : "string"
308
- },
309
309
  "filter[contact_ids]":{
310
310
  "title" : "Contacts",
311
311
  "description": "Find objects belonging to a single or a list of contacts, use ids comma separated.",
@@ -355,39 +355,23 @@
355
355
  "source" : {
356
356
  "title" : "Source document id",
357
357
  "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.",
358
- "type" : "string"
358
+ "type" : "string",
359
+ "maxLength": 22,
360
+ "minLength":22
359
361
  }
360
362
  }
361
363
  },
362
364
  { "rel": "attachments",
363
- "href": "estimates/{id}/attachments"
365
+ "href": "attachments?filter[related_object_ids]={id}"
366
+ },
367
+ { "rel": "payments",
368
+ "href": "payments?filter[related_object_ids]={id}"
364
369
  },
365
370
  { "rel": "comments",
366
- "href": "estimates/{id}/comments"
371
+ "href": "comments?filter[related_object_ids]={id}"
367
372
  },
368
373
  { "rel": "emails",
369
- "href": "estimates/{id}/emails"
370
- },
371
- { "rel": "emails create",
372
- "href": "estimates/{id}/emails",
373
- "method": "POST",
374
- "properties" : {
375
- "template_id":{
376
- "title" : "Template",
377
- "description": "UUID of an email template to use. If present template fields like subject, body, attachments are used for the current email.",
378
- "type":"string",
379
- "maxLength": 22,
380
- "minLength":22
381
- },
382
- "send":{
383
- "title" : "Send email",
384
- "description": "Schedule email for sending. Omit this parameter or set value to 0 or false(String or Integer) to keep email as draft."
385
- },
386
- "archived_pdf":{
387
- "title" : "Attach archived pdf",
388
- "description": "Adds the archived pdf from the related resource(if it has one)."
389
- }
390
- }
374
+ "href": "emails?filter[related_object_ids]={id}"
391
375
  },
392
376
  { "rel": "print",
393
377
  "href": "estimates/{id}/print",
@@ -395,8 +379,7 @@
395
379
  "properties" : {
396
380
  "template_id" : {
397
381
  "title" : "PDF template used for printing",
398
- "description": "UUID of a pdf template used to print the document. MUST be present",
399
- "required":true
382
+ "description": "UUID of a pdf template used to print the document. MUST be present"
400
383
  },
401
384
  "base64" : {
402
385
  "title" : "Return the created pdf base64 encoded",