fortnox-api 0.3.0 → 0.4.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.
- checksums.yaml +4 -4
- data/README.md +12 -4
- data/fortnox-api.gemspec +4 -4
- data/lib/fortnox/api/mappers/article.rb +22 -0
- data/lib/fortnox/api/mappers/base/to_json.rb +2 -2
- data/lib/fortnox/api/models.rb +1 -0
- data/lib/fortnox/api/models/article.rb +133 -0
- data/lib/fortnox/api/repositories.rb +1 -0
- data/lib/fortnox/api/repositories/article.rb +16 -0
- data/lib/fortnox/api/repositories/base/savers.rb +1 -1
- data/lib/fortnox/api/types.rb +2 -0
- data/lib/fortnox/api/types/enums.rb +5 -2
- data/lib/fortnox/api/version.rb +1 -1
- data/spec/fortnox/api/mappers/article_spec.rb +15 -0
- data/spec/fortnox/api/mappers/base/to_json_spec.rb +1 -1
- data/spec/fortnox/api/models/article_spec.rb +7 -0
- data/spec/fortnox/api/repositories/article_spec.rb +35 -0
- data/spec/fortnox/api/repositories/examples/find.rb +0 -2
- data/spec/fortnox/api/repositories/examples/save.rb +4 -5
- data/spec/fortnox/api/repositories/examples/save_with_nested_model.rb +1 -0
- data/spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb +2 -1
- data/spec/fortnox/api/repositories/invoice_spec.rb +1 -1
- data/spec/fortnox/api/repositories/order_spec.rb +1 -1
- data/spec/fortnox/api/repositories/project_spec.rb +3 -3
- data/spec/fortnox/api/types/enums_spec.rb +1 -0
- data/spec/vcr_cassettes/articles/all.yml +54 -0
- data/spec/vcr_cassettes/articles/find_by_hash_failure.yml +45 -0
- data/spec/vcr_cassettes/articles/find_failure.yml +45 -0
- data/spec/vcr_cassettes/articles/find_id_1.yml +45 -0
- data/spec/vcr_cassettes/articles/find_new.yml +46 -0
- data/spec/vcr_cassettes/articles/multi_param_find_by_hash.yml +45 -0
- data/spec/vcr_cassettes/articles/save_new.yml +45 -0
- data/spec/vcr_cassettes/articles/save_old.yml +46 -0
- data/spec/vcr_cassettes/articles/save_with_specially_named_attribute.yml +45 -0
- data/spec/vcr_cassettes/articles/search_by_name.yml +45 -0
- data/spec/vcr_cassettes/articles/search_miss.yml +45 -0
- data/spec/vcr_cassettes/articles/search_with_special_char.yml +45 -0
- data/spec/vcr_cassettes/articles/single_param_find_by_hash.yml +46 -0
- metadata +43 -7
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.fortnox.se/3/articles/?description=Testartikel
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
Accept:
|
13
|
+
- application/json
|
14
|
+
Client-Secret:
|
15
|
+
- 9aBA8ZgsvR
|
16
|
+
Access-Token:
|
17
|
+
- ccaef817-d5d8-4b1c-a316-54f3e55c5c54
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- nginx
|
25
|
+
Date:
|
26
|
+
- Sun, 08 Oct 2017 21:51:45 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Vary:
|
32
|
+
- Accept-Encoding
|
33
|
+
- Accept-Encoding
|
34
|
+
X-Rack-Responsetime:
|
35
|
+
- '19'
|
36
|
+
X-Uid:
|
37
|
+
- d47a06a7
|
38
|
+
X-Build:
|
39
|
+
- e1392b4cf7
|
40
|
+
body:
|
41
|
+
encoding: UTF-8
|
42
|
+
string: '{"MetaInformation":{"@TotalResources":2,"@TotalPages":1,"@CurrentPage":1},"Articles":[{"@url":"https:\/\/api.fortnox.se\/3\/articles\/0000","ArticleNumber":"0000","Description":"Testartikel","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":"","StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/1","ArticleNumber":"1","Description":"Testartikel","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":"100","QuantityInStock":"0","ReservedQuantity":"0","StockPlace":"","StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false}]}'
|
43
|
+
http_version:
|
44
|
+
recorded_at: Sun, 08 Oct 2017 21:51:45 GMT
|
45
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.fortnox.se/3/articles/?description=nothing
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
Accept:
|
13
|
+
- application/json
|
14
|
+
Client-Secret:
|
15
|
+
- 9aBA8ZgsvR
|
16
|
+
Access-Token:
|
17
|
+
- ccaef817-d5d8-4b1c-a316-54f3e55c5c54
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- nginx
|
25
|
+
Date:
|
26
|
+
- Sun, 08 Oct 2017 21:51:45 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Vary:
|
32
|
+
- Accept-Encoding
|
33
|
+
- Accept-Encoding
|
34
|
+
X-Rack-Responsetime:
|
35
|
+
- '21'
|
36
|
+
X-Uid:
|
37
|
+
- b37d7e6d
|
38
|
+
X-Build:
|
39
|
+
- e1392b4cf7
|
40
|
+
body:
|
41
|
+
encoding: UTF-8
|
42
|
+
string: '{"MetaInformation":{"@TotalResources":0,"@TotalPages":0,"@CurrentPage":1},"Articles":[]}'
|
43
|
+
http_version:
|
44
|
+
recorded_at: Sun, 08 Oct 2017 21:51:45 GMT
|
45
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.fortnox.se/3/articles/?description=special%20char%20%C3%A5
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
Accept:
|
13
|
+
- application/json
|
14
|
+
Client-Secret:
|
15
|
+
- 9aBA8ZgsvR
|
16
|
+
Access-Token:
|
17
|
+
- ccaef817-d5d8-4b1c-a316-54f3e55c5c54
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- nginx
|
25
|
+
Date:
|
26
|
+
- Sun, 08 Oct 2017 21:51:45 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Vary:
|
32
|
+
- Accept-Encoding
|
33
|
+
- Accept-Encoding
|
34
|
+
X-Rack-Responsetime:
|
35
|
+
- '19'
|
36
|
+
X-Uid:
|
37
|
+
- 763e5b2a
|
38
|
+
X-Build:
|
39
|
+
- e1392b4cf7
|
40
|
+
body:
|
41
|
+
encoding: UTF-8
|
42
|
+
string: '{"MetaInformation":{"@TotalResources":0,"@TotalPages":0,"@CurrentPage":1},"Articles":[]}'
|
43
|
+
http_version:
|
44
|
+
recorded_at: Sun, 08 Oct 2017 21:51:45 GMT
|
45
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.fortnox.se/3/articles/?articlenumber=1
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
Accept:
|
13
|
+
- application/json
|
14
|
+
Client-Secret:
|
15
|
+
- 9aBA8ZgsvR
|
16
|
+
Access-Token:
|
17
|
+
- ccaef817-d5d8-4b1c-a316-54f3e55c5c54
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- nginx
|
25
|
+
Date:
|
26
|
+
- Sun, 08 Oct 2017 21:51:44 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Vary:
|
32
|
+
- Accept-Encoding
|
33
|
+
- Accept-Encoding
|
34
|
+
X-Rack-Responsetime:
|
35
|
+
- '30'
|
36
|
+
X-Uid:
|
37
|
+
- f74ca935
|
38
|
+
X-Build:
|
39
|
+
- e1392b4cf7
|
40
|
+
body:
|
41
|
+
encoding: UTF-8
|
42
|
+
string: '{"MetaInformation":{"@TotalResources":3,"@TotalPages":1,"@CurrentPage":1},"Articles":[{"@url":"https:\/\/api.fortnox.se\/3\/articles\/0001","ArticleNumber":"0001","Description":"Cykelpump","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":"100","QuantityInStock":"0","ReservedQuantity":"0","StockPlace":"","StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/1","ArticleNumber":"1","Description":"Testartikel","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":"100","QuantityInStock":"0","ReservedQuantity":"0","StockPlace":"","StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/10","ArticleNumber":"10","Description":"Abc
|
43
|
+
123","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false}]}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Sun, 08 Oct 2017 21:51:44 GMT
|
46
|
+
recorded_with: VCR 3.0.3
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fortnox-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Schubert Erlandsson
|
8
8
|
- Hannes Elvemyr
|
9
|
+
- Felix Holmgren
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2017-
|
13
|
+
date: 2017-10-11 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: httparty
|
@@ -213,28 +214,28 @@ dependencies:
|
|
213
214
|
requirements:
|
214
215
|
- - "~>"
|
215
216
|
- !ruby/object:Gem::Version
|
216
|
-
version:
|
217
|
+
version: 0.46.0
|
217
218
|
type: :development
|
218
219
|
prerelease: false
|
219
220
|
version_requirements: !ruby/object:Gem::Requirement
|
220
221
|
requirements:
|
221
222
|
- - "~>"
|
222
223
|
- !ruby/object:Gem::Version
|
223
|
-
version:
|
224
|
+
version: 0.46.0
|
224
225
|
- !ruby/object:Gem::Dependency
|
225
226
|
name: rubocop-rspec
|
226
227
|
requirement: !ruby/object:Gem::Requirement
|
227
228
|
requirements:
|
228
229
|
- - "~>"
|
229
230
|
- !ruby/object:Gem::Version
|
230
|
-
version:
|
231
|
+
version: 1.8.0
|
231
232
|
type: :development
|
232
233
|
prerelease: false
|
233
234
|
version_requirements: !ruby/object:Gem::Requirement
|
234
235
|
requirements:
|
235
236
|
- - "~>"
|
236
237
|
- !ruby/object:Gem::Version
|
237
|
-
version:
|
238
|
+
version: 1.8.0
|
238
239
|
description: This gem uses the HTTParty library to abstract away the REST calls. It
|
239
240
|
gives you access to a number of objects that behave a lot like ActiveRecord instances,
|
240
241
|
giving you access to methods like `all`, `find`, `find_by_...` and so on. And each
|
@@ -268,6 +269,7 @@ files:
|
|
268
269
|
- lib/fortnox/api/class_methods.rb
|
269
270
|
- lib/fortnox/api/environment_validation.rb
|
270
271
|
- lib/fortnox/api/mappers.rb
|
272
|
+
- lib/fortnox/api/mappers/article.rb
|
271
273
|
- lib/fortnox/api/mappers/base.rb
|
272
274
|
- lib/fortnox/api/mappers/base/from_json.rb
|
273
275
|
- lib/fortnox/api/mappers/base/to_json.rb
|
@@ -282,6 +284,7 @@ files:
|
|
282
284
|
- lib/fortnox/api/mappers/order_row.rb
|
283
285
|
- lib/fortnox/api/mappers/project.rb
|
284
286
|
- lib/fortnox/api/models.rb
|
287
|
+
- lib/fortnox/api/models/article.rb
|
285
288
|
- lib/fortnox/api/models/base.rb
|
286
289
|
- lib/fortnox/api/models/customer.rb
|
287
290
|
- lib/fortnox/api/models/document_base.rb
|
@@ -290,6 +293,7 @@ files:
|
|
290
293
|
- lib/fortnox/api/models/order.rb
|
291
294
|
- lib/fortnox/api/models/project.rb
|
292
295
|
- lib/fortnox/api/repositories.rb
|
296
|
+
- lib/fortnox/api/repositories/article.rb
|
293
297
|
- lib/fortnox/api/repositories/base.rb
|
294
298
|
- lib/fortnox/api/repositories/base/loaders.rb
|
295
299
|
- lib/fortnox/api/repositories/base/savers.rb
|
@@ -314,6 +318,7 @@ files:
|
|
314
318
|
- lib/fortnox/api/types/sized.rb
|
315
319
|
- lib/fortnox/api/version.rb
|
316
320
|
- spec/fortnox/api/base_spec.rb
|
321
|
+
- spec/fortnox/api/mappers/article_spec.rb
|
317
322
|
- spec/fortnox/api/mappers/base/from_json_spec.rb
|
318
323
|
- spec/fortnox/api/mappers/base/to_json_spec.rb
|
319
324
|
- spec/fortnox/api/mappers/base_spec.rb
|
@@ -328,6 +333,7 @@ files:
|
|
328
333
|
- spec/fortnox/api/mappers/order_row_spec.rb
|
329
334
|
- spec/fortnox/api/mappers/order_spec.rb
|
330
335
|
- spec/fortnox/api/mappers/project_spec.rb
|
336
|
+
- spec/fortnox/api/models/article_spec.rb
|
331
337
|
- spec/fortnox/api/models/base_spec.rb
|
332
338
|
- spec/fortnox/api/models/customer_spec.rb
|
333
339
|
- spec/fortnox/api/models/examples/document_base.rb
|
@@ -335,6 +341,7 @@ files:
|
|
335
341
|
- spec/fortnox/api/models/invoice_spec.rb
|
336
342
|
- spec/fortnox/api/models/order_spec.rb
|
337
343
|
- spec/fortnox/api/models/project_spec.rb
|
344
|
+
- spec/fortnox/api/repositories/article_spec.rb
|
338
345
|
- spec/fortnox/api/repositories/customer_spec.rb
|
339
346
|
- spec/fortnox/api/repositories/examples/all.rb
|
340
347
|
- spec/fortnox/api/repositories/examples/find.rb
|
@@ -392,6 +399,19 @@ files:
|
|
392
399
|
- spec/support/matchers/type/require_attribute_matcher.rb
|
393
400
|
- spec/support/matchers/type/type_matcher.rb
|
394
401
|
- spec/support/vcr_setup.rb
|
402
|
+
- spec/vcr_cassettes/articles/all.yml
|
403
|
+
- spec/vcr_cassettes/articles/find_by_hash_failure.yml
|
404
|
+
- spec/vcr_cassettes/articles/find_failure.yml
|
405
|
+
- spec/vcr_cassettes/articles/find_id_1.yml
|
406
|
+
- spec/vcr_cassettes/articles/find_new.yml
|
407
|
+
- spec/vcr_cassettes/articles/multi_param_find_by_hash.yml
|
408
|
+
- spec/vcr_cassettes/articles/save_new.yml
|
409
|
+
- spec/vcr_cassettes/articles/save_old.yml
|
410
|
+
- spec/vcr_cassettes/articles/save_with_specially_named_attribute.yml
|
411
|
+
- spec/vcr_cassettes/articles/search_by_name.yml
|
412
|
+
- spec/vcr_cassettes/articles/search_miss.yml
|
413
|
+
- spec/vcr_cassettes/articles/search_with_special_char.yml
|
414
|
+
- spec/vcr_cassettes/articles/single_param_find_by_hash.yml
|
395
415
|
- spec/vcr_cassettes/customers/all.yml
|
396
416
|
- spec/vcr_cassettes/customers/find_by_hash_failure.yml
|
397
417
|
- spec/vcr_cassettes/customers/find_failure.yml
|
@@ -484,12 +504,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
484
504
|
version: '0'
|
485
505
|
requirements: []
|
486
506
|
rubyforge_project:
|
487
|
-
rubygems_version: 2.5.
|
507
|
+
rubygems_version: 2.5.2
|
488
508
|
signing_key:
|
489
509
|
specification_version: 4
|
490
510
|
summary: Gem to use Fortnox REST API in Ruby.
|
491
511
|
test_files:
|
492
512
|
- spec/fortnox/api/base_spec.rb
|
513
|
+
- spec/fortnox/api/mappers/article_spec.rb
|
493
514
|
- spec/fortnox/api/mappers/base/from_json_spec.rb
|
494
515
|
- spec/fortnox/api/mappers/base/to_json_spec.rb
|
495
516
|
- spec/fortnox/api/mappers/base_spec.rb
|
@@ -504,6 +525,7 @@ test_files:
|
|
504
525
|
- spec/fortnox/api/mappers/order_row_spec.rb
|
505
526
|
- spec/fortnox/api/mappers/order_spec.rb
|
506
527
|
- spec/fortnox/api/mappers/project_spec.rb
|
528
|
+
- spec/fortnox/api/models/article_spec.rb
|
507
529
|
- spec/fortnox/api/models/base_spec.rb
|
508
530
|
- spec/fortnox/api/models/customer_spec.rb
|
509
531
|
- spec/fortnox/api/models/examples/document_base.rb
|
@@ -511,6 +533,7 @@ test_files:
|
|
511
533
|
- spec/fortnox/api/models/invoice_spec.rb
|
512
534
|
- spec/fortnox/api/models/order_spec.rb
|
513
535
|
- spec/fortnox/api/models/project_spec.rb
|
536
|
+
- spec/fortnox/api/repositories/article_spec.rb
|
514
537
|
- spec/fortnox/api/repositories/customer_spec.rb
|
515
538
|
- spec/fortnox/api/repositories/examples/all.rb
|
516
539
|
- spec/fortnox/api/repositories/examples/find.rb
|
@@ -568,6 +591,19 @@ test_files:
|
|
568
591
|
- spec/support/matchers/type/require_attribute_matcher.rb
|
569
592
|
- spec/support/matchers/type/type_matcher.rb
|
570
593
|
- spec/support/vcr_setup.rb
|
594
|
+
- spec/vcr_cassettes/articles/all.yml
|
595
|
+
- spec/vcr_cassettes/articles/find_by_hash_failure.yml
|
596
|
+
- spec/vcr_cassettes/articles/find_failure.yml
|
597
|
+
- spec/vcr_cassettes/articles/find_id_1.yml
|
598
|
+
- spec/vcr_cassettes/articles/find_new.yml
|
599
|
+
- spec/vcr_cassettes/articles/multi_param_find_by_hash.yml
|
600
|
+
- spec/vcr_cassettes/articles/save_new.yml
|
601
|
+
- spec/vcr_cassettes/articles/save_old.yml
|
602
|
+
- spec/vcr_cassettes/articles/save_with_specially_named_attribute.yml
|
603
|
+
- spec/vcr_cassettes/articles/search_by_name.yml
|
604
|
+
- spec/vcr_cassettes/articles/search_miss.yml
|
605
|
+
- spec/vcr_cassettes/articles/search_with_special_char.yml
|
606
|
+
- spec/vcr_cassettes/articles/single_param_find_by_hash.yml
|
571
607
|
- spec/vcr_cassettes/customers/all.yml
|
572
608
|
- spec/vcr_cassettes/customers/find_by_hash_failure.yml
|
573
609
|
- spec/vcr_cassettes/customers/find_failure.yml
|