saft 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dbac905e282930a2cb6da9bcbecdecf0ef0bd071aa5c45418f3795204d161d8
4
- data.tar.gz: 316fe426fbac259057ffdfa4f279741f3d3c3cba22dac1ee854e7448843fe35e
3
+ metadata.gz: a76e54f031fc17d96e1828ff1a106e97db9afb33a6726fd2ca62e8e6dacbdae2
4
+ data.tar.gz: 38f265b7da01df877e72c98e1f21227c05d8eadcd0d64d5e27a29feca7fbc406
5
5
  SHA512:
6
- metadata.gz: 2f307ff77d1749615135d194bfc2eda65352a856330c22a79a6db32575ea1c074362b2e9b73f3429328622673eddc5c76d847896ba0a17b61bcab6803ca8e198
7
- data.tar.gz: 26d34531bea91a1981e3bcd47204d648f222890ff0f74c3c46530d1a887e40d7174968cc4872eecf31ce191b4fb9fa9300f0b515780e664b146f6c2e317a9350
6
+ metadata.gz: bc4dbd2a05b21d8f2b19adecfc2fcac11d869ad997160a4520c22673f9a68c4ae904c04f26157f7a26b5c82a55d86604145e00e0c80ac72700eba87f41625651
7
+ data.tar.gz: 7e0df900ce7eca5fa5124822c9a98e05b18f4394a3886672c261f68c33e5464abf63a13bcbf4e9d9f42601f7db6ed885e3d0de06348e3ecb7142cf2df01ef313
data/.gemspec CHANGED
@@ -8,20 +8,21 @@ Gem::Specification.new do |spec|
8
8
  spec.summary = "SAF-T parser and writer"
9
9
  spec.authors = ["Dodo developer", "Simon Toivo Telhaug"]
10
10
  spec.email = ["simon.toivo.telhaug@dev.dodo.no"]
11
- # spec.homepage = "http://tba.no"
11
+ spec.homepage = "https://github.com/dodoas/ruby-saft"
12
12
 
13
13
  spec.license = "MIT"
14
14
  spec.required_ruby_version = ">= 2.6.0"
15
- # spec.metadata["homepage_uri"] = spec.homepage
16
- # spec.metadata["source_code_uri"] = spec.homepage
17
- # spec.metadata["changelog_uri"] = "#{spec.homepage}/CHANGELOG.md"
15
+ spec.metadata["homepage_uri"] = spec.homepage
16
+ spec.metadata["source_code_uri"] = spec.homepage
17
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/CHANGELOG.md"
18
18
 
19
19
  # Specify which files should be added to the gem when it is released.
20
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
21
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
- `git ls-files -z`.split("\x0").reject do |f|
23
- (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git))})
24
- end
22
+ `git ls-files -z`.split("\x0")
23
+ .reject { |f| f == __FILE__ }
24
+ .reject { |f| f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git))}) }
25
+ .reject { |f| f.start_with? "docs/" }
25
26
  end
26
27
 
27
28
  spec.bindir = "exe"
data/lib/saft/v2/html.rb CHANGED
@@ -14,10 +14,11 @@ module SAFT::V2
14
14
  end
15
15
 
16
16
  def self.format_big_decimal(big_decimal)
17
- integer, decimal = big_decimal.to_s("F").split(".")
17
+ negative = big_decimal.negative?
18
+ integer, decimal = big_decimal.abs.to_s("F").split(".")
18
19
  integer = integer.reverse.scan(/.{1,3}/).join(" ").reverse
19
20
 
20
- "#{integer},#{decimal.ljust(2, "0")}"
21
+ "#{negative ? "-" : ""}#{integer},#{decimal.ljust(2, "0")}"
21
22
  end
22
23
 
23
24
  module DryStructRenderTubby
@@ -121,7 +122,7 @@ module SAFT::V2
121
122
  end
122
123
 
123
124
  if tax_table
