coingecko_ruby 0.1.0 → 0.2.0

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
  SHA256:
3
- metadata.gz: 2d4ca5a09aa9298cb8612205166f45778d4fcb5ccdcdd78b7e801b70b941f80f
4
- data.tar.gz: 7730cf32e62d09879c8288ea5188ee3e1d8f8d491d21e1fbd4dce9c714c177b8
3
+ metadata.gz: 947f7115105befc5f5ae23b2d7cb4f16300cf4d3036dc650a2d0cfa18eae7e7d
4
+ data.tar.gz: 6961c3661051a64f326330720491d89e323948ee2a213b5c633fa72a2aeab547
5
5
  SHA512:
6
- metadata.gz: b4ca439622cddb324295ffc518b45318d72899402360a42543e83f5b90959b444c494cfd5797bfc255c3d0a88afa5bc2df8afe03d4bc418d8bb18b59de87b325
7
- data.tar.gz: 55d787ce4dbd09cd6915eeabb987b94402eb3345b210d7b4f748d1d147b97d2a415b899e88640702c0f93f6bc75ce363b3e091f45d4a601b0926beba30c328f6
6
+ metadata.gz: 9e0995ae473d3cc7673303592b5d98f109de4cc936a8f723292cd06d8c0be2c2b92eeb39648073e15c452e0434a593231c6d1df536c3313bb0dd7813ea91f795
7
+ data.tar.gz: 2662cf06d038adca61e0d90d8a92534790dc8543dff1af15be68e35fb410e39c20274fdb4083c4819aaa59f29cb5850ebcfc99c0b8cb26e0ee9d89e01de5fecd
data/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ ## 0.2.0 - 16-05-2021
2
+
3
+ ### [Added]
4
+
5
+ #### Modules
6
+ * Added `Exchanges` module to fetch exchange data.
7
+
8
+ #### Tests
9
+ * Added `vcr` and `webmock` gems for testing.
10
+ * Added basic unit tests for every client module.
11
+ * Added setting for `vcr` episodes to use `:new_episodes` as the default `:record` mode.
12
+
13
+ #### Docs
14
+ * Added `YARD` documentation (params, return values, usage, and response objects) for every method in client modules.
15
+
16
+ ### [Changes]
17
+ * Changed `get` method in `connection.rb` to build querystrings from the `options` object.
18
+ * Changed method definitions to accept an `options` parameter to define options when making requests.
19
+
20
+ ## 0.1.0 - 09-05-2021
21
+
22
+ * Initial gem release!
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  # spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
21
  # `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
22
  # end
23
- spec.files = %w(LICENSE.md README.md Rakefile coingecko_ruby.gemspec)
23
+ spec.files = %w(CHANGELOG.md LICENSE.md README.md Rakefile coingecko_ruby.gemspec)
24
24
  spec.files += Dir.glob("lib/**/*.rb")
25
25
  spec.bindir = "exe"
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -4,7 +4,7 @@ require "coingecko_ruby/client"
4
4
  module CoingeckoRuby
5
5
  class << self
6
6
  def client
7
- @client = CoingeckoRuby::Client.new
7
+ CoingeckoRuby::Client.new
8
8
  end
9
9
  end
10
10
  end
@@ -2,6 +2,8 @@ require 'coingecko_ruby/connection'
2
2
  require 'coingecko_ruby/client/status'
3
3
  require 'coingecko_ruby/client/prices'
4
4
  require 'coingecko_ruby/client/coins'
5
+ require 'coingecko_ruby/client/categories'
6
+ require 'coingecko_ruby/client/exchanges'
5
7
 
6
8
  module CoingeckoRuby
7
9
  class Client
@@ -9,5 +11,7 @@ module CoingeckoRuby
9
11
  include CoingeckoRuby::Client::Status
10
12
  include CoingeckoRuby::Client::Prices
11
13
  include CoingeckoRuby::Client::Coins
14
+ include CoingeckoRuby::Client::Categories
15
+ include CoingeckoRuby::Client::Exchanges
12
16
  end
13
17
  end
