ftf 0.0.7 → 0.0.9
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/ftf-0.0.8.gem +0 -0
- data/lib/ftf/generator.rb +7 -4
- data/lib/ftf/mappings/holder.rb +12 -4
- data/lib/ftf/version.rb +1 -1
- data/test.json +105 -0
- data/test_generate.rb +10 -0
- data/test_validate.rb +15 -0
- metadata +10 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 28fd260a50ddfbb3a1a6d41fb13f2d311b67e9ba40e1d74e8eaec0caecbf9e71
|
|
4
|
+
data.tar.gz: aff01ec6e5a3c3e3dc79cb136f0cae783f42095cf5c00f2c9839863d2ea9cc7d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c0d7e7d6eb843b3997bac0f4defd28535cd1a076dc6bc4d2740288d2607a13c9b0bcb99ae09cbd4b459cff6e2b876c0c2e4d03deffacfddf4728250be6b95ab1
|
|
7
|
+
data.tar.gz: 69cff96c5050471efbc44921f29a29ea477adc3d9ba374be6341fd160a18bd7d424684e01599ea8cbc9d4be153e95f7f339efc782cd5e98bfd8bcfdda24a580c
|
data/ftf-0.0.8.gem
ADDED
|
Binary file
|
data/lib/ftf/generator.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "json"
|
|
4
|
+
|
|
4
5
|
module FTF
|
|
5
6
|
# Generate
|
|
6
7
|
class Generator
|
|
@@ -47,7 +48,9 @@ module FTF
|
|
|
47
48
|
write_record(product.render(@record_index))
|
|
48
49
|
product.holders.each do |holder|
|
|
49
50
|
write_record(holder(holder))
|
|
50
|
-
|
|
51
|
+
holder.relationships.each do |relationship|
|
|
52
|
+
write_record(relationship(relationship))
|
|
53
|
+
end
|
|
51
54
|
end
|
|
52
55
|
write_record(product_footer(product))
|
|
53
56
|
end
|
|
@@ -70,10 +73,10 @@ module FTF
|
|
|
70
73
|
name: holder.name.to_s.ljust(178, " "),
|
|
71
74
|
id_type: holder.id_type.to_s.rjust(2, "0"),
|
|
72
75
|
id: holder.id.to_s.ljust(30, " "),
|
|
73
|
-
expedition_country: holder.
|
|
76
|
+
expedition_country: holder.expedition_country.to_s.ljust(2, " "),
|
|
74
77
|
created_at: holder.created_at.ljust(8, " "),
|
|
75
|
-
nationality_country: holder.
|
|
76
|
-
residence_country: holder.
|
|
78
|
+
nationality_country: holder.nationality_country.to_s.ljust(2, " "),
|
|
79
|
+
residence_country: holder.residence_country.to_s.ljust(2, " "),
|
|
77
80
|
reserved_field: " " * 4
|
|
78
81
|
}
|
|
79
82
|
fields.values.join
|
data/lib/ftf/mappings/holder.rb
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
module FTF
|
|
4
4
|
module Mappings
|
|
5
5
|
class Holder
|
|
6
|
-
attr_reader :product, :
|
|
6
|
+
attr_reader :product, :relationships
|
|
7
7
|
|
|
8
8
|
def initialize(data, product)
|
|
9
9
|
@data = data
|
|
10
10
|
@product = product
|
|
11
|
-
@
|
|
11
|
+
@relationships = @data[:relationships].map { |relationship| Relationship.new(relationship, self) }
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def action
|
|
@@ -31,8 +31,16 @@ module FTF
|
|
|
31
31
|
@data[:created_at]
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def
|
|
35
|
-
@data[:
|
|
34
|
+
def expedition_country
|
|
35
|
+
@data[:expedition_country]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def nationality_country
|
|
39
|
+
@data[:nationality_country]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def residence_country
|
|
43
|
+
@data[:residence_country]
|
|
36
44
|
end
|
|
37
45
|
end
|
|
38
46
|
end
|
data/lib/ftf/version.rb
CHANGED
data/test.json
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fiscal_id": "B89896427",
|
|
3
|
+
"period": "202512",
|
|
4
|
+
"file_index": 1,
|
|
5
|
+
"request_id": "",
|
|
6
|
+
"file_type": "M",
|
|
7
|
+
"products": [
|
|
8
|
+
{
|
|
9
|
+
"action": "A",
|
|
10
|
+
"type": "01",
|
|
11
|
+
"id_type": "01",
|
|
12
|
+
"id": "ES7531602870987210103471",
|
|
13
|
+
"created_at": "20251201",
|
|
14
|
+
"holders": [
|
|
15
|
+
{
|
|
16
|
+
"action": "A",
|
|
17
|
+
"name": "WESIZE SL",
|
|
18
|
+
"id_type": "01",
|
|
19
|
+
"id": "A72605108",
|
|
20
|
+
"created_at": "20251113",
|
|
21
|
+
"expedition_country": "ES",
|
|
22
|
+
"nationality_country": "ES",
|
|
23
|
+
"residence_country": "ES",
|
|
24
|
+
"relationships": [
|
|
25
|
+
{
|
|
26
|
+
"action": "A",
|
|
27
|
+
"type": "TIT",
|
|
28
|
+
"created_at": "20251201"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"action": "A",
|
|
34
|
+
"name": "Antonio García López",
|
|
35
|
+
"id_type": "01",
|
|
36
|
+
"id": "99971126Q",
|
|
37
|
+
"created_at": "19810213",
|
|
38
|
+
"expedition_country": "ES",
|
|
39
|
+
"nationality_country": "ES",
|
|
40
|
+
"residence_country": "ES",
|
|
41
|
+
"relationships": [
|
|
42
|
+
{
|
|
43
|
+
"action": "A",
|
|
44
|
+
"type": "TRE",
|
|
45
|
+
"created_at": "20251215"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"action": "A",
|
|
49
|
+
"type": "REP",
|
|
50
|
+
"created_at": "20251215"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"action": "A",
|
|
58
|
+
"type": "01",
|
|
59
|
+
"id_type": "01",
|
|
60
|
+
"id": "ES1600853664879672604126",
|
|
61
|
+
"created_at": "20251201",
|
|
62
|
+
"holders": [
|
|
63
|
+
{
|
|
64
|
+
"action": "A",
|
|
65
|
+
"name": "DOMIMINT SL",
|
|
66
|
+
"id_type": "04",
|
|
67
|
+
"id": "GB633223668",
|
|
68
|
+
"created_at": "20230129",
|
|
69
|
+
"expedition_country": "ES",
|
|
70
|
+
"nationality_country": "GB",
|
|
71
|
+
"residence_country": "GB",
|
|
72
|
+
"relationships": [
|
|
73
|
+
{
|
|
74
|
+
"action": "A",
|
|
75
|
+
"type": "TIT",
|
|
76
|
+
"created_at": "20251201"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"action": "A",
|
|
82
|
+
"name": "Benicio Mathews",
|
|
83
|
+
"id_type": "02",
|
|
84
|
+
"id": "Y3777307P",
|
|
85
|
+
"created_at": "19880604",
|
|
86
|
+
"expedition_country": "IT",
|
|
87
|
+
"nationality_country": "IT",
|
|
88
|
+
"residence_country": "GB",
|
|
89
|
+
"relationships": [
|
|
90
|
+
{
|
|
91
|
+
"action": "A",
|
|
92
|
+
"type": "TRE",
|
|
93
|
+
"created_at": "20251222"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"action": "A",
|
|
97
|
+
"type": "REP",
|
|
98
|
+
"created_at": "20251222"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
data/test_generate.rb
ADDED
data/test_validate.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
require_relative "lib/ftf"
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
json = File.read("test.json")
|
|
8
|
+
JSON.parse(json)
|
|
9
|
+
puts "JSON file is valid"
|
|
10
|
+
FTF::Generator.new(json).validate!
|
|
11
|
+
rescue JSON::ParserError => e
|
|
12
|
+
puts "JSON file is invalid: #{e.message}"
|
|
13
|
+
rescue FTF::Generator::ValidationError => e
|
|
14
|
+
puts "File is not a valid FTF JSON File: #{e.message}"
|
|
15
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ftf
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aitor García Rey
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-01-16 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: fiddle
|
|
@@ -73,6 +74,7 @@ files:
|
|
|
73
74
|
- README.md
|
|
74
75
|
- Rakefile
|
|
75
76
|
- doc/instrucciones_para_la_declaracion_de_informacion_al_FTF.pdf
|
|
77
|
+
- ftf-0.0.8.gem
|
|
76
78
|
- lib/ftf.rb
|
|
77
79
|
- lib/ftf/generator.rb
|
|
78
80
|
- lib/ftf/mappings/holder.rb
|
|
@@ -86,6 +88,9 @@ files:
|
|
|
86
88
|
- lib/ftf/refinements.rb
|
|
87
89
|
- lib/ftf/version.rb
|
|
88
90
|
- sig/ftf.rbs
|
|
91
|
+
- test.json
|
|
92
|
+
- test_generate.rb
|
|
93
|
+
- test_validate.rb
|
|
89
94
|
homepage: https://github.com/devengoapp/ftf
|
|
90
95
|
licenses:
|
|
91
96
|
- MIT
|
|
@@ -93,6 +98,7 @@ metadata:
|
|
|
93
98
|
homepage_uri: https://github.com/devengoapp/ftf
|
|
94
99
|
source_code_uri: https://github.com/devengoapp/ftf
|
|
95
100
|
rubygems_mfa_required: 'true'
|
|
101
|
+
post_install_message:
|
|
96
102
|
rdoc_options: []
|
|
97
103
|
require_paths:
|
|
98
104
|
- lib
|
|
@@ -107,7 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
107
113
|
- !ruby/object:Gem::Version
|
|
108
114
|
version: '0'
|
|
109
115
|
requirements: []
|
|
110
|
-
rubygems_version: 3.
|
|
116
|
+
rubygems_version: 3.3.3
|
|
117
|
+
signing_key:
|
|
111
118
|
specification_version: 4
|
|
112
119
|
summary: A ruby gem to generate FTF files for SEPBLAC
|
|
113
120
|
test_files: []
|