124
- t.strong("Tax able")
125
+ t.strong("Tax table")
125
126
  t.div(class: "pl-2 border-l-2") { t << TaxTable.new(tax_table) }
126
127
  end
127
128
 
data/lib/saft/v2/types.rb CHANGED
@@ -19,7 +19,7 @@ module SAFT::V2::Types
19
19
  Decimal = Coercible::Decimal
20
20
  Bool = Params::Bool
21
21
  String = Strict::String
22
- PositiveInteger = Types::Integer.constrained(gteq: 0)
22
+ NonNegativeIntegers = Types::Integer.constrained(gteq: 0)
23
23
  end
24
24
 
25
25
  # not Ideal as we are extending the global scope
@@ -30,7 +30,7 @@ module SAFT::V2::Types
30
30
  n_significant_digits <= num
31
31
  end
32
32
 
33
- Dry::Logic::Predicates.predicate(:fraction_digitst?) do |num, input|
33
+ Dry::Logic::Predicates.predicate(:fraction_digits?) do |num, input|
34
34
  digits?(num, input.frac)
35
35
  end
36
36
 
@@ -97,9 +97,9 @@ module SAFT::V2::Types
97
97
  attribute(:company_entity, base::SAFmiddle2textType.optional.meta(omittable: true))
98
98
  attribute(:selection_start_date, Types::Date.optional.meta(omittable: true))
99
99
  attribute(:selection_end_date, Types::Date.optional.meta(omittable: true))
100
- attribute(:period_start, Types::PositiveInteger.optional.meta(omittable: true))
100
+ attribute(:period_start, Types::NonNegativeIntegers.optional.meta(omittable: true))
101
101
  attribute(:period_start_year, Types::Integer.constrained(gteq: 1970).constrained(lteq: 2100).optional.meta(omittable: true))
102
- attribute(:period_end, Types::PositiveInteger.optional.meta(omittable: true))
102
+ attribute(:period_end, Types::NonNegativeIntegers.optional.meta(omittable: true))
103
103
  attribute(:period_end_year, Types::Integer.constrained(gteq: 1970).constrained(lteq: 2100).optional.meta(omittable: true))
104
104
  attribute(:document_type, base::SAFlongtextType.optional.meta(omittable: true))
105
105
  attribute(:other_criterias, Types::Array.of(base::SAFlongtextType).optional.meta(omittable: true))
@@ -121,9 +121,9 @@ module SAFT::V2::Types
121
121
  base.const_set(:PersonNameStructure, klass)
122
122
 
123
123
  klass = Class.new(Dry::Struct) do
124
- attribute(:days, Types::PositiveInteger.optional.meta(omittable: true))
125
- attribute(:months, Types::PositiveInteger.optional.meta(omittable: true))
126
- attribute(:cash_discount_days, Types::PositiveInteger.optional.meta(omittable: true))
124
+ attribute(:days, Types::NonNegativeIntegers.optional.meta(omittable: true))
125
+ attribute(:months, Types::NonNegativeIntegers.optional.meta(omittable: true))
126
+ attribute(:cash_discount_days, Types::NonNegativeIntegers.optional.meta(omittable: true))
127
127
  attribute(:cash_discount_rate, Types::Decimal.constrained(gteq: 0).constrained(lteq: 100).optional.meta(omittable: true))
128
128
  attribute(:free_billing_month, Types::Bool.optional.meta(omittable: true))
129
129
  end
@@ -449,10 +449,10 @@ module SAFT::V2::Types
449
449
  SAFmiddle1textType = Types::String.constrained(max_size: 35)
450
450
  SAFmiddle2textType = Types::String.constrained(max_size: 70)
451
451
  SAFlongtextType = Types::String.constrained(max_size: 256)
