coincap 0.1.2 → 0.2.3
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 +4 -4
- data/.rubocop.yml +178 -0
- data/Gemfile.lock +6 -5
- data/Rakefile +6 -6
- data/coincap.gemspec +6 -4
- data/lib/coincap/assets_price.rb +27 -7
- data/lib/coincap/exchanges.rb +2 -2
- data/lib/coincap/helper.rb +10 -10
- data/lib/coincap/markets.rb +19 -19
- data/lib/coincap/rates.rb +1 -1
- data/lib/coincap/version.rb +7 -1
- data/lib/coincap.rb +13 -4
- metadata +13 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 65af4f6edf23fd568e3318eb5ee35edcb8ea46b27372b1dc6f11895b8ba708e8
|
|
4
|
+
data.tar.gz: 546d6841b22503e6b407c7e7dd6521100753d1e08d5232f0145d6ead92661dae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6f19793fb77a993b65eb8a1b33b4a8bdfaa71279d7789c790b2e169a2c952c20043c7e3b75732b429c361a876770d851af22b4d66dc11f4cee921bce376f1957
|
|
7
|
+
data.tar.gz: c0be274b07adf3b01240fefeb92d10db9d92135ec8d71a2a8de21c6e410563b8777ca1ae1bf4ebebf8a064a69f2bf7c363f52aab31fe8371d27f8f0e0d96dab0
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
NewCops: enable
|
|
3
|
+
Gemspec/DeprecatedAttributeAssignment: # new in 1.30
|
|
4
|
+
Enabled: true
|
|
5
|
+
Gemspec/DevelopmentDependencies: # new in 1.44
|
|
6
|
+
Enabled: true
|
|
7
|
+
Gemspec/RequireMFA: # new in 1.23
|
|
8
|
+
Enabled: false
|
|
9
|
+
Layout/LineContinuationLeadingSpace: # new in 1.31
|
|
10
|
+
Enabled: true
|
|
11
|
+
Layout/LineContinuationSpacing: # new in 1.31
|
|
12
|
+
Enabled: true
|
|
13
|
+
Layout/LineEndStringConcatenationIndentation: # new in 1.18
|
|
14
|
+
Enabled: true
|
|
15
|
+
Layout/SpaceBeforeBrackets: # new in 1.7
|
|
16
|
+
Enabled: true
|
|
17
|
+
Lint/AmbiguousAssignment: # new in 1.7
|
|
18
|
+
Enabled: true
|
|
19
|
+
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
|
20
|
+
Enabled: true
|
|
21
|
+
Lint/AmbiguousRange: # new in 1.19
|
|
22
|
+
Enabled: true
|
|
23
|
+
Lint/ConstantOverwrittenInRescue: # new in 1.31
|
|
24
|
+
Enabled: true
|
|
25
|
+
Lint/DeprecatedConstants: # new in 1.8
|
|
26
|
+
Enabled: true
|
|
27
|
+
Lint/DuplicateBranch: # new in 1.3
|
|
28
|
+
Enabled: true
|
|
29
|
+
Lint/DuplicateMagicComment: # new in 1.37
|
|
30
|
+
Enabled: true
|
|
31
|
+
Lint/DuplicateMatchPattern: # new in 1.50
|
|
32
|
+
Enabled: true
|
|
33
|
+
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
|
|
34
|
+
Enabled: true
|
|
35
|
+
Lint/EmptyBlock: # new in 1.1
|
|
36
|
+
Enabled: true
|
|
37
|
+
Lint/EmptyClass: # new in 1.3
|
|
38
|
+
Enabled: true
|
|
39
|
+
Lint/EmptyInPattern: # new in 1.16
|
|
40
|
+
Enabled: true
|
|
41
|
+
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
|
42
|
+
Enabled: true
|
|
43
|
+
Lint/LambdaWithoutLiteralBlock: # new in 1.8
|
|
44
|
+
Enabled: true
|
|
45
|
+
Lint/NoReturnInBeginEndBlocks: # new in 1.2
|
|
46
|
+
Enabled: true
|
|
47
|
+
Lint/NonAtomicFileOperation: # new in 1.31
|
|
48
|
+
Enabled: true
|
|
49
|
+
Lint/NumberedParameterAssignment: # new in 1.9
|
|
50
|
+
Enabled: true
|
|
51
|
+
Lint/OrAssignmentToConstant: # new in 1.9
|
|
52
|
+
Enabled: true
|
|
53
|
+
Lint/RedundantDirGlobSort: # new in 1.8
|
|
54
|
+
Enabled: true
|
|
55
|
+
Lint/RefinementImportMethods: # new in 1.27
|
|
56
|
+
Enabled: true
|
|
57
|
+
Lint/RequireRangeParentheses: # new in 1.32
|
|
58
|
+
Enabled: true
|
|
59
|
+
Lint/RequireRelativeSelfPath: # new in 1.22
|
|
60
|
+
Enabled: true
|
|
61
|
+
Lint/SymbolConversion: # new in 1.9
|
|
62
|
+
Enabled: false
|
|
63
|
+
Lint/ToEnumArguments: # new in 1.1
|
|
64
|
+
Enabled: true
|
|
65
|
+
Lint/TripleQuotes: # new in 1.9
|
|
66
|
+
Enabled: true
|
|
67
|
+
Lint/UnexpectedBlockArity: # new in 1.5
|
|
68
|
+
Enabled: true
|
|
69
|
+
Lint/UnmodifiedReduceAccumulator: # new in 1.1
|
|
70
|
+
Enabled: true
|
|
71
|
+
Lint/UselessRescue: # new in 1.43
|
|
72
|
+
Enabled: true
|
|
73
|
+
Lint/UselessRuby2Keywords: # new in 1.23
|
|
74
|
+
Enabled: true
|
|
75
|
+
Metrics/CollectionLiteralLength: # new in 1.47
|
|
76
|
+
Enabled: true
|
|
77
|
+
Naming/BlockForwarding: # new in 1.24
|
|
78
|
+
Enabled: true
|
|
79
|
+
Security/CompoundHash: # new in 1.28
|
|
80
|
+
Enabled: true
|
|
81
|
+
Security/IoMethods: # new in 1.22
|
|
82
|
+
Enabled: true
|
|
83
|
+
Style/ArgumentsForwarding: # new in 1.1
|
|
84
|
+
Enabled: true
|
|
85
|
+
Style/ArrayIntersect: # new in 1.40
|
|
86
|
+
Enabled: true
|
|
87
|
+
Style/CollectionCompact: # new in 1.2
|
|
88
|
+
Enabled: true
|
|
89
|
+
Style/ComparableClamp: # new in 1.44
|
|
90
|
+
Enabled: true
|
|
91
|
+
Style/ConcatArrayLiterals: # new in 1.41
|
|
92
|
+
Enabled: true
|
|
93
|
+
Style/DataInheritance: # new in 1.49
|
|
94
|
+
Enabled: true
|
|
95
|
+
Style/DirEmpty: # new in 1.48
|
|
96
|
+
Enabled: true
|
|
97
|
+
Style/DocumentDynamicEvalDefinition: # new in 1.1
|
|
98
|
+
Enabled: false
|
|
99
|
+
Style/EmptyHeredoc: # new in 1.32
|
|
100
|
+
Enabled: true
|
|
101
|
+
Style/EndlessMethod: # new in 1.8
|
|
102
|
+
Enabled: true
|
|
103
|
+
Style/EnvHome: # new in 1.29
|
|
104
|
+
Enabled: true
|
|
105
|
+
Style/FetchEnvVar: # new in 1.28
|
|
106
|
+
Enabled: true
|
|
107
|
+
Style/FileEmpty: # new in 1.48
|
|
108
|
+
Enabled: true
|
|
109
|
+
Style/FileRead: # new in 1.24
|
|
110
|
+
Enabled: true
|
|
111
|
+
Style/FileWrite: # new in 1.24
|
|
112
|
+
Enabled: true
|
|
113
|
+
Style/HashConversion: # new in 1.10
|
|
114
|
+
Enabled: true
|
|
115
|
+
Style/HashExcept: # new in 1.7
|
|
116
|
+
Enabled: true
|
|
117
|
+
Style/IfWithBooleanLiteralBranches: # new in 1.9
|
|
118
|
+
Enabled: true
|
|
119
|
+
Style/InPatternThen: # new in 1.16
|
|
120
|
+
Enabled: true
|
|
121
|
+
Style/MagicCommentFormat: # new in 1.35
|
|
122
|
+
Enabled: true
|
|
123
|
+
Style/MapCompactWithConditionalBlock: # new in 1.30
|
|
124
|
+
Enabled: true
|
|
125
|
+
Style/MapToHash: # new in 1.24
|
|
126
|
+
Enabled: true
|
|
127
|
+
Style/MapToSet: # new in 1.42
|
|
128
|
+
Enabled: true
|
|
129
|
+
Style/MinMaxComparison: # new in 1.42
|
|
130
|
+
Enabled: true
|
|
131
|
+
Style/MultilineInPatternThen: # new in 1.16
|
|
132
|
+
Enabled: true
|
|
133
|
+
Style/NegatedIfElseCondition: # new in 1.2
|
|
134
|
+
Enabled: true
|
|
135
|
+
Style/NestedFileDirname: # new in 1.26
|
|
136
|
+
Enabled: true
|
|
137
|
+
Style/NilLambda: # new in 1.3
|
|
138
|
+
Enabled: true
|
|
139
|
+
Style/NumberedParameters: # new in 1.22
|
|
140
|
+
Enabled: true
|
|
141
|
+
Style/NumberedParametersLimit: # new in 1.22
|
|
142
|
+
Enabled: true
|
|
143
|
+
Style/ObjectThen: # new in 1.28
|
|
144
|
+
Enabled: true
|
|
145
|
+
Style/OpenStructUse: # new in 1.23
|
|
146
|
+
Enabled: true
|
|
147
|
+
Style/OperatorMethodCall: # new in 1.37
|
|
148
|
+
Enabled: true
|
|
149
|
+
Style/QuotedSymbols: # new in 1.16
|
|
150
|
+
Enabled: true
|
|
151
|
+
Style/RedundantArgument: # new in 1.4
|
|
152
|
+
Enabled: true
|
|
153
|
+
Style/RedundantConstantBase: # new in 1.40
|
|
154
|
+
Enabled: true
|
|
155
|
+
Style/RedundantDoubleSplatHashBraces: # new in 1.41
|
|
156
|
+
Enabled: true
|
|
157
|
+
Style/RedundantEach: # new in 1.38
|
|
158
|
+
Enabled: true
|
|
159
|
+
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
|
|
160
|
+
Enabled: true
|
|
161
|
+
Style/RedundantInitialize: # new in 1.27
|
|
162
|
+
Enabled: true
|
|
163
|
+
Style/RedundantLineContinuation: # new in 1.49
|
|
164
|
+
Enabled: true
|
|
165
|
+
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
|
166
|
+
Enabled: true
|
|
167
|
+
Style/RedundantStringEscape: # new in 1.37
|
|
168
|
+
Enabled: true
|
|
169
|
+
Style/SelectByRegexp: # new in 1.22
|
|
170
|
+
Enabled: true
|
|
171
|
+
Style/StringChars: # new in 1.12
|
|
172
|
+
Enabled: true
|
|
173
|
+
Style/SwapValues: # new in 1.1
|
|
174
|
+
Enabled: true
|
|
175
|
+
Layout/LineLength:
|
|
176
|
+
Enabled: false
|
|
177
|
+
Style/EvalWithLocation:
|
|
178
|
+
Enabled: false
|
data/Gemfile.lock
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
coincap (0.
|
|
4
|
+
coincap (0.2.3)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
9
|
json (2.6.3)
|
|
10
|
-
minitest (5.
|
|
10
|
+
minitest (5.20.0)
|
|
11
11
|
net-http (0.3.2)
|
|
12
12
|
uri
|
|
13
|
-
openssl (3.
|
|
13
|
+
openssl (3.2.0)
|
|
14
14
|
rake (13.0.6)
|
|
15
|
-
uri (0.12.
|
|
15
|
+
uri (0.12.2)
|
|
16
16
|
|
|
17
17
|
PLATFORMS
|
|
18
|
+
x86_64-darwin-22
|
|
18
19
|
x86_64-linux
|
|
19
20
|
|
|
20
21
|
DEPENDENCIES
|
|
@@ -27,4 +28,4 @@ DEPENDENCIES
|
|
|
27
28
|
uri (~> 0.12.1)
|
|
28
29
|
|
|
29
30
|
BUNDLED WITH
|
|
30
|
-
2.4.
|
|
31
|
+
2.4.20
|
data/Rakefile
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
3
|
+
require 'bundler/gem_tasks'
|
|
4
|
+
require 'rake/testtask'
|
|
5
5
|
|
|
6
6
|
Rake::TestTask.new(:test) do |t|
|
|
7
|
-
t.libs <<
|
|
8
|
-
t.libs <<
|
|
9
|
-
t.test_files = FileList[
|
|
7
|
+
t.libs << 'test'
|
|
8
|
+
t.libs << 'lib'
|
|
9
|
+
t.test_files = FileList['test/**/test_*.rb']
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
task default: :test
|
|
12
|
+
task default: :test
|
data/coincap.gemspec
CHANGED
|
@@ -5,17 +5,19 @@ require_relative 'lib/coincap/version'
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = 'coincap'
|
|
7
7
|
spec.version = Coincap::VERSION
|
|
8
|
-
spec.authors = ['
|
|
8
|
+
spec.authors = ['Vitalii Bakun']
|
|
9
9
|
spec.email = ['crossdoh@gmail.com']
|
|
10
10
|
|
|
11
11
|
spec.summary = 'CoinCap is a useful tool for real-time pricing and market activity for over 1,000 cryptocurrencies.'
|
|
12
|
-
spec.description =
|
|
12
|
+
spec.description = <<-DESC
|
|
13
|
+
CoinCap is a useful tool for real-time pricing and market activity for over 1,000 cryptocurrencies.
|
|
14
|
+
DESC
|
|
13
15
|
spec.license = 'MIT'
|
|
14
|
-
spec.required_ruby_version = '>= 2.
|
|
16
|
+
spec.required_ruby_version = '>= 2.7.0'
|
|
15
17
|
|
|
16
18
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
|
17
19
|
|
|
18
|
-
spec.metadata['source_code_uri'] = 'https://github.com/
|
|
20
|
+
spec.metadata['source_code_uri'] = 'https://github.com/vitalii-bakun/coincap'
|
|
19
21
|
|
|
20
22
|
# Specify which files should be added to the gem when it is released.
|
|
21
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/lib/coincap/assets_price.rb
CHANGED
|
@@ -9,7 +9,7 @@ module Coincap
|
|
|
9
9
|
# All values are translated into USD (United States Dollar)
|
|
10
10
|
# and can be translated into other units of measurement through the /rates endpoint.
|
|
11
11
|
module AssetsPrice
|
|
12
|
-
URI_API =
|
|
12
|
+
URI_API = "#{BASE_URI}#{VERSION_API}/assets"
|
|
13
13
|
|
|
14
14
|
TIME_INTERVAL = {
|
|
15
15
|
one_minute: 'm1',
|
|
@@ -73,7 +73,7 @@ module Coincap
|
|
|
73
73
|
# "timestamp": 1533581098863
|
|
74
74
|
# }
|
|
75
75
|
#
|
|
76
|
-
# @param [String]
|
|
76
|
+
# @param asset_id [String] Asset id, for example, bitcoin
|
|
77
77
|
# @return [String]
|
|
78
78
|
def self.cryptocurrency(asset_id)
|
|
79
79
|
Helper.request_to_read_data("#{URI_API}/#{asset_id}")
|
|
@@ -92,14 +92,34 @@ module Coincap
|
|
|
92
92
|
# "timestamp": 1533581103627
|
|
93
93
|
# }
|
|
94
94
|
#
|
|
95
|
-
#
|
|
96
|
-
#
|
|
95
|
+
# You can call the method like this:
|
|
96
|
+
#
|
|
97
|
+
# Coincap::AssetsPrice.cryptocurrency_history('bitcoin', :one_minute)
|
|
98
|
+
#
|
|
99
|
+
# Coincap::AssetsPrice.cryptocurrency_history('bitcoin', 'm1')
|
|
100
|
+
#
|
|
101
|
+
#
|
|
102
|
+
# Or like this:
|
|
103
|
+
#
|
|
104
|
+
# Coincap::AssetsPrice.cryptocurrency_history_one_minute('bitcoin')
|
|
105
|
+
#
|
|
106
|
+
# @param asset_id [String] Asset id, for example, bitcoin
|
|
107
|
+
# @param interval [Symbol|String] Select one from the list of TIME_INTERVAL values
|
|
108
|
+
# for example, a string 'm1' or a symbol :one_minute
|
|
97
109
|
# @return [String]
|
|
98
110
|
def self.cryptocurrency_history(asset_id, interval)
|
|
99
111
|
Helper.request_to_read_data("#{URI_API}/#{asset_id}/history",
|
|
100
112
|
interval: interval.is_a?(Symbol) ? TIME_INTERVAL[interval] : interval)
|
|
101
113
|
end
|
|
102
114
|
|
|
115
|
+
TIME_INTERVAL.each do |key, value|
|
|
116
|
+
class_eval <<~RUBY
|
|
117
|
+
def self.cryptocurrency_history_#{key}(asset_id)
|
|
118
|
+
self.cryptocurrency_history(asset_id, '#{value}')
|
|
119
|
+
end
|
|
120
|
+
RUBY
|
|
121
|
+
end
|
|
122
|
+
|
|
103
123
|
# Get price cryptocurrency with markets
|
|
104
124
|
#
|
|
105
125
|
# {
|
|
@@ -119,9 +139,9 @@ module Coincap
|
|
|
119
139
|
# "timestamp": 1539289444052
|
|
120
140
|
# }
|
|
121
141
|
#
|
|
122
|
-
# @param [String]
|
|
123
|
-
# @param [Integer]
|
|
124
|
-
# @param [Integer]
|
|
142
|
+
# @param asset_id [String] Asset id, for example, bitcoin
|
|
143
|
+
# @param limit [Integer] Max limit of 2000
|
|
144
|
+
# @param offset [Integer] Offset
|
|
125
145
|
# @return [String]
|
|
126
146
|
def self.cryptocurrency_with_markets(asset_id, limit: nil, offset: nil)
|
|
127
147
|
Helper.request_to_read_data("#{URI_API}/#{asset_id}/markets", limit: limit, offset: offset)
|
data/lib/coincap/exchanges.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Coincap
|
|
|
11
11
|
# For that purpose you will find an "updated" key for each exchange.
|
|
12
12
|
# For more details into coin pairs and volume, see the /markets endpoint.
|
|
13
13
|
module Exchanges
|
|
14
|
-
URI_API =
|
|
14
|
+
URI_API = "#{BASE_URI}#{VERSION_API}/exchanges"
|
|
15
15
|
|
|
16
16
|
# Returns a list of all exchanges.
|
|
17
17
|
#
|
|
@@ -55,7 +55,7 @@ module Coincap
|
|
|
55
55
|
# "timestamp": 1536605874069
|
|
56
56
|
# }
|
|
57
57
|
#
|
|
58
|
-
# @param exchange_id [String]
|
|
58
|
+
# @param exchange_id [String] Search by exchange name, for example, kraken
|
|
59
59
|
# @return [String]
|
|
60
60
|
def self.single(exchange_id)
|
|
61
61
|
Helper.request_to_read_data("#{URI_API}/#{exchange_id}")
|
data/lib/coincap/helper.rb
CHANGED
|
@@ -6,35 +6,35 @@ require 'net/http'
|
|
|
6
6
|
require 'openssl'
|
|
7
7
|
|
|
8
8
|
module Coincap
|
|
9
|
+
BASE_URI = 'https://api.coincap.io/'
|
|
10
|
+
VERSION_API = 'v2'
|
|
11
|
+
|
|
9
12
|
# Helper module
|
|
10
13
|
module Helper
|
|
11
14
|
class << self
|
|
12
15
|
# Request to read data
|
|
13
|
-
#
|
|
14
|
-
# @param
|
|
16
|
+
#
|
|
17
|
+
# @param uri_string [String] String of the uri
|
|
18
|
+
# @param queries_hash [Hash] Queries hash for the request
|
|
15
19
|
# @return [String]
|
|
16
20
|
def request_to_read_data(uri_string, **queries_hash)
|
|
17
|
-
http_get
|
|
21
|
+
http_get build_uri(uri_string, **queries_hash)
|
|
18
22
|
end
|
|
19
23
|
|
|
20
|
-
JSON.parse(data_str)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
class << self
|
|
24
24
|
private
|
|
25
25
|
|
|
26
26
|
def http_get(uri)
|
|
27
|
-
config = Coincap.
|
|
27
|
+
config = Coincap.config
|
|
28
28
|
|
|
29
29
|
headers = {
|
|
30
|
-
'Accept-Encoding': config.accept_encoding
|
|
30
|
+
'Accept-Encoding': config.accept_encoding,
|
|
31
31
|
'Authorization': config.api_key.nil? ? nil : "Bearer #{config.api_key}"
|
|
32
32
|
}.compact
|
|
33
33
|
|
|
34
34
|
Net::HTTP.get(uri, headers)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
def
|
|
37
|
+
def build_uri(uri, **queries_hash)
|
|
38
38
|
queries_str = queries_hash.compact.map { |key, value| "#{key}=#{value}" }.join('&')
|
|
39
39
|
URI("#{uri}#{queries_str.empty? ? '' : "?#{queries_str}"}")
|
|
40
40
|
end
|
data/lib/coincap/markets.rb
CHANGED
|
@@ -10,7 +10,7 @@ module Coincap
|
|
|
10
10
|
# All market data represents actual trades processed, orders on an exchange are not represented.
|
|
11
11
|
# Data received from individual markets is used to calculate the current price of an asset.
|
|
12
12
|
module Markets
|
|
13
|
-
URI_API =
|
|
13
|
+
URI_API = "#{BASE_URI}#{VERSION_API}/markets"
|
|
14
14
|
|
|
15
15
|
# Returns a list of all markets.
|
|
16
16
|
#
|
|
@@ -35,27 +35,27 @@ module Coincap
|
|
|
35
35
|
# "timestamp": 1533581173350
|
|
36
36
|
# }
|
|
37
37
|
#
|
|
38
|
-
# @param
|
|
39
|
-
# @param
|
|
40
|
-
# @param
|
|
41
|
-
# @param
|
|
42
|
-
# @param
|
|
43
|
-
# @param
|
|
44
|
-
# @param
|
|
45
|
-
# @param
|
|
46
|
-
# @param
|
|
38
|
+
# @param exchange_id (nil) [String] Search by exchange id (e.g. 'binance')
|
|
39
|
+
# @param base_symbol (nil) [String] Returns all containing the base symbol
|
|
40
|
+
# @param quote_symbol (nil) [String] Returns all containing the quote symbol
|
|
41
|
+
# @param base_id (nil) [String] Returns all containing the base id
|
|
42
|
+
# @param quote_id (nil) [String] Returns all containing the quote id
|
|
43
|
+
# @param asset_symbol (nil) [String] Returns all assets containing symbol (base and quote)
|
|
44
|
+
# @param asset_id (nil) [String] Returns all assets containing id (base and quote)
|
|
45
|
+
# @param limit (nil) [Integer] Max limit of 2000
|
|
46
|
+
# @param offset (nil) [Integer] The number of results to skip
|
|
47
47
|
# @return [String]
|
|
48
48
|
def self.list(**options)
|
|
49
49
|
Helper.request_to_read_data(URI_API,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
exchangeId: options[:exchange_id],
|
|
51
|
+
baseSymbol: options[:base_symbol],
|
|
52
|
+
quoteSymbol: options[:quote_symbol],
|
|
53
|
+
baseId: options[:base_id],
|
|
54
|
+
quoteId: options[:quote_id],
|
|
55
|
+
assetSymbol: options[:asset_symbol],
|
|
56
|
+
assetId: options[:asset_id],
|
|
57
|
+
limit: options[:limit],
|
|
58
|
+
offset: options[:offset])
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
end
|
data/lib/coincap/rates.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Coincap
|
|
|
8
8
|
# We offer fiat and top cryptocurrency translated rates.
|
|
9
9
|
# Fiat rates are available through OpenExchangeRates.org.
|
|
10
10
|
module Rates
|
|
11
|
-
URI_API =
|
|
11
|
+
URI_API = "#{BASE_URI}#{VERSION_API}/rates"
|
|
12
12
|
|
|
13
13
|
# Returns a list of all rates.
|
|
14
14
|
#
|
data/lib/coincap/version.rb
CHANGED
data/lib/coincap.rb
CHANGED
|
@@ -9,10 +9,13 @@ require_relative 'coincap/exchanges'
|
|
|
9
9
|
|
|
10
10
|
# CoinCap 2.0 RESTful API is currently in production!
|
|
11
11
|
# The CoinCap team is excited to offer you new endpoints and more clarity on pricing!
|
|
12
|
+
#
|
|
12
13
|
# CoinCap 2.0 launched on September 26, 2018.
|
|
13
14
|
# Please let us know what you like, what you would hope to see, or any bugs/changes that you'd like to document.
|
|
15
|
+
#
|
|
14
16
|
# The easiest way to submit feedback to our team is to fill out a support ticket here.
|
|
15
17
|
# The old CoinCap API is deprecated and was shut down on March 1, 2019.
|
|
18
|
+
#
|
|
16
19
|
# For any issues with transitioning from the old CoinCap API to the new,
|
|
17
20
|
# please submit feedback via the zendesk link above!
|
|
18
21
|
module Coincap
|
|
@@ -29,10 +32,16 @@ module Coincap
|
|
|
29
32
|
end
|
|
30
33
|
end
|
|
31
34
|
|
|
32
|
-
|
|
35
|
+
class << self
|
|
36
|
+
# Configuration the Coincap API
|
|
37
|
+
# @return [Coincap::Configuration]
|
|
38
|
+
def config
|
|
39
|
+
@config ||= Configuration.new
|
|
40
|
+
end
|
|
33
41
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
# Configuration the Coincap API
|
|
43
|
+
def self.configure
|
|
44
|
+
yield config
|
|
45
|
+
end
|
|
37
46
|
end
|
|
38
47
|
end
|
metadata
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: coincap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
8
|
-
autorequire:
|
|
7
|
+
- Vitalii Bakun
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-10-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
|
-
description: CoinCap is a useful tool for real-time pricing and market activity
|
|
14
|
-
over 1,000 cryptocurrencies
|
|
13
|
+
description: " CoinCap is a useful tool for real-time pricing and market activity
|
|
14
|
+
for over 1,000 cryptocurrencies.\n"
|
|
15
15
|
email:
|
|
16
16
|
- crossdoh@gmail.com
|
|
17
17
|
executables: []
|
|
18
18
|
extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
|
20
20
|
files:
|
|
21
|
+
- ".rubocop.yml"
|
|
21
22
|
- Gemfile
|
|
22
23
|
- Gemfile.lock
|
|
23
24
|
- LICENSE.txt
|
|
@@ -31,13 +32,13 @@ files:
|
|
|
31
32
|
- lib/coincap/markets.rb
|
|
32
33
|
- lib/coincap/rates.rb
|
|
33
34
|
- lib/coincap/version.rb
|
|
34
|
-
homepage:
|
|
35
|
+
homepage:
|
|
35
36
|
licenses:
|
|
36
37
|
- MIT
|
|
37
38
|
metadata:
|
|
38
39
|
allowed_push_host: https://rubygems.org
|
|
39
|
-
source_code_uri: https://github.com/
|
|
40
|
-
post_install_message:
|
|
40
|
+
source_code_uri: https://github.com/vitalii-bakun/coincap
|
|
41
|
+
post_install_message:
|
|
41
42
|
rdoc_options: []
|
|
42
43
|
require_paths:
|
|
43
44
|
- lib
|
|
@@ -45,15 +46,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
45
46
|
requirements:
|
|
46
47
|
- - ">="
|
|
47
48
|
- !ruby/object:Gem::Version
|
|
48
|
-
version: 2.
|
|
49
|
+
version: 2.7.0
|
|
49
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
51
|
requirements:
|
|
51
52
|
- - ">="
|
|
52
53
|
- !ruby/object:Gem::Version
|
|
53
54
|
version: '0'
|
|
54
55
|
requirements: []
|
|
55
|
-
rubygems_version: 3.4.
|
|
56
|
-
signing_key:
|
|
56
|
+
rubygems_version: 3.4.20
|
|
57
|
+
signing_key:
|
|
57
58
|
specification_version: 4
|
|
58
59
|
summary: CoinCap is a useful tool for real-time pricing and market activity for over
|
|
59
60
|
1,000 cryptocurrencies.
|