fortnox-api 0.9.0 → 0.9.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 843c49685ec54b6f9e9adb7f5a16a67dc827f0d7b5e58b3d8bd8bd9fccced0db
4
- data.tar.gz: 306a7d66d0b820cc8250b887d14362a7117e8aebbffae5449ba277f30013a06d
3
+ metadata.gz: ea75f17f262d1586930c15e3114c1d65590a7f542ea7d75069c6d864c0db52ba
4
+ data.tar.gz: bcdc7c31ac33686637badff069fc6eedf9668e915a974420bccfef183c3e335b
5
5
  SHA512:
6
- metadata.gz: 1da53b39993c540c59290b111cf30b7ed99b84da62606462671fe178a342dd136f0e64ad552646c2f66d3091088b5a1961c77f9bf18a16e655e9fdfff360bc8f
7
- data.tar.gz: 293879cf697a4c9fde27fa6fa8e89d2f59d082bd983a00ee5c8b345bc5864a231c61dc4bb256e424d3c721706dd01f851c88ef886b7d8b611e34481a2558ccfe
6
+ metadata.gz: 56e587b9a912a34d08ceaed8207d9097638726423b62bc8cacd0b440d57203f079f8c527aa30bb78bd3f82cd359a11f6c153d344026109e0c9de92ff1f054e44
7
+ data.tar.gz: e02fe96b0107463dbeab810717dc08549a8d2292216455c59089f7477725df1e1ecf883af02d521c3ec69bee52fe22f4afaeddf2b473408e7f8e8f40fe039b7f
data/CHANGELOG.md CHANGED
@@ -6,7 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to
7
7
  [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
8
8
 
9
- ## [Unreleased]
9
+ ## [0.9.1]
10
+
11
+ ### Fixed
12
+ - Restored undocumented support for string keys in model attributes,
13
+ which was inadvertently removed in `v0.9.0`.
14
+ - Set correct lower limit for `Article#quantity_in_stock`
10
15
 
11
16
  ## [0.9.0]
12
17
 
@@ -96,6 +101,8 @@ and this project adheres to
96
101
 
97
102
  - Model attribute `url` is no longer null
98
103
 
104
+ [0.9.1]: https://github.com/accodeing/fortnox-api/compare/v0.9.0...v0.9.1
105
+ [0.9.0]: https://github.com/accodeing/fortnox-api/compare/v0.8.0...v0.9.0
99
106
  [0.8.0]: https://github.com/accodeing/fortnox-api/compare/v0.7.2...v0.8.0
100
107
  [0.7.2]: https://github.com/accodeing/fortnox-api/compare/v0.7.1...v0.7.2
101
108
  [0.7.1]: https://github.com/accodeing/fortnox-api/compare/v0.7.0...v0.7.1
data/DEVELOPER_README.md CHANGED
@@ -58,10 +58,7 @@ When updating the required Ruby version, you need to do the following:
58
58
 
59
59
  # Release
60
60
 
61
- 1. Update `CHANGELOG.md`
62
- 2. Bump version in `lib/fortnox/api/version.rb`
63
- 3. Release gem with `gem build fortnox-api.gemspec` and
64
- `gem push fortnox-api-[VERSION].gem`
61
+ See our separate guide for releasing Ruby gems.
65
62
 
66
63
  # Contributing
67
64
 
data/README.md CHANGED
@@ -313,23 +313,23 @@ repo.find_by( customer_number: 5 ) #=> <Fortnox::API::Collection:0x007fdf2299431
313
313
  ```
314
314
 
315
315
  If you are eagle eyed you might have spotted the different classes for the
316
- entities returned in a collection vs the one we get from find. The `Simple`
316
+ entities returned in a collection vs the one we get from find. The simple
317
317
  version of a class is used in thouse cases where the API-server doesn't return a
318
318
  full set of attributes for an entity. For customers the simple version has 10
319
319
  attributes while the full have over 40.
320
320
 
321
- > :info: \*\* Collections not implemented yet.
321
+ ### Additional parameters
322
322
 
323
- You should try to get by using the simple versions for as long as possible. Both
324
- the `Collection` and `Simple` classes have a `.full` method that will give you
325
- full versions of the entities. Bare in mind though that a collection of 20
326
- simple models that you run `.full` on will call out to the server 20 times, in
327
- sequence.
323
+ Note that `find` also supports a hash as an argument, which simply adds given
324
+ hash keys as HTTP parameters to the call. This will let you search, sort, use
325
+ limits and offsets as well as do pagination. See
326
+ [Fortnox documentation](https://developer.fortnox.se/general/parameters/) for
327
+ more information about available parameters.
328
328
 
329
- > :info: \*\* We have opened a dialog with Fortnox about this API practice to
330
- > allow for full models in the list request, on demand, and/or the ability for
331
- > the client to specify the fields of interest when making the request, as per
332
- > usual in REST APIs with partial load.
329
+ ```ruby
330
+ # Get second page of Customers
331
+ Fortnox::API::Repository::Customer.new.find { page: 2 }
332
+ ```
333
333
 
334
334
  ## Entities
335
335
 
@@ -76,7 +76,7 @@ module Fortnox
76
76
  attribute :purchase_price, Types::Sized::Float[0.0, 99_999_999_999_999.9]
77
77
 
78
78
  # QuantityInStock Quantity in stock of the article
79
- attribute :quantity_in_stock, Types::Sized::Float[0.0, 99_999_999_999_999.9]
79
+ attribute :quantity_in_stock, Types::Sized::Float[-100_000_000_000_000.0, 99_999_999_999_999.9]
80
80
 
81
81
  # ReservedQuantity Reserved quantity of the article
82
82
  attribute :reserved_quantity, Types::Nullable::Float.is(:read_only)
@@ -5,6 +5,7 @@ module Fortnox
5
5
  module Types
6
6
  class Model < Dry::Struct
7
7
  transform_types(&:omittable)
8
+ transform_keys(&:to_sym)
8
9
 
9
10
  def initialize(input_attributes)
10
11
  if (missing_key = first_missing_required_key(input_attributes))
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fortnox
4
4
  module API
5
- VERSION = '0.9.0'
5
+ VERSION = '0.9.1'
6
6
  end
7
7
  end
@@ -45,4 +45,36 @@ describe Fortnox::API::Repository::Article, integration: true, order: :defined d
45
45
 
46
46
  # VCR: Expected mathes must be updated
47
47
  include_examples '.search', :description, 'Test article', 3
48
+
49
+ describe 'limits' do
50
+ let(:article) do
51
+ VCR.use_cassette("#{vcr_dir}/#{cassette}") do
52
+ repository.save(described_class::MODEL.new(**attributes))
53
+ end
54
+ end
55
+
56
+ describe 'quantity_in_stock' do
57
+ let(:cassette) { 'limits/quantity_in_stock_min_value' }
58
+ let(:attributes) do
59
+ {
60
+ description: 'Test article',
61
+ quantity_in_stock: quantity_in_stock
62
+ }
63
+ end
64
+ let(:quantity_in_stock) { -99_999_999_999_999.9 }
65
+
66
+ it 'has a lower limit' do
67
+ expect(article.quantity_in_stock).to eq(-100_000_000_000_000.0)
68
+ end
69
+
70
+ context 'when positive' do
71
+ let(:cassette) { 'limits/quantity_in_stock_rounding_positive_value' }
72
+ let(:quantity_in_stock) { 1.123 }
73
+
74
+ it 'rounds to two decimals' do
75
+ expect(article.quantity_in_stock).to eq(1.12)
76
+ end
77
+ end
78
+ end
79
+ end
48
80
  end
@@ -220,24 +220,77 @@ describe Fortnox::API::Repository::Invoice, integration: true, order: :defined d
220
220
  end
221
221
 
222
222
  describe 'limits for invoice_row' do
223
+ let(:invoice_attributes) { { customer_number: '1', invoice_rows: invoice_rows } }
224
+ let(:model) { described_class::MODEL.new(invoice_attributes) }
225
+ let(:invoice) { VCR.use_cassette("#{vcr_dir}/#{cassette}") { repository.save(model) } }
226
+
223
227
  describe 'description' do
224
- let(:model) do
225
- described_class::MODEL.new(
226
- customer_number: '1',
227
- invoice_rows: [
228
- {
229
- article_number: '101',
230
- description: 'a' * 255
231
- }
232
- ]
233
- )
234
- end
235
- let(:saving_with_max_row_description) do
236
- VCR.use_cassette("#{vcr_dir}/row_description_limit") { repository.save(model) }
228
+ let(:cassette) { 'row_description_limit' }
229
+ let(:invoice_rows) do
230
+ [
231
+ {
232
+ article_number: '101',
233
+ description: 'a' * 255
234
+ }
235
+ ]
237
236
  end
238
237
 
239
238
  it 'allows 255 characters' do
240
- expect { saving_with_max_row_description }.not_to raise_error
239
+ expect(invoice.invoice_rows.first.description).to eq('a' * 255)
240
+ end
241
+ end
242
+
243
+ describe 'delivered_quantity' do
244
+ let(:cassette) { 'row_delivered_quantity_decimals' }
245
+ let(:invoice_rows) do
246
+ [
247
+ {
248
+ article_number: '101',
249
+ description: 'Test',
250
+ delivered_quantity: delivered_quantity
251
+ }
252
+ ]
253
+ end
254
+ let(:delivered_quantity) { 1.123 }
255
+
256
+ it 'rounds to two decimals' do
257
+ expect(invoice.invoice_rows.first.delivered_quantity).to eq 1.12
258
+ end
259
+
260
+ context 'when third decimal is 5' do
261
+ let(:cassette) { 'row_delivered_quantity_decimals_round_up' }
262
+ let(:delivered_quantity) { 1.125 }
263
+
264
+ it 'rounds up' do
265
+ expect(invoice.invoice_rows.first.delivered_quantity).to eq 1.13
266
+ end
267
+ end
268
+ end
269
+
270
+ describe 'price' do
271
+ let(:cassette) { 'row_price_limit' }
272
+ let(:invoice_rows) do
273
+ [
274
+ {
275
+ article_number: '101',
276
+ description: 'Test',
277
+ price: price
278
+ }
279
+ ]
280
+ end
281
+ let(:price) { 1.123 }
282
+
283
+ it 'rounds to two decimals' do
284
+ expect(invoice.invoice_rows.first.price).to eq 1.12
285
+ end
286
+
287
+ context 'when third decimal is 5' do
288
+ let(:cassette) { 'row_price_limit_round_up' }
289
+ let(:price) { 1.125 }
290
+
291
+ it 'rounds up' do
292
+ expect(invoice.invoice_rows.first.price).to eq 1.13
293
+ end
241
294
  end
242
295
  end
243
296
  end
@@ -46,4 +46,24 @@ RSpec.describe Fortnox::API::Types::Model do
46
46
  it { is_expected.to be_nil }
47
47
  end
48
48
  end
49
+
50
+ context 'with required keys' do
51
+ before do
52
+ stub_const('Types::Age', Dry::Types['strict.integer'].constrained(gt: 18).is(:required))
53
+
54
+ test_class = Class.new(Fortnox::API::Types::Model) do
55
+ attribute :age, Types::Age
56
+ end
57
+
58
+ stub_const('Model', test_class)
59
+ end
60
+
61
+ it 'does not raise error' do
62
+ expect { Model.new(age: 20) }.not_to raise_error
63
+ end
64
+
65
+ it 'supports string keys' do
66
+ expect { Model.new('age' => 20) }.not_to raise_error
67
+ end
68
+ end
49
69
  end
@@ -0,0 +1,63 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.fortnox.se/3/articles/
6
+ body:
7
+ encoding: UTF-8
8
+ string: "<REFRESH_TOKEN>"
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept:
13
+ - application/json
14
+ Authorization:
15
+ - "<AUTHORIZATION>"
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Content-Type:
26
+ - application/json
27
+ Date:
28
+ - Mon, 02 Dec 2024 10:17:07 GMT
29
+ Location:
30
+ - articles
31
+ X-Build:
32
+ - f42866f6f7
33
+ X-Frame-Options:
34
+ - sameorigin
35
+ X-Rack-Responsetime:
36
+ - '285'
37
+ X-Uid:
38
+ - 1d68ce0f
39
+ Transfer-Encoding:
40
+ - chunked
41
+ Server:
42
+ - Fortnox
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ X-Xss-Protection:
46
+ - '0'
47
+ Referrer-Policy:
48
+ - strict-origin-when-cross-origin
49
+ Content-Security-Policy:
50
+ - 'upgrade-insecure-requests;frame-ancestors https://*.fortnox.se;report-uri
51
+ /api/cspreport;connect-src ''self'' https://a.storyblok.com wss://*.fortnox.se
52
+ *.fortnox.se *.findity.com *.ingest.de.sentry.io mybusiness.pwc.se themes.googleusercontent.com
53
+ s3.amazonaws.com/helpjuice-static/ *.helpjuice.com *.vimeo.com fonts.googleapis.com
54
+ fonts.gstatic.com fortnox.piwik.pro api.cling.se wss://api.cling.se ''unsafe-inline''
55
+ ''unsafe-eval'' blob: data:'
56
+ Strict-Transport-Security:
57
+ - max-age=31536000; includeSubdomains
58
+ body:
59
+ encoding: UTF-8
60
+ string: '{"Article":{"@url":"https:\/\/api.fortnox.se\/3\/articles\/116","ArticleNumber":"116","Bulky":false,"ConstructionAccount":0,"Depth":0,"Description":"Test
61
+ article","DisposableQuantity":-100000000000000,"EAN":"","EUAccount":3108,"EUVATAccount":3106,"ExportAccount":3105,"Height":0,"Housework":false,"HouseworkType":null,"Active":true,"Manufacturer":null,"ManufacturerArticleNumber":"","Note":"","PurchaseAccount":4000,"PurchasePrice":0,"QuantityInStock":-100000000000000,"ReservedQuantity":0,"SalesAccount":3001,"StockGoods":false,"StockPlace":null,"StockValue":0,"StockWarning":null,"SupplierName":null,"SupplierNumber":null,"Type":"STOCK","Unit":null,"VAT":25,"WebshopArticle":false,"Weight":0,"Width":0,"Expired":false,"SalesPrice":null,"CostCalculationMethod":null,"StockAccount":null,"StockChangeAccount":null,"DirectCost":null,"FreightCost":null,"OtherCost":null,"DefaultStockPoint":null,"DefaultStockLocation":null,"CommodityCode":""}}'
62
+ recorded_at: Mon, 02 Dec 2024 10:17:07 GMT
63
+ recorded_with: VCR 6.2.0
@@ -0,0 +1,63 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.fortnox.se/3/articles/
6
+ body:
7
+ encoding: UTF-8
8
+ string: "<REFRESH_TOKEN>"
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept:
13
+ - application/json
14
+ Authorization:
15
+ - "<AUTHORIZATION>"
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Content-Type:
26
+ - application/json
27
+ Date:
28
+ - Mon, 02 Dec 2024 10:09:16 GMT
29
+ Location:
30
+ - articles
31
+ X-Build:
32
+ - f42866f6f7
33
+ X-Frame-Options:
34
+ - sameorigin
35
+ X-Rack-Responsetime:
36
+ - '243'
37
+ X-Uid:
38
+ - bf157652
39
+ Transfer-Encoding:
40
+ - chunked
41
+ Server:
42
+ - Fortnox
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ X-Xss-Protection:
46
+ - '0'
47
+ Referrer-Policy:
48
+ - strict-origin-when-cross-origin
49
+ Content-Security-Policy:
50
+ - 'upgrade-insecure-requests;frame-ancestors https://*.fortnox.se;report-uri
51
+ /api/cspreport;connect-src ''self'' https://a.storyblok.com wss://*.fortnox.se
52
+ *.fortnox.se *.findity.com *.ingest.de.sentry.io mybusiness.pwc.se themes.googleusercontent.com
53
+ s3.amazonaws.com/helpjuice-static/ *.helpjuice.com *.vimeo.com fonts.googleapis.com
54
+ fonts.gstatic.com fortnox.piwik.pro api.cling.se wss://api.cling.se ''unsafe-inline''
55
+ ''unsafe-eval'' blob: data:'
56
+ Strict-Transport-Security:
57
+ - max-age=31536000; includeSubdomains
58
+ body:
59
+ encoding: UTF-8
60
+ string: '{"Article":{"@url":"https:\/\/api.fortnox.se\/3\/articles\/109","ArticleNumber":"109","Bulky":false,"ConstructionAccount":0,"Depth":0,"Description":"Test
61
+ article","DisposableQuantity":1.12,"EAN":"","EUAccount":3108,"EUVATAccount":3106,"ExportAccount":3105,"Height":0,"Housework":false,"HouseworkType":null,"Active":true,"Manufacturer":null,"ManufacturerArticleNumber":"","Note":"","PurchaseAccount":4000,"PurchasePrice":0,"QuantityInStock":1.12,"ReservedQuantity":0,"SalesAccount":3001,"StockGoods":false,"StockPlace":null,"StockValue":0,"StockWarning":null,"SupplierName":null,"SupplierNumber":null,"Type":"STOCK","Unit":null,"VAT":25,"WebshopArticle":false,"Weight":0,"Width":0,"Expired":false,"SalesPrice":null,"CostCalculationMethod":null,"StockAccount":null,"StockChangeAccount":null,"DirectCost":null,"FreightCost":null,"OtherCost":null,"DefaultStockPoint":null,"DefaultStockLocation":null,"CommodityCode":""}}'
62
+ recorded_at: Mon, 02 Dec 2024 10:09:16 GMT
63
+ recorded_with: VCR 6.2.0
@@ -0,0 +1,65 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.fortnox.se/3/invoices/
6
+ body:
7
+ encoding: UTF-8
8
+ string: "<REFRESH_TOKEN>"
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept:
13
+ - application/json
14
+ Authorization:
15
+ - "<AUTHORIZATION>"
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Content-Type:
26
+ - application/json
27
+ Date:
28
+ - Mon, 02 Dec 2024 09:14:57 GMT
29
+ Location:
30
+ - invoices
31
+ X-Build:
32
+ - f42866f6f7
33
+ X-Frame-Options:
34
+ - sameorigin
35
+ X-Rack-Responsetime:
36
+ - '374'
37
+ X-Uid:
38
+ - 96433c4f
39
+ Transfer-Encoding:
40
+ - chunked
41
+ Server:
42
+ - Fortnox
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ X-Xss-Protection:
46
+ - '0'
47
+ Referrer-Policy:
48
+ - strict-origin-when-cross-origin
49
+ Content-Security-Policy:
50
+ - 'upgrade-insecure-requests;frame-ancestors https://*.fortnox.se;report-uri
51
+ /api/cspreport;connect-src ''self'' https://a.storyblok.com wss://*.fortnox.se
52
+ *.fortnox.se *.findity.com *.ingest.de.sentry.io mybusiness.pwc.se themes.googleusercontent.com
53
+ s3.amazonaws.com/helpjuice-static/ *.helpjuice.com *.vimeo.com fonts.googleapis.com
54
+ fonts.gstatic.com fortnox.piwik.pro api.cling.se wss://api.cling.se ''unsafe-inline''
55
+ ''unsafe-eval'' blob: data:'
56
+ Strict-Transport-Security:
57
+ - max-age=31536000; includeSubdomains
58
+ body:
59
+ encoding: UTF-8
60
+ string: '{"Invoice":{"@url":"https:\/\/api.fortnox.se\/3\/invoices\/37","@urlTaxReductionList":"https:\/\/api.fortnox.se\/3\/taxreductions?filter=invoices&referencenumber=37","AccountingMethod":"ACCRUAL","Address1":"","Address2":"","AdministrationFee":0,"AdministrationFeeVAT":0,"Balance":0,"BasisTaxReduction":0,"Booked":false,"Cancelled":false,"City":"New
61
+ York","Comments":"","ContractReference":"0","ContributionPercent":0,"ContributionValue":0,"CostCenter":"","Country":"","Credit":"false","CreditInvoiceReference":"0","Currency":"SEK","CurrencyRate":1,"CurrencyUnit":1,"CustomerName":"Updated
62
+ name","CustomerNumber":"1","DeliveryAddress1":"","DeliveryAddress2":"","DeliveryCity":"","DeliveryCountry":"","DeliveryDate":null,"DeliveryName":"","DeliveryZipCode":"","DocumentNumber":"37","DueDate":"2025-01-01","EDIInformation":{"EDIGlobalLocationNumber":null,"EDIGlobalLocationNumberDelivery":null,"EDIInvoiceExtra1":null,"EDIInvoiceExtra2":null,"EDIOurElectronicReference":null,"EDIYourElectronicReference":null,"EDIStatus":""},"EUQuarterlyReport":false,"EmailInformation":{"EmailAddressFrom":null,"EmailAddressTo":"","EmailAddressCC":null,"EmailAddressBCC":null,"EmailSubject":"Faktura
63
+ {no} bifogas","EmailBody":" "},"ExternalInvoiceReference1":"","ExternalInvoiceReference2":"","FinalPayDate":null,"Freight":0,"FreightVAT":0,"Gross":0,"HouseWork":false,"InvoiceDate":"2024-12-02","InvoicePeriodEnd":"","InvoicePeriodStart":"","InvoiceReference":"0","InvoiceRows":[{"AccountNumber":3001,"ArticleNumber":"101","ContributionPercent":"0","ContributionValue":"0","Cost":0,"CostCenter":"","DeliveredQuantity":"1.12","Description":"Test","Discount":0,"DiscountType":"PERCENT","HouseWork":false,"HouseWorkHoursToReport":null,"HouseWorkType":null,"Price":0,"PriceExcludingVAT":0,"Project":"","RowId":25,"StockPointCode":null,"Total":0,"TotalExcludingVAT":0,"Unit":"","VAT":0,"VATCode":null}],"InvoiceType":"INVOICE","Labels":[],"Language":"SV","LastRemindDate":null,"Net":0,"NotCompleted":false,"NoxFinans":false,"OCR":"3749","OfferReference":"0","OrderReference":"0","OrganisationNumber":"","OurReference":"","OutboundDate":"2024-12-02","PaymentWay":"","Phone1":"","Phone2":"","PriceList":"A","PrintTemplate":"st","Project":"","Remarks":"","Reminders":0,"RoundOff":0,"Sent":false,"TaxReduction":null,"TaxReductionType":"none","TermsOfDelivery":"","TermsOfPayment":"30","TimeBasisReference":null,"Total":0,"TotalToPay":0,"TotalVAT":0,"VATIncluded":false,"VoucherNumber":null,"VoucherSeries":null,"VoucherYear":null,"WarehouseReady":true,"WayOfDelivery":"","YourOrderNumber":"","YourReference":"","ZipCode":"10001"}}'
64
+ recorded_at: Mon, 02 Dec 2024 09:14:57 GMT
65
+ recorded_with: VCR 6.2.0
@@ -0,0 +1,65 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.fortnox.se/3/invoices/
6
+ body:
7
+ encoding: UTF-8
8
+ string: "<REFRESH_TOKEN>"
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept:
13
+ - application/json
14
+ Authorization:
15
+ - "<AUTHORIZATION>"
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Content-Type:
26
+ - application/json
27
+ Date:
28
+ - Mon, 02 Dec 2024 09:17:33 GMT
29
+ Location:
30
+ - invoices
31
+ X-Build:
32
+ - f42866f6f7
33
+ X-Frame-Options:
34
+ - sameorigin
35
+ X-Rack-Responsetime:
36
+ - '396'
37
+ X-Uid:
38
+ - 56ebdf95
39
+ Transfer-Encoding:
40
+ - chunked
41
+ Server:
42
+ - Fortnox
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ X-Xss-Protection:
46
+ - '0'
47
+ Referrer-Policy:
48
+ - strict-origin-when-cross-origin
49
+ Content-Security-Policy:
50
+ - 'upgrade-insecure-requests;frame-ancestors https://*.fortnox.se;report-uri
51
+ /api/cspreport;connect-src ''self'' https://a.storyblok.com wss://*.fortnox.se
52
+ *.fortnox.se *.findity.com *.ingest.de.sentry.io mybusiness.pwc.se themes.googleusercontent.com
53
+ s3.amazonaws.com/helpjuice-static/ *.helpjuice.com *.vimeo.com fonts.googleapis.com
54
+ fonts.gstatic.com fortnox.piwik.pro api.cling.se wss://api.cling.se ''unsafe-inline''
55
+ ''unsafe-eval'' blob: data:'
56
+ Strict-Transport-Security:
57
+ - max-age=31536000; includeSubdomains
58
+ body:
59
+ encoding: UTF-8
60
+ string: '{"Invoice":{"@url":"https:\/\/api.fortnox.se\/3\/invoices\/38","@urlTaxReductionList":"https:\/\/api.fortnox.se\/3\/taxreductions?filter=invoices&referencenumber=38","AccountingMethod":"ACCRUAL","Address1":"","Address2":"","AdministrationFee":0,"AdministrationFeeVAT":0,"Balance":0,"BasisTaxReduction":0,"Booked":false,"Cancelled":false,"City":"New
61
+ York","Comments":"","ContractReference":"0","ContributionPercent":0,"ContributionValue":0,"CostCenter":"","Country":"","Credit":"false","CreditInvoiceReference":"0","Currency":"SEK","CurrencyRate":1,"CurrencyUnit":1,"CustomerName":"Updated
62
+ name","CustomerNumber":"1","DeliveryAddress1":"","DeliveryAddress2":"","DeliveryCity":"","DeliveryCountry":"","DeliveryDate":null,"DeliveryName":"","DeliveryZipCode":"","DocumentNumber":"38","DueDate":"2025-01-01","EDIInformation":{"EDIGlobalLocationNumber":null,"EDIGlobalLocationNumberDelivery":null,"EDIInvoiceExtra1":null,"EDIInvoiceExtra2":null,"EDIOurElectronicReference":null,"EDIYourElectronicReference":null,"EDIStatus":""},"EUQuarterlyReport":false,"EmailInformation":{"EmailAddressFrom":null,"EmailAddressTo":"","EmailAddressCC":null,"EmailAddressBCC":null,"EmailSubject":"Faktura
63
+ {no} bifogas","EmailBody":" "},"ExternalInvoiceReference1":"","ExternalInvoiceReference2":"","FinalPayDate":null,"Freight":0,"FreightVAT":0,"Gross":0,"HouseWork":false,"InvoiceDate":"2024-12-02","InvoicePeriodEnd":"","InvoicePeriodStart":"","InvoiceReference":"0","InvoiceRows":[{"AccountNumber":3001,"ArticleNumber":"101","ContributionPercent":"0","ContributionValue":"0","Cost":0,"CostCenter":"","DeliveredQuantity":"1.13","Description":"Test","Discount":0,"DiscountType":"PERCENT","HouseWork":false,"HouseWorkHoursToReport":null,"HouseWorkType":null,"Price":0,"PriceExcludingVAT":0,"Project":"","RowId":26,"StockPointCode":null,"Total":0,"TotalExcludingVAT":0,"Unit":"","VAT":0,"VATCode":null}],"InvoiceType":"INVOICE","Labels":[],"Language":"SV","LastRemindDate":null,"Net":0,"NotCompleted":false,"NoxFinans":false,"OCR":"3848","OfferReference":"0","OrderReference":"0","OrganisationNumber":"","OurReference":"","OutboundDate":"2024-12-02","PaymentWay":"","Phone1":"","Phone2":"","PriceList":"A","PrintTemplate":"st","Project":"","Remarks":"","Reminders":0,"RoundOff":0,"Sent":false,"TaxReduction":null,"TaxReductionType":"none","TermsOfDelivery":"","TermsOfPayment":"30","TimeBasisReference":null,"Total":0,"TotalToPay":0,"TotalVAT":0,"VATIncluded":false,"VoucherNumber":null,"VoucherSeries":null,"VoucherYear":null,"WarehouseReady":true,"WayOfDelivery":"","YourOrderNumber":"","YourReference":"","ZipCode":"10001"}}'
64
+ recorded_at: Mon, 02 Dec 2024 09:17:33 GMT
65
+ recorded_with: VCR 6.2.0
@@ -0,0 +1,65 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.fortnox.se/3/invoices/
6
+ body:
7
+ encoding: UTF-8
8
+ string: "<REFRESH_TOKEN>"
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept:
13
+ - application/json
14
+ Authorization:
15
+ - "<AUTHORIZATION>"
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Content-Type:
26
+ - application/json
27
+ Date:
28
+ - Mon, 02 Dec 2024 09:22:00 GMT
29
+ Location:
30
+ - invoices
31
+ X-Build:
32
+ - f42866f6f7
33
+ X-Frame-Options:
34
+ - sameorigin
35
+ X-Rack-Responsetime:
36
+ - '487'
37
+ X-Uid:
38
+ - a75367ce
39
+ Transfer-Encoding:
40
+ - chunked
41
+ Server:
42
+ - Fortnox
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ X-Xss-Protection:
46
+ - '0'
47
+ Referrer-Policy:
48
+ - strict-origin-when-cross-origin
49
+ Content-Security-Policy:
50
+ - 'upgrade-insecure-requests;frame-ancestors https://*.fortnox.se;report-uri
51
+ /api/cspreport;connect-src ''self'' https://a.storyblok.com wss://*.fortnox.se
52
+ *.fortnox.se *.findity.com *.ingest.de.sentry.io mybusiness.pwc.se themes.googleusercontent.com
53
+ s3.amazonaws.com/helpjuice-static/ *.helpjuice.com *.vimeo.com fonts.googleapis.com
54
+ fonts.gstatic.com fortnox.piwik.pro api.cling.se wss://api.cling.se ''unsafe-inline''
55
+ ''unsafe-eval'' blob: data:'
56
+ Strict-Transport-Security:
57
+ - max-age=31536000; includeSubdomains
58
+ body:
59
+ encoding: UTF-8
60
+ string: '{"Invoice":{"@url":"https:\/\/api.fortnox.se\/3\/invoices\/39","@urlTaxReductionList":"https:\/\/api.fortnox.se\/3\/taxreductions?filter=invoices&referencenumber=39","AccountingMethod":"ACCRUAL","Address1":"","Address2":"","AdministrationFee":0,"AdministrationFeeVAT":0,"Balance":0,"BasisTaxReduction":0,"Booked":false,"Cancelled":false,"City":"New
61
+ York","Comments":"","ContractReference":"0","ContributionPercent":0,"ContributionValue":0,"CostCenter":"","Country":"","Credit":"false","CreditInvoiceReference":"0","Currency":"SEK","CurrencyRate":1,"CurrencyUnit":1,"CustomerName":"Updated
62
+ name","CustomerNumber":"1","DeliveryAddress1":"","DeliveryAddress2":"","DeliveryCity":"","DeliveryCountry":"","DeliveryDate":null,"DeliveryName":"","DeliveryZipCode":"","DocumentNumber":"39","DueDate":"2025-01-01","EDIInformation":{"EDIGlobalLocationNumber":null,"EDIGlobalLocationNumberDelivery":null,"EDIInvoiceExtra1":null,"EDIInvoiceExtra2":null,"EDIOurElectronicReference":null,"EDIYourElectronicReference":null,"EDIStatus":""},"EUQuarterlyReport":false,"EmailInformation":{"EmailAddressFrom":null,"EmailAddressTo":"","EmailAddressCC":null,"EmailAddressBCC":null,"EmailSubject":"Faktura
63
+ {no} bifogas","EmailBody":" "},"ExternalInvoiceReference1":"","ExternalInvoiceReference2":"","FinalPayDate":null,"Freight":0,"FreightVAT":0,"Gross":0,"HouseWork":false,"InvoiceDate":"2024-12-02","InvoicePeriodEnd":"","InvoicePeriodStart":"","InvoiceReference":"0","InvoiceRows":[{"AccountNumber":3001,"ArticleNumber":"101","ContributionPercent":"0","ContributionValue":"0","Cost":0,"CostCenter":"","DeliveredQuantity":"0","Description":"Test","Discount":0,"DiscountType":"PERCENT","HouseWork":false,"HouseWorkHoursToReport":null,"HouseWorkType":null,"Price":1.12,"PriceExcludingVAT":1.12,"Project":"","RowId":27,"StockPointCode":null,"Total":0,"TotalExcludingVAT":0,"Unit":"","VAT":0,"VATCode":null}],"InvoiceType":"INVOICE","Labels":[],"Language":"SV","LastRemindDate":null,"Net":0,"NotCompleted":false,"NoxFinans":false,"OCR":"3947","OfferReference":"0","OrderReference":"0","OrganisationNumber":"","OurReference":"","OutboundDate":"2024-12-02","PaymentWay":"","Phone1":"","Phone2":"","PriceList":"A","PrintTemplate":"st","Project":"","Remarks":"","Reminders":0,"RoundOff":0,"Sent":false,"TaxReduction":null,"TaxReductionType":"none","TermsOfDelivery":"","TermsOfPayment":"30","TimeBasisReference":null,"Total":0,"TotalToPay":0,"TotalVAT":0,"VATIncluded":false,"VoucherNumber":null,"VoucherSeries":null,"VoucherYear":null,"WarehouseReady":true,"WayOfDelivery":"","YourOrderNumber":"","YourReference":"","ZipCode":"10001"}}'
64
+ recorded_at: Mon, 02 Dec 2024 09:22:00 GMT
65
+ recorded_with: VCR 6.2.0
@@ -0,0 +1,65 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.fortnox.se/3/invoices/
6
+ body:
7
+ encoding: UTF-8
8
+ string: "<REFRESH_TOKEN>"
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept:
13
+ - application/json
14
+ Authorization:
15
+ - "<AUTHORIZATION>"
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Content-Type:
26
+ - application/json
27
+ Date:
28
+ - Mon, 02 Dec 2024 09:22:29 GMT
29
+ Location:
30
+ - invoices
31
+ X-Build:
32
+ - f42866f6f7
33
+ X-Frame-Options:
34
+ - sameorigin
35
+ X-Rack-Responsetime:
36
+ - '387'
37
+ X-Uid:
38
+ - 4dfe0e45
39
+ Transfer-Encoding:
40
+ - chunked
41
+ Server:
42
+ - Fortnox
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ X-Xss-Protection:
46
+ - '0'
47
+ Referrer-Policy:
48
+ - strict-origin-when-cross-origin
49
+ Content-Security-Policy:
50
+ - 'upgrade-insecure-requests;frame-ancestors https://*.fortnox.se;report-uri
51
+ /api/cspreport;connect-src ''self'' https://a.storyblok.com wss://*.fortnox.se
52
+ *.fortnox.se *.findity.com *.ingest.de.sentry.io mybusiness.pwc.se themes.googleusercontent.com
53
+ s3.amazonaws.com/helpjuice-static/ *.helpjuice.com *.vimeo.com fonts.googleapis.com
54
+ fonts.gstatic.com fortnox.piwik.pro api.cling.se wss://api.cling.se ''unsafe-inline''
55
+ ''unsafe-eval'' blob: data:'
56
+ Strict-Transport-Security:
57
+ - max-age=31536000; includeSubdomains
58
+ body:
59
+ encoding: UTF-8
60
+ string: '{"Invoice":{"@url":"https:\/\/api.fortnox.se\/3\/invoices\/40","@urlTaxReductionList":"https:\/\/api.fortnox.se\/3\/taxreductions?filter=invoices&referencenumber=40","AccountingMethod":"ACCRUAL","Address1":"","Address2":"","AdministrationFee":0,"AdministrationFeeVAT":0,"Balance":0,"BasisTaxReduction":0,"Booked":false,"Cancelled":false,"City":"New
61
+ York","Comments":"","ContractReference":"0","ContributionPercent":0,"ContributionValue":0,"CostCenter":"","Country":"","Credit":"false","CreditInvoiceReference":"0","Currency":"SEK","CurrencyRate":1,"CurrencyUnit":1,"CustomerName":"Updated
62
+ name","CustomerNumber":"1","DeliveryAddress1":"","DeliveryAddress2":"","DeliveryCity":"","DeliveryCountry":"","DeliveryDate":null,"DeliveryName":"","DeliveryZipCode":"","DocumentNumber":"40","DueDate":"2025-01-01","EDIInformation":{"EDIGlobalLocationNumber":null,"EDIGlobalLocationNumberDelivery":null,"EDIInvoiceExtra1":null,"EDIInvoiceExtra2":null,"EDIOurElectronicReference":null,"EDIYourElectronicReference":null,"EDIStatus":""},"EUQuarterlyReport":false,"EmailInformation":{"EmailAddressFrom":null,"EmailAddressTo":"","EmailAddressCC":null,"EmailAddressBCC":null,"EmailSubject":"Faktura
63
+ {no} bifogas","EmailBody":" "},"ExternalInvoiceReference1":"","ExternalInvoiceReference2":"","FinalPayDate":null,"Freight":0,"FreightVAT":0,"Gross":0,"HouseWork":false,"InvoiceDate":"2024-12-02","InvoicePeriodEnd":"","InvoicePeriodStart":"","InvoiceReference":"0","InvoiceRows":[{"AccountNumber":3001,"ArticleNumber":"101","ContributionPercent":"0","ContributionValue":"0","Cost":0,"CostCenter":"","DeliveredQuantity":"0","Description":"Test","Discount":0,"DiscountType":"PERCENT","HouseWork":false,"HouseWorkHoursToReport":null,"HouseWorkType":null,"Price":1.13,"PriceExcludingVAT":1.13,"Project":"","RowId":28,"StockPointCode":null,"Total":0,"TotalExcludingVAT":0,"Unit":"","VAT":0,"VATCode":null}],"InvoiceType":"INVOICE","Labels":[],"Language":"SV","LastRemindDate":null,"Net":0,"NotCompleted":false,"NoxFinans":false,"OCR":"4044","OfferReference":"0","OrderReference":"0","OrganisationNumber":"","OurReference":"","OutboundDate":"2024-12-02","PaymentWay":"","Phone1":"","Phone2":"","PriceList":"A","PrintTemplate":"st","Project":"","Remarks":"","Reminders":0,"RoundOff":0,"Sent":false,"TaxReduction":null,"TaxReductionType":"none","TermsOfDelivery":"","TermsOfPayment":"30","TimeBasisReference":null,"Total":0,"TotalToPay":0,"TotalVAT":0,"VATIncluded":false,"VoucherNumber":null,"VoucherSeries":null,"VoucherYear":null,"WarehouseReady":true,"WayOfDelivery":"","YourOrderNumber":"","YourReference":"","ZipCode":"10001"}}'
64
+ recorded_at: Mon, 02 Dec 2024 09:22:29 GMT
65
+ recorded_with: VCR 6.2.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fortnox-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Schubert Erlandsson
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2023-02-22 00:00:00.000000000 Z
14
+ date: 2025-01-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: countries
@@ -499,6 +499,8 @@ files:
499
499
  - spec/vcr_cassettes/articles/find_failure.yml
500
500
  - spec/vcr_cassettes/articles/find_id_1.yml
501
501
  - spec/vcr_cassettes/articles/find_new.yml
502
+ - spec/vcr_cassettes/articles/limits/quantity_in_stock_min_value.yml
503
+ - spec/vcr_cassettes/articles/limits/quantity_in_stock_rounding_positive_value.yml
502
504
  - spec/vcr_cassettes/articles/multi_param_find_by_hash.yml
503
505
  - spec/vcr_cassettes/articles/save_new.yml
504
506
  - spec/vcr_cassettes/articles/save_old.yml
@@ -535,7 +537,11 @@ files:
535
537
  - spec/vcr_cassettes/invoices/find_id_1.yml
536
538
  - spec/vcr_cassettes/invoices/find_new.yml
537
539
  - spec/vcr_cassettes/invoices/multi_param_find_by_hash.yml
540
+ - spec/vcr_cassettes/invoices/row_delivered_quantity_decimals.yml
541
+ - spec/vcr_cassettes/invoices/row_delivered_quantity_decimals_round_up.yml
538
542
  - spec/vcr_cassettes/invoices/row_description_limit.yml
543
+ - spec/vcr_cassettes/invoices/row_price_limit.yml
544
+ - spec/vcr_cassettes/invoices/row_price_limit_round_up.yml
539
545
  - spec/vcr_cassettes/invoices/save_new.yml
540
546
  - spec/vcr_cassettes/invoices/save_new_with_comments.yml
541
547
  - spec/vcr_cassettes/invoices/save_new_with_country.yml