Module: NmDatafile

Defined in:
lib/nm_datafile/schema.rb,
lib/nm_datafile.rb,
lib/nm_datafile/b_f.rb,
lib/nm_datafile/crypto.rb,
lib/nm_datafile/version.rb,
lib/nm_datafile/nm_datafile.rb,
lib/nm_datafile/data_loading.rb

Overview

A default schema is defined here… this needs to be converted into something more generic

Defined Under Namespace

Modules: Crypto, DataLoading Classes: BF, NmDatafile

Constant Summary collapse

SCHEMA =
{ schemas: 
  { :shippable_file => {
    data_collections: [:sales, :line_items, :discounts, :addresses, :ubws, :encryption_pairs], # name the data that is input into the NMDatafile as an array
    data_objects: [:ready_for_shipment_batch]
    },
  
  :address_completion_file => {
    data_collections: [:sales, :erroneous_sales],
    data_objects: [:ready_for_shipment_batch]
    }
  }
}
VERSION =
"0.0.1"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.helloObject



22
23
24
# File 'lib/nm_datafile.rb', line 22

def self.hello
  puts "hi"
end

.new(file_type, *args) ⇒ Object

extend Loading



18
19
20
# File 'lib/nm_datafile.rb', line 18

def self.new(file_type, *args)
  NmDatafile.new(file_type, args)
end

Instance Method Details

#passfunc(hook, uid_hint, passphrase_info, prev_was_bad, fd) ⇒ Object

This hack is for… some tricky bullshit, I forgot about



592
593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/nm_datafile/nm_datafile.rb', line 592

def passfunc(hook, uid_hint, passphrase_info, prev_was_bad, fd)
  $stderr.write("Passphrase for #{uid_hint}: ")
  $stderr.flush
  begin
    system('stty -echo')
    io = IO.for_fd(fd, 'w')
    io.puts(gets)
    io.flush
  ensure
    (0 ... $_.length).each do |i| $_[i] = ?0 end if $_
    system('stty echo')
  end
  $stderr.puts
end