intrinio 0.1.4 → 0.1.5

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
- SHA1:
3
- metadata.gz: cf2eaeb36817a3f28f086932851aa82640d66649
4
- data.tar.gz: e41ba73df6877e6031bafa0fce2e655aff79096a
2
+ SHA256:
3
+ metadata.gz: 18234aa89c6a0ff78d05615331f6a8c031f81d35cd51d7a57f4a741bde134000
4
+ data.tar.gz: 4003e2aa98f3f43cea1e994130c93a5e15ca9d6b1261308674951dcecbe4eb5e
5
5
  SHA512:
6
- metadata.gz: 428dcc7137db5a06459c20b385496b6c529d69e18c085f6bcf29d5a2f42d1c1a2310159bb474d485e09524ca54984200b2e2a6dd92c2dbf45e551f0691db7a26
7
- data.tar.gz: 86a3c2604b6bb99c8443ee9eaebedec15cdf261dc4f9a49643f89ad03624c9c95da51520a49ebde8e3d587f64b28063e99464d11c3be98367beec988e519aaa7
6
+ metadata.gz: d84c4106892a6ae1e4fb89178f2a91604c7f92a8ccea7fea9ff68fdae7a09a0f6b35a919b91182bdd44f0d097cf7b838f43b8e485501798c159d9931bd2bc8ce
7
+ data.tar.gz: d4525a046cb3924bb2a7aa8d45b45085fdbf65c6cbce5fa0852701887f6c3c3fab334d7e28361c76c69c4800332503d6e2193de70bf14b57f06c148b9debd214
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  Intrinio API Library and Command Line
2
2
  ==================================================
3
3
 
4
- [![Gem](https://img.shields.io/gem/v/intrinio.svg?style=flat-square)](https://rubygems.org/gems/intrinio)
5
- [![Travis](https://img.shields.io/travis/DannyBen/intrinio.svg?style=flat-square)](https://travis-ci.org/DannyBen/intrinio)
6
- [![Code Climate](https://img.shields.io/codeclimate/github/DannyBen/intrinio.svg?style=flat-square)](https://codeclimate.com/github/DannyBen/intrinio)
7
- [![Gemnasium](https://img.shields.io/gemnasium/DannyBen/intrinio.svg?style=flat-square)](https://gemnasium.com/DannyBen/intrinio)
4
+ [![Gem Version](https://badge.fury.io/rb/intrinio.svg)](https://badge.fury.io/rb/intrinio)
5
+ [![Build Status](https://travis-ci.com/DannyBen/intrinio.svg?branch=master)](https://travis-ci.com/DannyBen/intrinio)
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/7428200a61a9203d2084/maintainability)](https://codeclimate.com/github/DannyBen/intrinio/maintainability)
7
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/7428200a61a9203d2084/test_coverage)](https://codeclimate.com/github/DannyBen/intrinio/test_coverage)
8
8
 
9
9
  ---
10
10
 
data/bin/intrinio CHANGED
@@ -3,7 +3,9 @@
3
3
  require 'intrinio'
4
4
 
5
5
  begin
6
- Intrinio::CommandLine.instance.execute ARGV
6
+ Intrinio::CommandLine.execute ARGV
7
7
  rescue APICake::BadResponse => e
8
8
  STDERR.puts "#{e.class} - #{e.message}"
9
+ rescue Intrinio::MissingAuth => e
10
+ STDERR.puts e.message
9
11
  end
@@ -1,41 +1,18 @@
1
- require 'singleton'
2
- require 'docopt'
1
+ require 'super_docopt'
3
2
  require 'json'
4
3
  require 'awesome_print'
5
4
 
6
5
  module Intrinio
7
6
 
8
7
  # Handles the command line interface
9
- class CommandLine
10
- include Singleton
11
-
12
- # Gets an array of arguments (e.g. ARGV), executes the command if valid
13
- # and shows usage patterns / help otherwise.
14
- def execute(argv=[])
15
- doc = File.read File.dirname(__FILE__) + '/docopt.txt'
16
- begin
17
- args = Docopt::docopt(doc, argv: argv, version: VERSION)
18
- handle args
19
- rescue Docopt::Exit, Intrinio::MissingAuth => e
20
- puts e.message
21
- end
22
- end
23
-
24
- def intrinio
25
- @intrinio ||= intrinio!
26
- end
27
-
28
- private
8
+ class CommandLine < SuperDocopt::Base
9
+ version VERSION
10
+ docopt File.expand_path 'docopt.txt', __dir__
11
+ subcommands ['get', 'pretty', 'see', 'url', 'save']
29
12
 
30
13
  attr_reader :path, :params, :file, :csv
31
14
 
32
- def intrinio!
33
- Intrinio::API.new options
34
- end
35
-
36
- # Called when the arguments match one of the usage patterns. Will
37
- # delegate action to other, more specialized methods.
38
- def handle(args)
15
+ def before_execute
39
16
  @path = args['PATH']
40
17
  @params = translate_params args['PARAMS']
41
18
  @file = args['FILE']
@@ -44,12 +21,6 @@ module Intrinio
44
21
  if intrinio_auth.empty?
45
22
  raise Intrinio::MissingAuth, "Missing Authentication\nPlease set INTRINIO_AUTH=username:password"
46
23
  end
47
-
48
- return get if args['get']
49
- return pretty if args['pretty']
50
- return see if args['see']
51
- return url if args['url']
52
- return save if args['save']
53
24
  end
54
25
 
55
26
  def get
@@ -95,6 +66,16 @@ module Intrinio
95
66
  result
96
67
  end
97
68
 
69
+ def intrinio
70
+ @intrinio ||= intrinio!
71
+ end
72
+
73
+ private
74
+
75
+ def intrinio!
76
+ Intrinio::API.new options
77
+ end
78
+
98
79
  def options
99
80
  result = { username: username, password: password }
100
81
  return result unless cache_dir || cache_life
@@ -1,3 +1,3 @@
1
1
  module Intrinio
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intrinio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-18 00:00:00.000000000 Z
11
+ date: 2019-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: docopt
14
+ name: super_docopt
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.5'
19
+ version: '0.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.5'
26
+ version: '0.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: awesome_print
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,104 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.1'
55
- - !ruby/object:Gem::Dependency
56
- name: runfile
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.8'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.8'
69
- - !ruby/object:Gem::Dependency
70
- name: runfile-tasks
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '0.4'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '0.4'
83
- - !ruby/object:Gem::Dependency
84
- name: rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.5'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '3.5'
97
- - !ruby/object:Gem::Dependency
98
- name: rdoc
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '5.0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '5.0'
111
- - !ruby/object:Gem::Dependency
112
- name: byebug
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '9.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '9.0'
125
- - !ruby/object:Gem::Dependency
126
- name: simplecov
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '0.13'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '0.13'
139
- - !ruby/object:Gem::Dependency
140
- name: yard
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '0.8'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '0.8'
153
55
  description: Easy to use API for Intrinio data service with a command line interface
154
56
  email: db@dannyben.com
155
57
  executables:
@@ -185,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
87
  version: '0'
186
88
  requirements: []
187
89
  rubyforge_project:
188
- rubygems_version: 2.6.6
90
+ rubygems_version: 2.7.6
189
91
  signing_key:
190
92
  specification_version: 4
191
93
  summary: Intrinio API Library and Command Line