452
- SAFmonetaryType = Types::Decimal.constrained(digits: 18, fraction_digitst: 2)
453
- SAFexchangerateType = Types::Decimal.constrained(digits: 18, fraction_digitst: 8)
454
- SAFquantityType = Types::Decimal.constrained(digits: 22, fraction_digitst: 6)
455
- SAFweightType = Types::Decimal.constrained(digits: 14, fraction_digitst: 3)
452
+ SAFmonetaryType = Types::Decimal.constrained(digits: 18, fraction_digits: 2)
453
+ SAFexchangerateType = Types::Decimal.constrained(digits: 18, fraction_digits: 8)
454
+ SAFquantityType = Types::Decimal.constrained(digits: 22, fraction_digits: 6)
455
+ SAFweightType = Types::Decimal.constrained(digits: 14, fraction_digits: 3)
456
456
  AddressType = Types::String.enum("StreetAddress", "PostalAddress", "BillingAddress", "ShipToAddress", "ShipFromAddress")
457
457
 
458
458
  extend ObjectStrutures
@@ -476,12 +476,12 @@ module SAFT::V2::Types
476
476
  SAFmiddle1textType = Types.Constructor(Strict::SAFmiddle1textType, &slice_string(35))
477
477
  SAFmiddle2textType = Types.Constructor(Strict::SAFmiddle2textType, &slice_string(70))
478
478
  SAFlongtextType = Types.Constructor(Strict::SAFlongtextType, &slice_string(256))
479
- SAFmonetaryType = Types::Decimal.constrained(digits: 18, fraction_digitst: 2)
480
- SAFexchangerateType = Types::Decimal.constrained(digits: 18, fraction_digitst: 8)
481
- SAFquantityType = Types::Decimal.constrained(digits: 22, fraction_digitst: 6)
482
- SAFweightType = Types::Decimal.constrained(digits: 14, fraction_digitst: 3)
479
+ SAFmonetaryType = Strict::SAFmonetaryType
480
+ SAFexchangerateType = Strict::SAFexchangerateType
481
+ SAFquantityType = Strict::SAFquantityType
482
+ SAFweightType = Strict::SAFweightType
483
483
 
484
- AddressType = Types::String.enum("StreetAddress", "PostalAddress", "BillingAddress", "ShipToAddress", "ShipFromAddress")
484
+ AddressType = Strict::AddressType
485
485
 
486
486
  extend ObjectStrutures
487
487
  end
data/lib/saft/version.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SAFT
2
- VERSION = "0.1.1"
4
+ VERSION = "0.2.0"
3
5
  end
data/package.json CHANGED
@@ -3,6 +3,7 @@
3
3
  "version": "1.0.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
+ "private": true,
6
7
  "scripts": {
7
8
  "test": "echo \"Error: no test specified\" && exit 1"
8
9
  },
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dodo developer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-12-15 00:00:00.000000000 Z
12
+ date: 2022-12-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: zeitwerk
@@ -68,9 +68,6 @@ files:
68
68
  - CHANGELOG.md
69
69
  - Gemfile
70
70
  - Rakefile
71
- - docs/Norwegian SAF-T Financial data.pdf
72
- - docs/Norwegian SAF-T Standard VAT:Tax codes.pdf
73
- - docs/saf-t v2 xsd by oecd.pdf
74
71
  - lib/saft.rb
75
72
  - lib/saft/v2.rb
76
73
  - lib/saft/v2/html.css
@@ -95,10 +92,13 @@ files:
95
92
  - vendor/norway/standard_tax_codes.csv
96
93
  - vendor/norway/standard_tax_codes.xml
97
94
  - vendor/norway/standard_tax_codes.xsd
98
- homepage:
95
+ homepage: https://github.com/dodoas/ruby-saft
99
96
  licenses:
100
97
  - MIT
101
- metadata: {}
98
+ metadata:
99
+ homepage_uri: https://github.com/dodoas/ruby-saft
100
+ source_code_uri: https://github.com/dodoas/ruby-saft
101
+ changelog_uri: https://github.com/dodoas/ruby-saft/CHANGELOG.md
102
102
  post_install_message:
103
103
  rdoc_options: []
104
104
  require_paths:
Binary file