coinpare 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'net/http'
4
- require 'json'
3
+ require "net/http"
4
+ require "json"
5
5
 
6
6
  module Coinpare
7
7
  # Handle all data fetching from remote api
@@ -22,7 +22,7 @@ module Coinpare
22
22
  uri = URI.parse(url)
23
23
  http = Net::HTTP.new(uri.host, uri.port)
24
24
  http.read_timeout = 5
25
- http.use_ssl = uri.scheme == 'https'
25
+ http.use_ssl = uri.scheme == "https"
26
26
  response = http.start { |req| req.get(uri.request_uri) }
27
27
  case response
28
28
  when Net::HTTPSuccess
@@ -36,7 +36,9 @@ module Coinpare
36
36
 
37
37
  def fetch_daily_hist(from_symbol, to_symbol, options)
38
38
  url = ["#{API_URL}histoday"]
39
- url << "?fsym=BTC&tsym=USD&limit=7&aggregate=7"
39
+ url << "?fsym=#{from_symbol}&tsym=#{to_symbol}"
40
+ url << "&limit=#{options['top']}" if options["top"]
41
+ url << "&aggregate=7"
40
42
 
41
43
  fetch_json(url.join)
42
44
  end
@@ -44,7 +46,7 @@ module Coinpare
44
46
  def fetch_top_coins_by_volume(to_symbol, options)
45
47
  url = ["#{API_URL}top/totalvol"]
46
48
  url << "?tsym=#{to_symbol}"
47
- url << "&limit=#{options['top']}&page=0" if options['top']
49
+ url << "&limit=#{options['top']}&page=0" if options["top"]
48
50
 
49
51
  fetch_json(url.join)
50
52
  end
@@ -53,7 +55,7 @@ module Coinpare
53
55
  def fetch_prices(from_symbols, to_symbols, options)
54
56
  url = ["#{API_URL}pricemultifull"]
55
57
  url << "?fsyms=#{from_symbols}&tsyms=#{to_symbols}"
56
- url << "&e=#{options['exchange']}" if options['exchange']
58
+ url << "&e=#{options['exchange']}" if options["exchange"]
57
59
  url << "&tryConversion=true"
58
60
 
59
61
  fetch_json(url.join)
@@ -63,10 +65,10 @@ module Coinpare
63
65
  def fetch_top_exchanges_by_pair(from_symbol, to_symbol, options)
64
66
  url = ["#{API_URL}top/exchanges/full"]
65
67
  url << "?fsym=#{from_symbol}&tsym=#{to_symbol}"
66
- url << "&limit=#{options['top']}&page=0" if options['top']
68
+ url << "&limit=#{options['top']}&page=0" if options["top"]
67
69
 
68
70
  fetch_json(url.join)
69
71
  end
70
72
  module_function :fetch_top_exchanges_by_pair
71
- end
72
- end
73
+ end # Fetcher
74
+ end # Coinpare
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coinpare
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,59 +1,59 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coinpare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-12 00:00:00.000000000 Z
11
+ date: 2020-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: tty-color
14
+ name: tty-config
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.4'
19
+ version: 0.4.0
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.4'
26
+ version: 0.4.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: tty-config
28
+ name: tty-cursor
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.0
33
+ version: '0.7'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.3.0
40
+ version: '0.7'
41
41
  - !ruby/object:Gem::Dependency
42
- name: tty-cursor
42
+ name: tty-editor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.6.0
47
+ version: '0.6'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.6.0
54
+ version: '0.6'
55
55
  - !ruby/object:Gem::Dependency
56
- name: tty-editor
56
+ name: tty-font
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
@@ -67,61 +67,61 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.5'
69
69
  - !ruby/object:Gem::Dependency
70
- name: tty-font
70
+ name: tty-pager
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.3'
75
+ version: '0.14'
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: '0.3'
82
+ version: '0.14'
83
83
  - !ruby/object:Gem::Dependency
84
- name: tty-pager
84
+ name: tty-pie
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.12'
89
+ version: 0.4.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.12'
96
+ version: 0.4.0
97
97
  - !ruby/object:Gem::Dependency
98
- name: tty-pie
98
+ name: tty-prompt
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.2.0
103
+ version: '0.22'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.2.0
110
+ version: '0.22'
111
111
  - !ruby/object:Gem::Dependency
112
- name: tty-prompt
112
+ name: tty-screen
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0.18'
117
+ version: '0.8'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0.18'
124
+ version: '0.8'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: tty-spinner
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -142,42 +142,42 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.10.0
145
+ version: 0.12.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.10.0
152
+ version: 0.12.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: pastel
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 0.7.2
159
+ version: 0.8.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 0.7.2
166
+ version: 0.8.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: thor
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 0.20.0
173
+ version: 1.0.1
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 0.20.0
180
+ version: 1.0.1
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: toml
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -206,34 +206,20 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: 4.1.2
209
- - !ruby/object:Gem::Dependency
210
- name: bundler
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - "~>"
214
- - !ruby/object:Gem::Version
215
- version: '1.16'
216
- type: :development
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - "~>"
221
- - !ruby/object:Gem::Version
222
- version: '1.16'
223
209
  - !ruby/object:Gem::Dependency
