sk_api_schema 0.7.9 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -2
- data/CHANGELOG.md +7 -1
- data/json/v1.0/credit_note.json +13 -4
- data/json/v1.0/divider_item.json +5 -0
- data/json/v1.0/document.json +1 -1
- data/json/v1.0/estimate.json +11 -2
- data/json/v1.0/invoice.json +3 -3
- data/json/v1.0/line_item.json +5 -0
- data/json/v1.0/order.json +11 -2
- data/json/v1.0/payment.json +1 -1
- data/json/v1.0/payment_reminder.json +10 -3
- data/json/v1.0/recurring.json +10 -1
- data/json/v1.0/sub_total_item.json +5 -0
- data/lib/sk_api_schema/version.rb +1 -1
- data/spec/sk_api_schema_spec.rb +4 -3
- metadata +5 -5
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,8 +3,14 @@
|
|
3
3
|
See [commit messages](https://github.com/salesking/sk_api_schema/commits/) for details.
|
4
4
|
Also signup to our [Developer Newsletter](http://www.salesking.eu/dev/newsletter/) to stay up-to-date !!!
|
5
5
|
|
6
|
+
##2013-08
|
7
|
+
|
8
|
+
* add items array to documents to be used instead of line_items
|
9
|
+
* Deprecate line_items
|
10
|
+
|
6
11
|
##2013-06
|
7
|
-
|
12
|
+
|
13
|
+
* add email filter "status" accepting sent,draft,in_progress strings, dropped sent/status filter
|
8
14
|
|
9
15
|
##2013-05
|
10
16
|
|
data/json/v1.0/credit_note.json
CHANGED
@@ -81,7 +81,7 @@
|
|
81
81
|
"minLength": 3
|
82
82
|
},
|
83
83
|
"exchange_rate":{
|
84
|
-
"description": "The exchange rate from the
|
84
|
+
"description": "The exchange rate from the foreign document currency(eg. USD) to the company currency(EUR). The rate is set on document open with the exchange rate based on the document date. If there is no rate for this day, say on weekends, the closest previous day is taken(Sunday->Friday).",
|
85
85
|
"readonly":true,
|
86
86
|
"type":"number"
|
87
87
|
},
|
@@ -127,10 +127,19 @@
|
|
127
127
|
"minLength":22
|
128
128
|
},
|
129
129
|
"line_items":{
|
130
|
-
"description": "
|
130
|
+
"description": "DEPRECATED use items",
|
131
131
|
"type":"array",
|
132
132
|
"properties":{"$ref":"./line_item.json#properties"}
|
133
133
|
},
|
134
|
+
"items":{
|
135
|
+
"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 items array is stronger.",
|
136
|
+
"type":"array",
|
137
|
+
"default": "any",
|
138
|
+
"minItems": 0,
|
139
|
+
"items": [{ "$ref": "./line_item.json#properties"},
|
140
|
+
{ "$ref": "./divider_item.json#properties"},
|
141
|
+
{ "$ref": "./sub_total_item.json#properties"}]
|
142
|
+
},
|
134
143
|
"created_at":{
|
135
144
|
"description": "Date the object was created in SK. Never changes afterwards.",
|
136
145
|
"format":"date-time",
|
@@ -148,12 +157,12 @@
|
|
148
157
|
"type":"integer"
|
149
158
|
},
|
150
159
|
"price_total":{
|
151
|
-
"description": "
|
160
|
+
"description": "DEPRECATED: use net_total_base",
|
152
161
|
"readonly":true,
|
153
162
|
"type":"number"
|
154
163
|
},
|
155
164
|
"price_tax":{
|
156
|
-
"description": "
|
165
|
+
"description": "DEPRECATED: use tax_total",
|
157
166
|
"readonly":true,
|
158
167
|
"type":"number"
|
159
168
|
},
|
data/json/v1.0/divider_item.json
CHANGED
@@ -21,6 +21,11 @@
|
|
21
21
|
"type":"string",
|
22
22
|
"maxLength": 50
|
23
23
|
},
|
24
|
+
"type":{
|
25
|
+
"description": "The item type: DividerItem. Must be set when creating new items via document.items array",
|
26
|
+
"type":"string",
|
27
|
+
"maxLength": 20
|
28
|
+
},
|
24
29
|
"created_at":{
|
25
30
|
"description": "Date the object was created in SK. Never changes afterwards",
|
26
31
|
"format":"date-time",
|
data/json/v1.0/document.json
CHANGED
@@ -122,7 +122,7 @@
|
|
122
122
|
"minLength": 3
|
123
123
|
},
|
124
124
|
"exchange_rate":{
|
125
|
-
"description": "The exchange rate from the
|
125
|
+
"description": "The exchange rate from the foreign document currency(eg. USD) to the company currency(EUR). The rate is set on document open with the exchange rate based on the document date. If there is no rate for this day, say on weekends, the closest previous day is taken(Sunday->Friday).",
|
126
126
|
"readonly":true,
|
127
127
|
"type":"number"
|
128
128
|
},
|
data/json/v1.0/estimate.json
CHANGED
@@ -76,7 +76,7 @@
|
|
76
76
|
"minLength": 3
|
77
77
|
},
|
78
78
|
"exchange_rate":{
|
79
|
-
"description": "The exchange rate from the
|
79
|
+
"description": "The exchange rate from the foreign document currency(eg. USD) to the company currency(EUR). The rate is set on document open with the exchange rate based on the document date. If there is no rate for this day, say on weekends, the closest previous day is taken(Sunday->Friday).",
|
80
80
|
"readonly":true,
|
81
81
|
"type":"number"
|
82
82
|
},
|
@@ -122,10 +122,19 @@
|
|
122
122
|
"minLength":22
|
123
123
|
},
|
124
124
|
"line_items":{
|
125
|
-
"description": "
|
125
|
+
"description": "DEPRECATED use items",
|
126
126
|
"type":"array",
|
127
127
|
"properties":{"$ref":"./line_item.json#properties"}
|
128
128
|
},
|
129
|
+
"items":{
|
130
|
+
"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 items array is stronger.",
|
131
|
+
"type":"array",
|
132
|
+
"default": "any",
|
133
|
+
"minItems": 0,
|
134
|
+
"items": [{ "$ref": "./line_item.json#properties"},
|
135
|
+
{ "$ref": "./divider_item.json#properties"},
|
136
|
+
{ "$ref": "./sub_total_item.json#properties"}]
|
137
|
+
},
|
129
138
|
"created_at":{
|
130
139
|
"description": "Date the object was created in SK. Never changes afterwards.",
|
131
140
|
"format":"date-time",
|
data/json/v1.0/invoice.json
CHANGED
@@ -81,7 +81,7 @@
|
|
81
81
|
"minLength": 3
|
82
82
|
},
|
83
83
|
"exchange_rate":{
|
84
|
-
"description": "The exchange rate from the
|
84
|
+
"description": "The exchange rate from the foreign document currency(eg. USD) to the company currency(EUR). The rate is set on document open with the exchange rate based on the document date. If there is no rate for this day, say on weekends, the closest previous day is taken(Sunday->Friday).",
|
85
85
|
"readonly":true,
|
86
86
|
"type":"number"
|
87
87
|
},
|
@@ -127,12 +127,12 @@
|
|
127
127
|
"minLength": 22
|
128
128
|
},
|
129
129
|
"line_items":{
|
130
|
-
"description": "
|
130
|
+
"description": "DEPRECATED use items",
|
131
131
|
"type":"array",
|
132
132
|
"properties":{"$ref":"./line_item.json#properties"}
|
133
133
|
},
|
134
134
|
"items":{
|
135
|
-
"description": "Items for the document. Access items of all types including divider and sub_total items.
|
135
|
+
"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 items array is stronger.",
|
136
136
|
"type":"array",
|
137
137
|
"default": "any",
|
138
138
|
"minItems": 0,
|
data/json/v1.0/line_item.json
CHANGED
@@ -21,6 +21,11 @@
|
|
21
21
|
"type":"string",
|
22
22
|
"maxLength": 50
|
23
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
|
+
},
|
24
29
|
"external_ref":{
|
25
30
|
"description": "Arbitrary number e.g. external product reference.",
|
26
31
|
"type":"string",
|
data/json/v1.0/order.json
CHANGED
@@ -81,7 +81,7 @@
|
|
81
81
|
"minLength": 3
|
82
82
|
},
|
83
83
|
"exchange_rate":{
|
84
|
-
"description": "The exchange rate from the
|
84
|
+
"description": "The exchange rate from the foreign document currency(eg. USD) to the company currency(EUR). The rate is set on document open with the exchange rate based on the document date. If there is no rate for this day, say on weekends, the closest previous day is taken(Sunday->Friday).",
|
85
85
|
"readonly":true,
|
86
86
|
"type":"number"
|
87
87
|
},
|
@@ -127,10 +127,19 @@
|
|
127
127
|
"minLength":22
|
128
128
|
},
|
129
129
|
"line_items":{
|
130
|
-
"description": "
|
130
|
+
"description": "DEPRECATED use items",
|
131
131
|
"type":"array",
|
132
132
|
"properties":{"$ref":"./line_item.json#properties"}
|
133
133
|
},
|
134
|
+
"items":{
|
135
|
+
"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 items array is stronger.",
|
136
|
+
"type":"array",
|
137
|
+
"default": "any",
|
138
|
+
"minItems": 0,
|
139
|
+
"items": [{ "$ref": "./line_item.json#properties"},
|
140
|
+
{ "$ref": "./divider_item.json#properties"},
|
141
|
+
{ "$ref": "./sub_total_item.json#properties"}]
|
142
|
+
},
|
134
143
|
"created_at":{
|
135
144
|
"description": "Date the object was created in SK. Never changes afterwards.",
|
136
145
|
"format":"date-time",
|
data/json/v1.0/payment.json
CHANGED
@@ -43,7 +43,7 @@
|
|
43
43
|
"minLength": 3
|
44
44
|
},
|
45
45
|
"exchange_rate":{
|
46
|
-
"description": "The exchange rate from the
|
46
|
+
"description": "The exchange rate from the foreign document currency(eg. USD) to the company currency(EUR). The rate is set on document open with the exchange rate based on the document date. If there is no rate for this day, say on weekends, the closest previous day is taken(Sunday->Friday).",
|
47
47
|
"readonly":true,
|
48
48
|
"type":"number"
|
49
49
|
},
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{ "type":"object",
|
2
2
|
"title": "payment_reminder",
|
3
3
|
"name": "payment_reminder",
|
4
|
-
"description": "A payment reminder",
|
4
|
+
"description": "A payment reminder belongs to an invoice and inherits it's line items from the invoice total(first item) and late fee settings(second item).",
|
5
5
|
"properties":{
|
6
6
|
"id":{
|
7
7
|
"description":"Unique identifier - UUID",
|
@@ -79,7 +79,7 @@
|
|
79
79
|
"minLength": 3
|
80
80
|
},
|
81
81
|
"exchange_rate":{
|
82
|
-
"description": "The exchange rate from the
|
82
|
+
"description": "The exchange rate from the foreign document currency(eg. USD) to the company currency(EUR). The rate is set on document open with the exchange rate based on the document date. If there is no rate for this day, say on weekends, the closest previous day is taken(Sunday->Friday).",
|
83
83
|
"readonly":true,
|
84
84
|
"type":"number"
|
85
85
|
},
|
@@ -126,10 +126,17 @@
|
|
126
126
|
"minLength":22
|
127
127
|
},
|
128
128
|
"line_items":{
|
129
|
-
"description": "
|
129
|
+
"description": "DEPRECATED use items",
|
130
130
|
"type":"array",
|
131
131
|
"properties":{"$ref":"./line_item.json#properties"}
|
132
132
|
},
|
133
|
+
"items":{
|
134
|
+
"description": "Items for the document. GOTCHAs: you should NOT create items manually since we create them. The first item contains the invoice total and the optional second one the late_fee.",
|
135
|
+
"type":"array",
|
136
|
+
"default": "any",
|
137
|
+
"minItems": 1,
|
138
|
+
"items": { "$ref": "./line_item.json#properties"}
|
139
|
+
},
|
133
140
|
"created_at":{
|
134
141
|
"description": "Date the object was created in SK. Never changes afterwards.",
|
135
142
|
"format":"date-time",
|
data/json/v1.0/recurring.json
CHANGED
@@ -114,10 +114,19 @@
|
|
114
114
|
"minLength":22
|
115
115
|
},
|
116
116
|
"line_items":{
|
117
|
-
"description": "
|
117
|
+
"description": "DEPRECATED use items",
|
118
118
|
"type":"array",
|
119
119
|
"properties":{"$ref":"./line_item.json#properties"}
|
120
120
|
},
|
121
|
+
"items":{
|
122
|
+
"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 items array is stronger.",
|
123
|
+
"type":"array",
|
124
|
+
"default": "any",
|
125
|
+
"minItems": 0,
|
126
|
+
"items": [{ "$ref": "./line_item.json#properties"},
|
127
|
+
{ "$ref": "./divider_item.json#properties"},
|
128
|
+
{ "$ref": "./sub_total_item.json#properties"}]
|
129
|
+
},
|
121
130
|
"created_at":{
|
122
131
|
"description": "Date the object was created in SK. Never changes afterwards.",
|
123
132
|
"format":"date-time",
|
@@ -21,6 +21,11 @@
|
|
21
21
|
"type":"string",
|
22
22
|
"maxLength": 50
|
23
23
|
},
|
24
|
+
"type":{
|
25
|
+
"description": "The item type: SubTotalItem. Must be set when creating new items via document.items array",
|
26
|
+
"type":"string",
|
27
|
+
"maxLength": 20
|
28
|
+
},
|
24
29
|
"net_total":{
|
25
30
|
"description": "Net sub-total",
|
26
31
|
"type":"number",
|
data/spec/sk_api_schema_spec.rb
CHANGED
@@ -70,6 +70,7 @@ describe SK::Api::Schema do
|
|
70
70
|
|
71
71
|
@item = LineItem.new
|
72
72
|
@item.id = 'some-uuid'
|
73
|
+
@item.type = 'LineItem'
|
73
74
|
@item.name = 'Pork Chops'
|
74
75
|
@item.description = 'Yummi Pork chopped by mexian emigrants'
|
75
76
|
@item.position = 1
|
@@ -92,8 +93,8 @@ describe SK::Api::Schema do
|
|
92
93
|
obj_hash = SK::Api::Schema.to_hash_from_schema(@invoice, 'v1.0')
|
93
94
|
obj_hash["invoice"]['client']['client'].should == {"number"=>"911", "addresses"=>[], "id"=>"some-uuid", "organisation"=>"Dirty Food Inc.", "last_name"=>nil}
|
94
95
|
obj_hash["invoice"]["client"]['links'].should_not be_nil
|
95
|
-
obj_hash["invoice"]["line_items"].should == [ {"line_item"=>{"name"=>"Pork Chops", "position"=>1,
|
96
|
-
|
96
|
+
obj_hash["invoice"]["line_items"].should == [ {"line_item"=>{"name"=>"Pork Chops", "position"=>1, "type"=>"LineItem",
|
97
|
+
"id"=>"some-uuid", "description"=>"Yummi Pork chopped by mexian emigrants", "price_single"=>0.99}}]
|
97
98
|
end
|
98
99
|
|
99
100
|
it "should parse object given fields" do
|
@@ -154,7 +155,7 @@ class Invoice
|
|
154
155
|
end
|
155
156
|
|
156
157
|
class LineItem
|
157
|
-
attr_accessor :id, :name, :description, :position, :price_single
|
158
|
+
attr_accessor :id, :name, :description, :position, :price_single, :type
|
158
159
|
end
|
159
160
|
|
160
161
|
class Client
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sk_api_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 63
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 8
|
9
|
+
- 0
|
10
|
+
version: 0.8.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Georg Leciejewski
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-08-14 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :runtime
|