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

Overview

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

Defined Under Namespace

Modules: Crypto 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.0"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(file_type, *args) ⇒ Object

Your code goes here…



13
14
15
# File 'lib/nm_datafile.rb', line 13

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



623
624
625
626
627
628
629
630
631
632
633
634
635
636
# File 'lib/nm_datafile/nm_datafile.rb', line 623

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