224
210
  name: rake
225
211
  requirement: !ruby/object:Gem::Requirement
226
212
  requirements:
227
- - - "~>"
213
+ - - ">="
228
214
  - !ruby/object:Gem::Version
229
- version: '12.0'
215
+ version: '0'
230
216
  type: :development
231
217
  prerelease: false
232
218
  version_requirements: !ruby/object:Gem::Requirement
233
219
  requirements:
234
- - - "~>"
220
+ - - ">="
235
221
  - !ruby/object:Gem::Version
236
- version: '12.0'
222
+ version: '0'
237
223
  - !ruby/object:Gem::Dependency
238
224
  name: rspec
239
225
  requirement: !ruby/object:Gem::Requirement
@@ -278,19 +264,18 @@ dependencies:
278
264
  version: 0.9.1
279
265
  description: Compare cryptocurrency trading data across multiple exchanges and blockchains.
280
266
  email:
281
- - ''
267
+ - piotr@piotrmurach.com
282
268
  executables:
283
269
  - coinpare
284
270
  extensions: []
285
- extra_rdoc_files: []
271
+ extra_rdoc_files:
272
+ - README.md
273
+ - CHANGELOG.md
274
+ - LICENSE.txt
286
275
  files:
287
276
  - CHANGELOG.md
288
277
  - LICENSE.txt
289
278
  - README.md
290
- - Rakefile
291
- - bin/console
292
- - bin/setup
293
- - coinpare.gemspec
294
279
  - exe/coinpare
295
280
  - lib/coinpare.rb
296
281
  - lib/coinpare/cli.rb
@@ -303,7 +288,13 @@ files:
303
288
  homepage: https://github.com/piotrmurach/coinpare
304
289
  licenses:
305
290
  - AGPL-3.0
306
- metadata: {}
291
+ metadata:
292
+ allowed_push_host: https://rubygems.org
293
+ bug_tracker_uri: https://github.com/piotrmurach/coinpare/issues
294
+ changelog_uri: https://github.com/piotrmurach/coinpare/blob/master/CHANGELOG.md
295
+ documentation_uri: https://www.rubydoc.info/gems/coinpare
296
+ homepage_uri: https://github.com/piotrmurach/coinpare
297
+ source_code_uri: https://github.com/piotrmurach/coinpare
307
298
  post_install_message:
308
299
  rdoc_options: []
309
300
  require_paths:
@@ -319,8 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
319
310
  - !ruby/object:Gem::Version
320
311
  version: '0'
321
312
  requirements: []
322
- rubyforge_project:
323
- rubygems_version: 2.7.3
313
+ rubygems_version: 3.1.2
324
314
  signing_key:
325
315
  specification_version: 4
326
316
  summary: Compare cryptocurrency trading data across multiple exchanges and blockchains.
data/Rakefile DELETED
@@ -1,9 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- desc 'Run all specs'
7
- task ci: %w[ spec ]
8
-
9
- task default: :spec
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "coinpare"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,45 +0,0 @@
1
- lib = File.expand_path("../lib", __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "coinpare/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "coinpare"
7
- spec.license = "AGPL-3.0"
8
- spec.version = Coinpare::VERSION
9
- spec.authors = ["Piotr Murach"]
10
- spec.email = [""]
11
-
12
- spec.summary = %q{Compare cryptocurrency trading data across multiple exchanges and blockchains.}
13
- spec.description = %q{Compare cryptocurrency trading data across multiple exchanges and blockchains.}
14
- spec.homepage = "https://github.com/piotrmurach/coinpare"
15
-
16
- spec.files = Dir['lib/**/*']
17
- spec.files += Dir['bin/*', 'coinpare.gemspec']
18
- spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile']
19
- spec.bindir = "exe"
20
- spec.executables = "coinpare"
21
- spec.require_paths = ["lib"]
22
-
23
- spec.required_ruby_version = '>= 2.0.0'
24
-
25
- spec.add_dependency "tty-color", "~> 0.4"
26
- spec.add_dependency "tty-config", "~> 0.3.0"
27
- spec.add_dependency "tty-cursor", "~> 0.6.0"
28
- spec.add_dependency "tty-editor", "~> 0.5"
29
- spec.add_dependency "tty-font", "~> 0.3"
30
- spec.add_dependency "tty-pager", "~> 0.12"
31
- spec.add_dependency "tty-pie", "~> 0.2.0"
32
- spec.add_dependency "tty-prompt", "~> 0.18"
33
- spec.add_dependency "tty-spinner", "~> 0.9"
34
- spec.add_dependency "tty-table", "~> 0.10.0"
35
- spec.add_dependency "pastel", "~> 0.7.2"
36
- spec.add_dependency "thor", "~> 0.20.0"
37
- spec.add_dependency "toml", "~> 0.2.0"
38
- spec.add_dependency "timers", "~> 4.1.2"
39
-
40
- spec.add_development_dependency "bundler", "~> 1.16"
41
- spec.add_development_dependency "rake", "~> 12.0"
42
- spec.add_development_dependency "rspec", "~> 3.0"
43
- spec.add_development_dependency "webmock", "~> 3.5"
44
- spec.add_development_dependency "timecop", "~> 0.9.1"
45
- end