Sha256: 8820b1025260142324246acc3ee3b18dd99a9d742a4b5f14948516a513d51c61

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 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 :client_key, aliases: '-t', required: true, desc: 'admqr client key'
  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[:client_key])
    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.1 exe/admqr_visit