bsclient 0.1.2 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f31285623aaf593a739ceef8b17933358216c6d240d016461ba2f38a62121ae7
4
- data.tar.gz: 2725d05e592da9d749e9fbe9a99b948064cac61d24029b088319c5e17580c92f
3
+ metadata.gz: 6d422f8635e0838b7bc2c96d480fb7b45cadcba948d1f875ed8cb78174c24def
4
+ data.tar.gz: 6659279c9a187495b20888a95b075af33c5a63bdb17e903a04629bb5db5992ad
5
5
  SHA512:
6
- metadata.gz: '0493fe581b568f6a80ea726fd5cb5a566f4963990eada774186e77a62693ecf8e2c381f7b5e5ac66547c8fa67c763ff3fb149454ea7c3fae387ba86314ab0de0'
7
- data.tar.gz: 488a667b8a6f827e407fc530d5070871cc57ead13b3874fc4897f9d1bcb1662b86a77de2d2138fec34f3ed15bd01cce4337948b89827620fe8fd7295e9d391e3
6
+ metadata.gz: a89ea32dda741d966a78ee974246d9808f685965c4d2a35c45a2322b14423b36cce730cb81ad62c68b551b8af8b003b937c6d32679865d54deea87da18573462
7
+ data.tar.gz: abe576bdf55adb8b0ab9bc1aaaf5b280f1a7e46b7f090af03a4dd3fa20eda1e5a07a776917ca0cd2166eace0c553ec519877db99947f19133982a63644d0fb7a
data/Gemfile.lock CHANGED
@@ -1,30 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bsclient (0.1.2)
4
+ bsclient (0.1.6)
5
5
  faraday
6
6
  pry (~> 0.13.1)
7
7
  pry-byebug (~> 3.9.0)
8
- pry-doc (~> 1.1.0)
8
+ pry-doc (>= 1.0.0)
9
9
  thor (~> 0.20.0)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
14
  byebug (11.1.3)
15
- coderay (1.1.2)
15
+ coderay (1.1.3)
16
16
  diff-lcs (1.3)
17
- faraday (1.0.1)
18
- multipart-post (>= 1.2, < 3)
17
+ faraday (2.0.1)
18
+ faraday-net_http (~> 2.0)
19
+ ruby2_keywords (>= 0.0.4)
20
+ faraday-net_http (2.0.1)
19
21
  method_source (1.0.0)
20
- multipart-post (2.1.1)
21
22
  pry (0.13.1)
22
23
  coderay (~> 1.1)
23
24
  method_source (~> 1.0)
24
25
  pry-byebug (3.9.0)
25
26
  byebug (~> 11.0)
26
27
  pry (~> 0.13.0)
27
- pry-doc (1.1.0)
28
+ pry-doc (1.3.0)
28
29
  pry (~> 0.11)
29
30
  yard (~> 0.9.11)
30
31
  rake (12.3.3)
@@ -41,8 +42,11 @@ GEM
41
42
  diff-lcs (>= 1.2.0, < 2.0)
42
43
  rspec-support (~> 3.9.0)
43
44
  rspec-support (3.9.3)
45
+ ruby2_keywords (0.0.5)
44
46
  thor (0.20.3)
45
- yard (0.9.25)
47
+ webrick (1.7.0)
48
+ yard (0.9.27)
49
+ webrick (~> 1.7.0)
46
50
 
47
51
  PLATFORMS
48
52
  ruby
@@ -53,4 +57,4 @@ DEPENDENCIES
53
57
  rspec (~> 3.0)
54
58
 
55
59
  BUNDLED WITH
56
- 2.1.2
60
+ 2.2.3
data/bsclient.gemspec CHANGED
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_dependency 'thor', '~> 0.20.0'
26
26
  spec.add_dependency 'pry', '~> 0.13.1'
27
27
  spec.add_dependency 'pry-byebug', '~> 3.9.0'
28
- spec.add_dependency 'pry-doc', '~> 1.1.0'
28
+ spec.add_dependency 'pry-doc', '>= 1.0.0'
29
29
  end
data/lib/bsclient/cli.rb CHANGED
@@ -8,7 +8,7 @@ module BSClient
8
8
  class_option :conf, type: :string, aliases: ['-c'], desc: 'Specify config file'
9
9
  class_option :verbose, type: :boolean, aliases: ['-v'], desc: 'Verbose printing'
10
10
 
11
- desc '', ''
11
+ desc 'register_account(filename = nil)', 'nil means STDIN'
12
12
  def register_account(filename = nil)
13
13
  req_content = if filename
14
14
  IO.read(filename)
@@ -20,26 +20,54 @@ module BSClient
20
20
  print app.register_account(req_content)
21
21
  end
22
22
 
23
- desc '', ''
23
+ desc 'query_registration(task_id, account)', ''
24
24
  def query_registration(task_id, account)
25
25
  app = App.new(options, Config.create(options[:env]))
26
26
  print app.query_registration(task_id, account)
27
27
  end
28
28
 
29
- desc '', ''
29
+ desc 'create_user_image(account, text, size="30", color="red")', ''
30
30
  def create_user_image(account, text, size="30", color="red")
31
31
  req_content = {account: account, text: text, fontSize: size, fontColor: color}.to_json
32
32
  app = App.new(options, Config.create(options[:env]))
33
33
  print app.create_user_image(req_content)
34
34
  end
35
35
 
36
- desc '', ''
36
+ desc 'download_user_image(account)', ''
37
37
  def download_user_image(account)
38
38
  params = {account: account, imageName: ''}
39
39
  app = App.new(options, Config.create(options[:env]))
40
40
  print app.download_user_image(params)
41
41
  end
42
42
 
43
+ desc 'get(url, *raw_params)', 'bsclient get <url> name=Jack age=10'
44
+ def get(url, *raw_params)
45
+ params = raw_params.each_with_object({}) do |param, h|
46
+ k, v = param.split('=')
47
+ h[k.to_sym] = v
48
+ end
49
+ app = App.new(options, Config.create(options[:env]))
50
+ print app.get(url, params)
51
+ end
52
+
53
+ desc 'post(url, *args)', 'bsclient post <url> name=Jack age=10; bsclient post <url> myfile.json; cat myfile.json | bsclient post <url>'
54
+ def post(url, *args)
55
+ if not STDIN.isatty
56
+ params = JSON.parse(STDIN.read)
57
+ elsif File.exist?(args.first)
58
+ params = File.read(args.first)
59
+ else
60
+ params = args.each_with_object({}) do |param, h|
61
+ k, v = param.split('=')
62
+ value = v
63
+ value = JSON.parse(v[1..-1]) if v[0] == ':'
64
+ h[k.to_sym] = value
65
+ end
66
+ end
67
+ app = App.new(options, Config.create(options[:env]))
68
+ print app.post_json(url, params)
69
+ end
70
+
43
71
  # desc '', ''
44
72
  # class_option :out, type: :string, aliases: ['-o'], desc: 'Specify output file'
45
73
  # def sign(filename = nil)
@@ -1,3 +1,3 @@
1
1
  module BSClient
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bsclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Xiang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-06 00:00:00.000000000 Z
11
+ date: 2022-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: pry-doc
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 1.1.0
75
+ version: 1.0.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 1.1.0
82
+ version: 1.0.0
83
83
  description: Register bs account
84
84
  email:
85
85
  - liuxiang@ktjr.com
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubygems_version: 3.1.2
132
+ rubygems_version: 3.3.3
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Register bs account