@@ -0,0 +1,406 @@
1
+ module CoingeckoRuby
2
+ class Client
3
+ module Categories
4
+ # Fetches the list of coin categories in CoinGecko.
5
+ #
6
+ # @return [Array<Hash>] each category's id and name
7
+ #
8
+ # @example Get all coin categories.
9
+ # client.get_categories
10
+ # @example Response object
11
+ # [{
12
+ # "category_id" => "recently_added",
13
+ # "name" => "Recently Added"
14
+ # }, {
15
+ # "category_id" => "aave-tokens",
16
+ # "name" => "Aave Tokens"
17
+ # }, {
18
+ # "category_id" => "analytics",
19
+ # "name" => "Analytics"
20
+ # }, {
21
+ # "category_id" => "artificial-intelligence",
22
+ # "name" => "Artificial Intelligence"
23
+ # }, {
24
+ # "category_id" => "asset-backed-tokens",
25
+ # "name" => "Asset-backed Tokens"
26
+ # }, {
27
+ # "category_id" => "asset-manager",
28
+ # "name" => "Asset Manager"
29
+ # }, {
30
+ # "category_id" => "augmented-reality",
31
+ # "name" => "Augmented Reality"
32
+ # }, {
33
+ # "category_id" => "automated-market-maker-amm",
34
+ # "name" => "Automated Market Maker (AMM)"
35
+ # }, {
36
+ # "category_id" => "avalanche-ecosystem",
37
+ # "name" => "Avalanche Ecosystem"
38
+ # }, {
39
+ # "category_id" => "axie-infinity",
40
+ # "name" => "Axie Infinity"
41
+ # }, {
42
+ # "category_id" => "big-data",
43
+ # "name" => "Big Data"
44
+ # }, {
45
+ # "category_id" => "binance-launchpool",
46
+ # "name" => "Binance Launchpool"
47
+ # }, {
48
+ # "category_id" => "binance-smart-chain",
49
+ # "name" => "Binance Smart Chain Ecosystem"
50
+ # }, {
51
+ # "category_id" => "business-platform",
52
+ # "name" => "Business Platform"
53
+ # }, {
54
+ # "category_id" => "business-services",
55
+ # "name" => "Business Services"
56
+ # }, {
57
+ # "category_id" => "centralized-exchange-token-cex",
58
+ # "name" => "Centralized Exchange Token (CEX)"
59
+ # }, {
60
+ # "category_id" => "charity",
61
+ # "name" => "Charity"
62
+ # }, {
63
+ # "category_id" => "cny-stablecoin",
64
+ # "name" => "CNY Stablecoin"
65
+ # }, {
66
+ # "category_id" => "collectibles",
67
+ # "name" => "Collectibles"
68
+ # }, {
69
+ # "category_id" => "communication",
70
+ # "name" => "Communication"
71
+ # }, {
72
+ # "category_id" => "compound-tokens",
73
+ # "name" => "Compound Tokens"
74
+ # }, {
75
+ # "category_id" => "cosmos-ecosystem",
76
+ # "name" => "Cosmos Ecosystem"
77
+ # }, {
78
+ # "category_id" => "cryptocurrency",
79
+ # "name" => "Cryptocurrency"
80
+ # }, {
81
+ # "category_id" => "decentralized-exchange",
82
+ # "name" => "Decentralized Exchange Token (DEX)"
83
+ # }, {
84
+ # "category_id" => "decentralized-finance-defi",
85
+ # "name" => "Decentralized Finance (DeFi)"
86
+ # }, {
87
+ # "category_id" => "defi-index",
88
+ # "name" => "DeFi Index"
89
+ # }, {
90
+ # "category_id" => "decentralized-derivatives",
91
+ # "name" => "Derivatives"
92
+ # }, {
93
+ # "category_id" => "education",
94
+ # "name" => "Education"
95
+ # }, {
96
+ # "category_id" => "energy",
97
+ # "name" => "Energy"
98
+ # }, {
99
+ # "category_id" => "entertainment",
100
+ # "name" => "Entertainment"
101
+ # }, {
102
+ # "category_id" => "etf",
103
+ # "name" => "ETF"
104
+ # }, {
105
+ # "category_id" => "eth-2-0-staking",
106
+ # "name" => "Eth 2.0 Staking"
107
+ # }, {
108
+ # "category_id" => "eur-stablecoin",
109
+ # "name" => "EUR Stablecoin"
110
+ # }, {
111
+ # "category_id" => "exchange-based-tokens",
112
+ # "name" => "Exchange-based Tokens"
113
+ # }, {
114
+ # "category_id" => "fan-token",
115
+ # "name" => "Fan Token"
116
+ # }, {
117
+ # "category_id" => "finance-banking",
118
+ # "name" => "Finance / Banking"
119
+ # }, {
120
+ # "category_id" => "gambling",
121
+ # "name" => "Gambling"
122
+ # }, {
123
+ # "category_id" => "gaming",
124
+ # "name" => "Gaming"
125
+ # }, {
126
+ # "category_id" => "gbp-stablecoin",
127
+ # "name" => "GBP Stablecoin"
128
+ # }, {
129
+ # "category_id" => "gig-economy",
130
+ # "name" => "Gig Economy"
131
+ # }, {
132
+ # "category_id" => "governance",
133
+ # "name" => "Governance"
134
+ # }, {
135
+ # "category_id" => "healthcare",
136
+ # "name" => "Healthcare"
137
+ # }, {
138
+ # "category_id" => "heco-chain-ecosystem",
139
+ # "name" => "HECO Chain Ecosystem"
140
+ # }, {
141
+ # "category_id" => "index-coin",
142
+ # "name" => "Index"
143
+ # }, {
144
+ # "category_id" => "infrastructure",
145
+ # "name" => "Infrastructure"
146
+ # }, {
147
+ # "category_id" => "insurance",
148
+ # "name" => "Insurance"
149
+ # }, {
150
+ # "category_id" => "internet-of-things-iot",
151
+ # "name" => "Internet of Things (IOT)"
152
+ # }, {
153
+ # "category_id" => "investment",
154
+ # "name" => "Investment"
155
+ # }, {
156
+ # "category_id" => "krw-stablecoin",
157
+ # "name" => "KRW Stablecoin"
158
+ # }, {
159
+ # "category_id" => "launchpad",
160
+ # "name" => "Launchpad"
161
+ # }, {
162
+ # "category_id" => "layer-1",
163
+ # "name" => "Layer 1"
164
+ # }, {
165
+ # "category_id" => "legal",
166
+ # "name" => "Legal"
167
+ # }, {
168
+ # "category_id" => "lending-borrowing",
169
+ # "name" => "Lending/Borrowing"
170
+ # }, {
171
+ # "category_id" => "lp-tokens",
172
+ # "name" => "LP Tokens"
173
+ # }, {
174
+ # "category_id" => "manufacturing",
175
+ # "name" => "Manufacturing"
176
+ # }, {
177
+ # "category_id" => "marketing",
178
+ # "name" => "Marketing"
179
+ # }, {
180
+ # "category_id" => "masternodes",
181
+ # "name" => "Masternodes"
182
+ # }, {
183
+ # "category_id" => "media",
184
+ # "name" => "Media"
185
+ # }, {
186
+ # "category_id" => "meme-token",
187
+ # "name" => "Meme Tokens"
188
+ # }, {
189
+ # "category_id" => "metaverse",
190
+ # "name" => "Metaverse"
191
+ # }, {
192
+ # "category_id" => "mirrored-assets",
193
+ # "name" => "Mirrored Assets"
194
+ # }, {
195
+ # "category_id" => "music",
196
+ # "name" => "Music"
197
+ # }, {
198
+ # "category_id" => "near-protocol-ecosystem",
199
+ # "name" => "Near Protocol Ecosystem"
200
+ # }, {
201
+ # "category_id" => "nft-index",
202
+ # "name" => "NFT Index"
203
+ # }, {
204
+ # "category_id" => "niftex-shards",
205
+ # "name" => "Niftex Shards"
206
+ # }, {
207
+ # "category_id" => "non-fungible-tokens-nft",
208
+ # "name" => "Non-Fungible Tokens (NFT)"
209
+ # }, {
210
+ # "category_id" => "number",
211
+ # "name" => "Number"
212
+ # }, {
213
+ # "category_id" => "decentralized-options",
214
+ # "name" => "Options"
215
+ # }, {
216
+ # "category_id" => "oracle",
217
+ # "name" => "Oracle"
218
+ # }, {
219
+ # "category_id" => "other",
220
+ # "name" => "Other"
221
+ # }, {
222
+ # "category_id" => "decentralized-perpetuals",
223
+ # "name" => "Perpetuals"
224
+ # }, {
225
+ # "category_id" => "dot-ecosystem",
226
+ # "name" => "Polkadot Ecosystem"
227
+ # }, {
228
+ # "category_id" => "polygon-ecosystem",
229
+ # "name" => "Polygon Ecosystem"
230
+ # }, {
231
+ # "category_id" => "prediction-markets",
232
+ # "name" => "Prediction Markets"
233
+ # }, {
234
+ # "category_id" => "privacy-coins",
235
+ # "name" => "Privacy Coins"
236
+ # }, {
237
+ # "category_id" => "protocol",
238
+ # "name" => "Protocol"
239
+ # }, {
240
+ # "category_id" => "real-estate",
241
+ # "name" => "Real Estate"
242
+ # }, {
243
+ # "category_id" => "rebase-tokens",
244
+ # "name" => "Rebase Tokens"
245
+ # }, {
246
+ # "category_id" => "reddit-points",
247
+ # "name" => "Reddit Points"
248
+ # }, {
249
+ # "category_id" => "remittance",
250
+ # "name" => "Remittance"
251
+ # }, {
252
+ # "category_id" => "retail",
253
+ # "name" => "Retail"
254
+ # }, {
255
+ # "category_id" => "seigniorage",
256
+ # "name" => "Seigniorage"
257
+ # }, {
258
+ # "category_id" => "smart-contract-platform",
259
+ # "name" => "Smart Contract Platform"
260
+ # }, {
261
+ # "category_id" => "social-money",
262
+ # "name" => "Social Money"
263
+ # }, {
264
+ # "category_id" => "software",
265
+ # "name" => "Software"
266
+ # }, {
267
+ # "category_id" => "solana-ecosystem",
268
+ # "name" => "Solana Ecosystem"
269
+ # }, {
270
+ # "category_id" => "sports",
271
+ # "name" => "Sports"
272
+ # }, {
273
+ # "category_id" => "stablecoins",
274
+ # "name" => "Stablecoins"
275
+ # }, {
276
+ # "category_id" => "storage",
277
+ # "name" => "Storage"
278
+ # }, {
279
+ # "category_id" => "synthetic-assets",
280
+ # "name" => "Synthetic Issuer"
281
+ # }, {
282
+ # "category_id" => "synths",
283
+ # "name" => "Synths"
284
+ # }, {
285
+ # "category_id" => "technology-science",
286
+ # "name" => "Technology & Science"
287
+ # }, {
288
+ # "category_id" => "terra-ecosystem",
289
+ # "name" => "Terra Ecosystem"
290
+ # }, {
291
+ # "category_id" => "tokenized-btc",
292
+ # "name" => "Tokenized BTC"
293
+ # }, {
294
+ # "category_id" => "tokenized-gold",
295
+ # "name" => "Tokenized Gold"
296
+ # }, {
297
+ # "category_id" => "tokenized-products",
298
+ # "name" => "Tokenized Products"
299
+ # }, {
300
+ # "category_id" => "tokensets",
301
+ # "name" => "TokenSets"
302
+ # }, {
303
+ # "category_id" => "tourism",
304
+ # "name" => "Tourism"
305
+ # }, {
306
+ # "category_id" => "usd-stablecoin",
307
+ # "name" => "USD Stablecoin"
308
+ # }, {
309
+ # "category_id" => "us-election-2020",
310
+ # "name" => "US Election 2020"
311
+ # }, {
312
+ # "category_id" => "utokens",
313
+ # "name" => "uTokens"
314
+ # }, {
315
+ # "category_id" => "virtual-reality",
316
+ # "name" => "Virtual Reality"
317
+ # }, {
318
+ # "category_id" => "wallets",
319
+ # "name" => "Wallets"
320
+ # }, {
321
+ # "category_id" => "wrapped-tokens",
322
+ # "name" => "Wrapped-Tokens"
323
+ # }, {
324
+ # "category_id" => "yearn-yfi-partnerships-mergers",
325
+ # "name" => "Yearn Ecosystem"
326
+ # }, {
327
+ # "category_id" => "yield-aggregator",
328
+ # "name" => "Yield Aggregator"
329
+ # }, {
330
+ # "category_id" => "yield-farming",
331
+ # "name" => "Yield Farming"
332
+ # }]
333
+ def get_categories
334
+ get('coins/categories/list')
335
+ end
336
+
337
+ # Fetches the list of coin categories with its respective market data.
338
+ #
339
+ # @return [Array<Hash>] each category's id, name, and market data
340
+ #
341
+ # @example Get all coin categories with market data.
342
+ # client.get_categories_with_market_data
343
+ # @example Response object
344
+ # [{
345
+ # "id" => "exchange-based-tokens",
346
+ # "name" => "Exchange-based Tokens",
347
+ # "market_cap" => 169371736001.31586,
348
+ # "market_cap_change_24h" => -0.0922414270544203,
349
+ # "volume_24h" => 15951052818.441586,
350
+ # "updated_at" => "2021-05-16T08:20:23.151Z"
351
+ # },
352
+ # {
353
+ # "id" => "decentralized-finance-defi",
354
+ # "name" => "Decentralized Finance (DeFi)",
355
+ # "market_cap" => 136820578041.49733,
356
+ # "market_cap_change_24h" => -0.9466181422841903,
357
+ # "volume_24h" => 14287923081.250826,
358
+ # "updated_at" => "2021-05-16T08:20:20.877Z"
359
+ # },
360
+ # {
361
+ # "id" => "centralized-exchange-token-cex",
362
+ # "name" => "Centralized Exchange Token (CEX)",
363
+ # "market_cap" => 122947523197.55856,
364
+ # "market_cap_change_24h" => 0.26640274656563356,
365
+ # "volume_24h" => 11040737416.224226,
366
+ # "updated_at" => "2021-05-16T08:20:06.231Z"
367
+ # },
368
+ # {
369
+ # "id" => "binance-smart-chain",
370
+ # "name" => "Binance Smart Chain Ecosystem",
371
+ # "market_cap" => 116361546228.1391,
372
+ # "market_cap_change_24h" => 0.4826745508659215,
373
+ # "volume_24h" => 16613002144.076551,
374
+ # "updated_at" => "2021-05-16T08:20:18.419Z"
375
+ # },
376
+ # {
377
+ # "id" => "stablecoins",
378
+ # "name" => "Stablecoins",
379
+ # "market_cap" => 97325984356.89694,
380
+ # "market_cap_change_24h" => -0.0875726509433792,
381
+ # "volume_24h" => 200476835791.99164,
382
+ # "updated_at" => "2021-05-16T08:20:24.440Z"
383
+ # },
384
+ # {
385
+ # "id" => "dot-ecosystem",
386
+ # "name" => "Polkadot Ecosystem",
387
+ # "market_cap" => 80036030929.50584,
388
+ # "market_cap_change_24h" => -2.095750731441014,
389
+ # "volume_24h" => 9976746509.269482,
390
+ # "updated_at" => "2021-05-16T08:20:20.395Z"
391
+ # },
392
+ # {
393
+ # "id" => "governance",
394
+ # "name" => "Governance",
395
+ # "market_cap" => 61646638642.600464,
396
+ # "market_cap_change_24h" => -1.6030575560698792,
397
+ # "volume_24h" => 7027881997.164181,
398
+ # "updated_at" => "2021-05-16T08:20:22.367Z"
399
+ # },
400
+ # ]
401
+ def get_categories_with_market_data
402
+ get('coins/categories')
403
+ end
404
+ end
405
+ end
406
+ end