Module: Kamome

Defined in:
lib/kamome.rb,
lib/kamome/cli.rb,
lib/kamome/loader.rb,
lib/kamome/version.rb,
lib/kamome/operation.rb,
lib/kamome/downloader.rb,
lib/kamome/csv_handler.rb,
lib/kamome/configuration.rb,
lib/kamome/models/address.rb,
lib/kamome/models/general.rb,
lib/kamome/models/jigyosho.rb,
lib/kamome/transformations/cleaner.rb,
lib/kamome/transformations/extractor.rb,
lib/kamome/transformations/general_csv.rb,
lib/kamome/transformations/jigyosho_csv.rb

Defined Under Namespace

Modules: Models, Transformations Classes: ArgumentError, Cli, Configuration, CsvHandler, DownloadError, Downloader, Error, Loader, Operation

Constant Summary collapse

VERSION =
'1.0.0'

Class Method Summary collapse

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:

  • (configuration)


14
15
16
# File 'lib/kamome.rb', line 14

def configure
  yield(configuration)
end

.import_general_all(type: Operation::TYPE_DEFAULT, &block) ⇒ Object

Import ken_all.zip

Examples:

Kamome.import_general_all do |model, lineno|
  # do something
end

Parameters:

  • type (Symbol) (defaults to: Operation::TYPE_DEFAULT)

    :default, :hash, :detail



24
25
26
27
# File 'lib/kamome.rb', line 24

def import_general_all(type: Operation::TYPE_DEFAULT, &block)
  operation = ::Kamome::Operation.general_all(type: type)
  loader.call(operation: operation, &block)
end

.import_general_diff(date:, type: Operation::TYPE_DEFAULT, &block) ⇒ Object

Import add_yymm.zip and del_yymm.zip

Examples:

Kamome.import_general_diff do |model, lineno|
  # do something
end

Parameters:

  • date (Time)
  • type (Symbol) (defaults to: Operation::TYPE_DEFAULT)

    :default, :hash, :detail



36
37
38
39
# File 'lib/kamome.rb', line 36

def import_general_diff(date:, type: Operation::TYPE_DEFAULT, &block)
  operation = ::Kamome::Operation.general_diff(date: date, type: type)
  loader.call(operation: operation, &block)
end

.import_jigyosho_all(type: Operation::TYPE_DEFAULT, &block) ⇒ Object

Import jigyosyo.zip

Examples:

Kamome.import_jigyosho_all do |model, lineno|
  # do something
end

Parameters:

  • type (Symbol) (defaults to: Operation::TYPE_DEFAULT)

    :default, :hash, :detail



47
48
49
50
# File 'lib/kamome.rb', line 47

def import_jigyosho_all(type: Operation::TYPE_DEFAULT, &block)
  operation = ::Kamome::Operation.jigyosho_all(type: type)
  loader.call(operation: operation, &block)
end

.import_jigyosho_diff(date:, type: Operation::TYPE_DEFAULT, &block) ⇒ Object

Import jadd#yymm.zip and jdel#yymm.zip

Examples:

Kamome.import_jigyosho_all do |model, lineno|
  # do something
end

Parameters:

  • date (Time)
  • type (Symbol) (defaults to: Operation::TYPE_DEFAULT)

    :default, :hash, :detail



59
60
61
62
# File 'lib/kamome.rb', line 59

def import_jigyosho_diff(date:, type: Operation::TYPE_DEFAULT, &block)
  operation = ::Kamome::Operation.jigyosho_diff(date: date, type: type)
  loader.call(operation: operation, &block)
end

.loaderObject



64
65
66
# File 'lib/kamome.rb', line 64

def loader
  Kamome::Loader.new(config: configuration)
end