kirico 0.1.0 → 0.1.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 +4 -4
- data/kirico.gemspec +1 -0
- data/lib/kirico.rb +2 -0
- data/lib/kirico/config/locales/ja.yml +4 -0
- data/lib/kirico/models/application_record.rb +21 -0
- data/lib/kirico/models/changing_address_record.rb +1 -10
- data/lib/kirico/models/company.rb +1 -1
- data/lib/kirico/models/form.rb +51 -0
- data/lib/kirico/version.rb +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b8dbe4cd6dfa085f207852e7431ba7b2aa5dffcd
|
|
4
|
+
data.tar.gz: c094454efe621dc43b18a6c45c530f64a8900bda
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f7ba0f28942b2d12f89a4d389a73498b5907b9bbb3d19f01027d1796bc0df8650ce3b82cfe6f0ddc0b0e0f6a3ff4ad7750fbec70bce2cc4cbea3ee2bcbf25231
|
|
7
|
+
data.tar.gz: 75f57b616bf35e1be655a877b2ad585973ece84792e1fb10855f2de248f632f480728f6711919c08ebf24cba07b6dc9dd7802e3b22e4b13bd480b2901880a9eb
|
data/kirico.gemspec
CHANGED
data/lib/kirico.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
require 'kirico/version'
|
|
3
|
+
require 'kirico/models/application_record'
|
|
3
4
|
require 'kirico/models/changing_address_record'
|
|
4
5
|
require 'kirico/models/company_count'
|
|
5
6
|
require 'kirico/models/company_identifier'
|
|
@@ -7,6 +8,7 @@ require 'kirico/models/company'
|
|
|
7
8
|
require 'kirico/models/data_identifier'
|
|
8
9
|
require 'kirico/models/fd_management_record'
|
|
9
10
|
require 'kirico/models/helper'
|
|
11
|
+
require 'kirico/models/form'
|
|
10
12
|
require 'kirico/csv_generator'
|
|
11
13
|
|
|
12
14
|
module Kirico
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'virtus'
|
|
3
|
+
require 'active_model'
|
|
4
|
+
require 'kirico/models/helper'
|
|
5
|
+
require 'validates_timeliness'
|
|
6
|
+
|
|
7
|
+
module Kirico
|
|
8
|
+
class ApplicationRecord
|
|
9
|
+
include Virtus.model
|
|
10
|
+
include ActiveModel::Validations
|
|
11
|
+
extend Kirico::Helper
|
|
12
|
+
|
|
13
|
+
def initialize
|
|
14
|
+
yield(self) if block_given?
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def to_csv
|
|
18
|
+
raise NoMethodError
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'virtus'
|
|
3
|
-
require 'active_model'
|
|
4
|
-
require 'kirico/models/helper'
|
|
5
|
-
require 'validates_timeliness'
|
|
6
|
-
|
|
7
2
|
module Kirico
|
|
8
|
-
class ChangingAddressRecord
|
|
9
|
-
include Virtus.model
|
|
10
|
-
include ActiveModel::Validations
|
|
11
|
-
extend Kirico::Helper
|
|
12
|
-
|
|
3
|
+
class ChangingAddressRecord < ApplicationRecord
|
|
13
4
|
DOC_CODE = '22187041'
|
|
14
5
|
|
|
15
6
|
attribute :area_code, String
|
|
@@ -25,7 +25,7 @@ module Kirico
|
|
|
25
25
|
validates :address, charset: { accept: [:all] }, sjis_bytesize: { in: 1..75 }
|
|
26
26
|
validates :name, charset: { accept: [:katakana, :kanji] }, sjis_bytesize: { in: 1..50 }
|
|
27
27
|
validates :owner_name, charset: { accept: [:katakana, :kanji] }, sjis_bytesize: { in: 1..25 }
|
|
28
|
-
validates :tel_number, charset: { accept: [:latin, :
|
|
28
|
+
validates :tel_number, charset: { accept: [:latin, :numeric] }, sjis_bytesize: { in: 1..12 }
|
|
29
29
|
|
|
30
30
|
def initialize
|
|
31
31
|
yield(self) if block_given?
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'virtus'
|
|
3
|
+
require 'active_model'
|
|
4
|
+
|
|
5
|
+
module Kirico
|
|
6
|
+
class Form
|
|
7
|
+
include Virtus.model
|
|
8
|
+
include ActiveModel::Validations
|
|
9
|
+
|
|
10
|
+
FILE_NAME = 'SHFD0006.CSV'
|
|
11
|
+
|
|
12
|
+
attribute :fd, Kirico::FDManagementRecord
|
|
13
|
+
attribute :company, Kirico::Company
|
|
14
|
+
attribute :records, Array[Kirico::ApplicationRecord]
|
|
15
|
+
|
|
16
|
+
validates :fd, :company, :records, presence: true
|
|
17
|
+
validate :validate_children
|
|
18
|
+
|
|
19
|
+
def initialize(fd:, company:, records: [])
|
|
20
|
+
@fd = fd
|
|
21
|
+
@company = company
|
|
22
|
+
@records = records
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def to_csv
|
|
26
|
+
[
|
|
27
|
+
@fd.to_csv,
|
|
28
|
+
Kirico::CompanyIdentifier.new.to_csv,
|
|
29
|
+
Kirico::CompanyCount.new.to_csv,
|
|
30
|
+
@company.to_csv,
|
|
31
|
+
Kirico::DataIdentifier.new.to_csv,
|
|
32
|
+
@records.map(&:to_csv).join("\n")
|
|
33
|
+
].join("\n")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
# 子のエラーを自身のエラーとして設定する
|
|
39
|
+
def validate_children
|
|
40
|
+
[:fd, :company, :records].each do |attribute|
|
|
41
|
+
records = [send(attribute)].flatten.compact
|
|
42
|
+
records.each do |rec|
|
|
43
|
+
next if rec.valid?
|
|
44
|
+
rec.errors.full_messages.each do |msg|
|
|
45
|
+
errors.add(attribute, msg)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
data/lib/kirico/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kirico
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kakipo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-02-
|
|
11
|
+
date: 2017-02-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -220,6 +220,20 @@ dependencies:
|
|
|
220
220
|
- - ">="
|
|
221
221
|
- !ruby/object:Gem::Version
|
|
222
222
|
version: '0'
|
|
223
|
+
- !ruby/object:Gem::Dependency
|
|
224
|
+
name: shoulda-matchers
|
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
|
226
|
+
requirements:
|
|
227
|
+
- - ">="
|
|
228
|
+
- !ruby/object:Gem::Version
|
|
229
|
+
version: '0'
|
|
230
|
+
type: :development
|
|
231
|
+
prerelease: false
|
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
233
|
+
requirements:
|
|
234
|
+
- - ">="
|
|
235
|
+
- !ruby/object:Gem::Version
|
|
236
|
+
version: '0'
|
|
223
237
|
description: Write a longer description or delete this line.
|
|
224
238
|
email:
|
|
225
239
|
- kakipo@gmail.com
|
|
@@ -245,12 +259,14 @@ files:
|
|
|
245
259
|
- lib/kirico/config/locales/en.yml
|
|
246
260
|
- lib/kirico/config/locales/ja.yml
|
|
247
261
|
- lib/kirico/csv_generator.rb
|
|
262
|
+
- lib/kirico/models/application_record.rb
|
|
248
263
|
- lib/kirico/models/changing_address_record.rb
|
|
249
264
|
- lib/kirico/models/company.rb
|
|
250
265
|
- lib/kirico/models/company_count.rb
|
|
251
266
|
- lib/kirico/models/company_identifier.rb
|
|
252
267
|
- lib/kirico/models/data_identifier.rb
|
|
253
268
|
- lib/kirico/models/fd_management_record.rb
|
|
269
|
+
- lib/kirico/models/form.rb
|
|
254
270
|
- lib/kirico/models/helper.rb
|
|
255
271
|
- lib/kirico/models/mappers.yml
|
|
256
272
|
- lib/kirico/validators/charset_validator.rb
|