openbd_api 0.3.0 → 0.3.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
  SHA1:
3
- metadata.gz: 94982978119bb00a0a943e74c0a97983483090a3
4
- data.tar.gz: 98f9d13e78555c18b393681c18f0d7fbfa459df9
3
+ metadata.gz: 794a3669557afc7722f548062aed207891cdcd18
4
+ data.tar.gz: fbb1982d42e395a34c21a0e30b4217aab249de45
5
5
  SHA512:
6
- metadata.gz: fad167a8635b44d3952ca9f012316fceb0f07101cbcfaa73c9dc2600a340250ec97c0284b67a46c785e0f2eb14fd2d82d1e6a243c54296ed8b38c672d84e043e
7
- data.tar.gz: 02f591f4d6913bf40272eb196d82d3fd40d512812f0da55ab171dff16fc5fffe056a831f0e648e2f93c9b07e03a13fa909c2bfde7dd5ead9cef8f0a85daa960a
6
+ metadata.gz: ba82e049e17188af953aa58ee457385712db7278075a486e3cd83843842fa6176a8ffaa9142d35c89da4d1b633695192c52bcdba8d9b0b98d231f82a190711f9
7
+ data.tar.gz: f44775ee26d6130c3cccb845fd0ad17c82874bda2fb95a6634a017fed26c2854c38f42df52e61b9627632c0bd0bbd4440084ba3fc159824d1369f3aeaf4aaf5a
data/README.md CHANGED
@@ -56,6 +56,10 @@ $ openbd get 9784309226712
56
56
  $ openbd bulk_get 9784309226712 9784309226729
57
57
  $ openbd coverage
58
58
  $ openbd schema
59
+ $ openbd --help
60
+ Usage: openbd <method> [arguments] [options]
61
+ -v, --version print the version
62
+ -h, --help print help
59
63
  ```
60
64
 
61
65
  ## Contributing
@@ -1,27 +1,16 @@
1
1
  class OpenbdCLI
2
2
  def initialize(argv)
3
3
  @argv = argv
4
+ parse_option
4
5
  end
5
6
 
6
7
  def call
7
- opts = Slop.parse do |o|
8
- o.banner = "Usage: openbd <method> [arguments] [options]"
9
- o.on '-v', '--version', 'print the version' do
10
- puts "openbd_api #{Openbd::VERSION}"
11
- exit
12
- end
13
- o.on '-h', '--help', 'print help' do
14
- puts o
15
- exit
16
- end
17
- end
18
-
19
8
  if method_name.nil?
20
- puts opts
9
+ puts @opts
21
10
  elsif params.empty?
22
- puts OpenBD.send(method_name)
11
+ puts OpenBD.send(method_name).to_json
23
12
  else
24
- puts OpenBD.send(method_name, params)
13
+ puts OpenBD.send(method_name, params).to_json
25
14
  end
26
15
  end
27
16
 
@@ -34,4 +23,18 @@ class OpenbdCLI
34
23
  def params
35
24
  @argv[1..-1]
36
25
  end
26
+
27
+ def parse_option
28
+ @opts = Slop.parse do |o|
29
+ o.banner = "Usage: openbd <method> [arguments] [options]"
30
+ o.on '-v', '--version', 'print the version' do
31
+ puts "openbd_api #{Openbd::VERSION}"
32
+ exit
33
+ end
34
+ o.on '-h', '--help', 'print help' do
35
+ puts o
36
+ exit
37
+ end
38
+ end
39
+ end
37
40
  end
@@ -1,3 +1,3 @@
1
1
  module Openbd
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/openbd_api.gemspec CHANGED
@@ -24,5 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "bundler", "~> 1.14"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "rspec", "~> 3.0"
27
- spec.add_development_dependency "slop", "~> 4.4"
27
+ spec.add_runtime_dependency "slop", "~> 4.4"
28
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openbd_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nasum
@@ -59,7 +59,7 @@ dependencies:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '4.4'
62
- type: :development
62
+ type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements: