admqr_knife 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06b0ffb1b6364cd47bf389fc0d89ae5176718656ae0eed5f24605466ef94ff81
4
- data.tar.gz: ffecc85d0926b3cf57816b4e27614210dd855929dffae768151d901bb26e3e9f
3
+ metadata.gz: db33f670324422622b0c206d7f0613787d9d32b1a2b753afa9729567f1fdbb20
4
+ data.tar.gz: 6f49fcf6b3e588002c92c332f0f087f73b3a6aeaed13d45b7fa1f63fec76faf3
5
5
  SHA512:
6
- metadata.gz: 9b768ac52b9cd58afa860ebb84e0f49ca17c5fce6b763dacd24f5fa7f66b18d1c05742961aaccc686f939fc6a4a1c86b5ecadbf1d378c7d7fe8e604d9ffca283
7
- data.tar.gz: 77188b9318160d324aeca149be0872e5f7914bd850f31cb067f19f85d8e92de0666827088fc8e635cfb99c571f0312229a96d212875929d0d15c9980eb87e2a5
6
+ metadata.gz: 6ff4f9e155aa7ea02cb3b24dd4fefe4e2b6db4c085ca46f158f618f7dd66d08328a84a95571e50361b1694c21bd3bca8f63ba9f02af81f62f8f1e0ac342cb157
7
+ data.tar.gz: eed109ecf9079aa6f58e78e144d3667d6bd0fc24fe610da7898e4be7e82a664b11fd52a0e73ae06b521714d5aa01d89cff74f2d25c0490c58bd4e2e1c33156bd
data/README.md CHANGED
@@ -28,7 +28,7 @@ Or install it yourself as:
28
28
 
29
29
  ### 命令行方式
30
30
 
31
- `admqr_visit record 标签名称 -t API_TOKEN`
31
+ `admqr_visit record 标签名称 -t CLIENT_KEY`
32
32
 
33
33
  更多参数可以使用 `admqr_visit help record` 进行查看
34
34
 
@@ -38,7 +38,7 @@ Or install it yourself as:
38
38
  1. 在 rails 里 initializers 中配置
39
39
 
40
40
  ```ruby
41
- AdmqrKnife.init(API_TOKEN)
41
+ AdmqrKnife.init(CLIENT_KEY)
42
42
  ```
43
43
 
44
44
  2. 在需要记录的地方使用如下语法记录
@@ -61,7 +61,7 @@ curl -X POST \
61
61
  https://www.admqr.com/apic/v1 \
62
62
  -H 'Content-Type: application/json' \
63
63
  -d '{
64
- "api_token": "你的API_TOKEN",
64
+ "client_key": "你的CLIENT_KEY",
65
65
  "unique_code": "自己取的唯一标志",
66
66
  "tag": "分组名, 可以不传",
67
67
  "client_ua": "用户UA, 可以不传",
@@ -5,32 +5,30 @@ require 'thor'
5
5
  # require 'byebug'
6
6
  require_relative '../lib/admqr_knife'
7
7
 
8
-
9
8
  class AdmqrVisitCLI < Thor
10
9
  desc 'record', 'record a visit data'
11
- option :api_token, :aliases => "-t", required: true, desc: "API TOKEN"
10
+ option :client_key, aliases: '-t', required: true, desc: 'admqr client key'
12
11
  option :ua, desc: "visitor's user agent"
13
12
  option :referer, desc: 'visitor from '
14
13
  option :tag, desc: 'project name'
15
14
  option :new_to_visit, type: :boolean, desc: 'is a new visit', default: true
15
+
16
16
  def record(unique_code)
17
- AdmqrKnife.init(options[:api_token])
17
+ AdmqrKnife.init(options[:client_key])
18
18
  AdmqrKnife.visit(unique_code: unique_code,
19
19
  ua: options[:ua],
20
20
  referer: options[:referer],
21
21
  tag: options[:tag],
22
22
  new_to_visit: options[:new_to_visit],
23
23
  remote_ip: options[:remote_ip])
24
- AdmqrKnife.logger.debug("ok!")
24
+ AdmqrKnife.logger.debug('ok!')
25
25
  end
26
26
 
27
27
  desc 'help', 'Describe available commands or one specific command (aliases: `h`).'
28
- map Thor::HELP_MAPPINGS => :help
29
- def help(command = nil, subcommand = false)
30
- super
31
- end
32
-
33
-
28
+ map Thor::HELP_MAPPINGS => :help
29
+ def help(command = nil, subcommand = false)
30
+ super
31
+ end
34
32
  end
35
33
 
36
34
  AdmqrVisitCLI.start(ARGV)
@@ -9,16 +9,16 @@ module AdmqrKnife
9
9
  class Error < StandardError; end
10
10
  # Your code goes here...
11
11
  class << self
12
- attr_accessor :knife_api_token, :knife_base_uri, :logger
12
+ attr_accessor :knife_client_key, :knife_base_uri, :logger
13
13
 
14
- def init(api_token = nil, options = {})
15
- @knife_api_token = api_token || ENV['ADMQR_KNIFE_API_TOKEN']
14
+ def init(client_key = nil, options = {})
15
+ @knife_client_key = client_key || ENV['ADMQR_KNIFE_CLIENT_KEY']
16
16
  @knife_base_uri = ENV['KNIFE_BASE_URI'] || 'https://www.admqr.com/apic/v1/'
17
17
  @logger = options[:logger] || select_logger
18
18
  end
19
19
 
20
- def api_token
21
- @knife_api_token
20
+ def client_key
21
+ @knife_client_key
22
22
  end
23
23
 
24
24
  def visit(unique_code:, **options)
@@ -9,7 +9,7 @@ module AdmqrKnife
9
9
 
10
10
  def base_params
11
11
  {
12
- api_token: AdmqrKnife.knife_api_token,
12
+ client_key: AdmqrKnife.knife_client_key,
13
13
  gem_version: AdmqrKnife::VERSION
14
14
  }
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module AdmqrKnife
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: admqr_knife
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - atpking
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-02 00:00:00.000000000 Z
11
+ date: 2019-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler