Sha256: fca8bccca62f00944706df12221232110878a456797951629ce4ab20d27c71d1

Contents?: true

Size: 755 Bytes

Versions: 1

Compression:

Stored size: 755 Bytes

Contents

# frozen_string_literal: true

require 'thor'
require 'voucher'

module Voucher
  class CLI < Thor
    desc 'validate FILE', 'Validate that the segments in a given json file exist in ' \
      'an Election through the Ethereum blockchain'
    long_desc <<-D
      Ingest a file full of segments encoded in JSON and validates that each one
      exists in an Election through the Ethereum blockchain.
    D
    method_option :host, type: :string, aliases: '-h'
    def validate(segments_file)
      configure
      puts 'Validation SUCCESSFUL!' if Voucher::Validator.call(segments_file)
    end

    private

    def configure
      Voucher.configure do |config|
        config.ethereum_url = options['host'] if options['host']
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voucher-0.3.0 lib/voucher/cli.rb