Sha256: 44f03aacaea065bf967a85f0db7c898d4b9592357bae0c790cecf93bda231559

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

CarrierMode.class_eval do
  data_miner do
    schema Earth.database_options do
      string 'name'
      string 'carrier_name'
      string 'mode_name'
      boolean 'include_in_fallbacks'
      float  'package_volume'
      float  'route_inefficiency_factor'
      float  'transport_emission_factor'
      string 'transport_emission_factor_units'
    end
    
    import "a list of carrier modes and their characteristics",
           :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdGRsRkJOd0NPd0FETTI0NmpYUlBsN2c&hl=en&single=true&gid=0&output=csv' do
      key   'name'
      store 'carrier_name'
      store 'mode_name'
      store 'include_in_fallbacks'
      store 'package_volume'
      store 'route_inefficiency_factor'
      store 'transport_emission_factor', :units_field_name => 'transport_emission_factor_units'
    end
    
    # TODO: verification
    # all entries should have carrier_name
    # all entries should have mode_name
    # all entries should have include_in_fallbacks
    # all entries should have package_volume
    # all entries should have route_inefficiency_factor
    # all entries should have transport emission factor > 0
    # all entries should have transport emission factor units
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
earth-0.3.9 lib/earth/shipping/carrier_mode/data_miner.rb