Sha256: f24d55f700e1940692ea329bdbbe4c86b31c5fdf2750c38b980cb5bf471aea88

Contents?: true

Size: 722 Bytes

Versions: 3

Compression:

Stored size: 722 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
      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

3 entries across 3 versions & 1 rubygems

Version Path
voucher-0.2.1 lib/voucher/cli.rb
voucher-0.1.1 lib/voucher/cli.rb
voucher-0.1.0 lib/voucher/cli.rb