Sha256: 6e2329ec914bcc5ff9b493bf4a81abadf52a0d2f15161d118af4192859c71424

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'thor'
# require 'byebug'
require_relative '../lib/admqr_knife'


class AdmqrVisitCLI < Thor
  desc 'record', 'record a visit data'
  option :api_token, :aliases => "-t", required: true, desc: "API TOKEN"
  option :ua, desc: "visitor's user agent"
  option :referer, desc: 'visitor from '
  option :tag, desc: 'project name'
  option :new_to_visit, type: :boolean, desc: 'is a new visit', default: true
  def record(unique_code)
    AdmqrKnife.init(options[:api_token])
    AdmqrKnife.visit(unique_code: unique_code,
                     ua: options[:ua],
                     referer: options[:referer],
                     tag: options[:tag],
                     new_to_visit: options[:new_to_visit],
                     remote_ip: options[:remote_ip])
    AdmqrKnife.logger.debug("ok!")
  end

  desc 'help', 'Describe available commands or one specific command (aliases: `h`).'
    map Thor::HELP_MAPPINGS => :help
    def help(command = nil, subcommand = false)
      super
    end


end

AdmqrVisitCLI.start(ARGV)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
admqr_knife-0.1.0 exe/admqr_visit