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 +4 -4
- data/README.md +3 -3
- data/exe/admqr_visit +8 -10
- data/lib/admqr_knife.rb +5 -5
- data/lib/admqr_knife/cube_service.rb +1 -1
- data/lib/admqr_knife/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db33f670324422622b0c206d7f0613787d9d32b1a2b753afa9729567f1fdbb20
|
4
|
+
data.tar.gz: 6f49fcf6b3e588002c92c332f0f087f73b3a6aeaed13d45b7fa1f63fec76faf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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(
|
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
|
-
"
|
64
|
+
"client_key": "你的CLIENT_KEY",
|
65
65
|
"unique_code": "自己取的唯一标志",
|
66
66
|
"tag": "分组名, 可以不传",
|
67
67
|
"client_ua": "用户UA, 可以不传",
|
data/exe/admqr_visit
CHANGED
@@ -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 :
|
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[:
|
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(
|
24
|
+
AdmqrKnife.logger.debug('ok!')
|
25
25
|
end
|
26
26
|
|
27
27
|
desc 'help', 'Describe available commands or one specific command (aliases: `h`).'
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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)
|
data/lib/admqr_knife.rb
CHANGED
@@ -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 :
|
12
|
+
attr_accessor :knife_client_key, :knife_base_uri, :logger
|
13
13
|
|
14
|
-
def init(
|
15
|
-
@
|
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
|
21
|
-
@
|
20
|
+
def client_key
|
21
|
+
@knife_client_key
|
22
22
|
end
|
23
23
|
|
24
24
|
def visit(unique_code:, **options)
|
data/lib/admqr_knife/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|