coin_market_capitalization 0.1.1 → 0.1.2
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/README.md +83 -3
- data/lib/coin_market_capitalization/base.rb +1 -1
- data/lib/coin_market_capitalization/version.rb +1 -1
- data/lib/coin_market_capitalization.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ca9fc299aa065f9502d4cdddcc829ab5eba17682f17ca14930f53f2c9416636
|
4
|
+
data.tar.gz: d4557b7c2d02df5427172c48a9caf6ef833a98bc4c97243979d7f1fb78b3c523
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 117b758c6ad9494a6978ae1ca995153ce2e33cf990008eb2c8c315036c7e4627d58b0ae173d9aca2983de0171b0a3dc2744dc698d14fb14f356d9d7b61c7f66c
|
7
|
+
data.tar.gz: ce62ac4019af07c4debd672bf94391c7c51985240f7945d412c1e06135bb5d2664485e466fe905f74351315bd10bb886cf93f4b7ff1ebeb3d5e7a8af1b5fdba6
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[](https://rubystyle.guide)
|
3
3
|
[](https://github.com/enowmbi/coin_market_capitalization_ruby/actions/workflows/ruby.yml)
|
4
4
|
|
5
|
-
#
|
5
|
+
# CoinMarketCapitalization
|
6
6
|
Ruby client library for accessing Coin Market Cap API.
|
7
7
|
|
8
8
|
## Installation
|
@@ -16,8 +16,88 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
16
16
|
$ gem install coin_market_capitalization
|
17
17
|
|
18
18
|
## Usage
|
19
|
-
|
20
|
-
|
19
|
+
### Initialisation
|
20
|
+
The "api_key", "base_url" and an "adapter" are parameters used in the initialisation method. There is a default base_url and adapter provided for each class so you don't need to specify it when you create an object.You can use a different base_url and/or adapter when calling the initialisation method.
|
21
|
+
```ruby
|
22
|
+
BASE_URL = "https://pro-api.coinmarketcap.com/v1/blockchain"
|
23
|
+
|
24
|
+
def initialize(api_key:, base_url: BASE_URL, adapter: Faraday.default_adapter)
|
25
|
+
@api_key = api_key
|
26
|
+
@base_url = base_url
|
27
|
+
@adapter = adapter
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
### Available Classes(Representing endpoint Categories)
|
32
|
+
### 1. Cryptocurrency
|
33
|
+
Represents the "cryptocurrency" endpoint category.
|
34
|
+
This class contains methods (representing endpoints) that return data around cryptocurrencies such as ordered cryptocurrency lists or price and volume data.
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
cryptocurrency = CoinMarketCapitalization::Cryptocurrency.new(api_key: "PUT_YOUR_API_KEY_HERE")
|
38
|
+
cryptocurrency.listings_latest
|
39
|
+
# represents "/cryptocurrency/listings/latest" - Returns a paginated list of all active cryptocurrencies with latest market data.
|
40
|
+
```
|
41
|
+
|
42
|
+
### 2. Exchange
|
43
|
+
Represents the "exchange" endpoint category.
|
44
|
+
This class has methods (representing endpoints) that return data around cryptocurrency exchanges such as ordered exchange lists and market pair data.
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
exchange = CoinMarketCapitalization::Exchange.new(api_key: "PUT_YOUR_API_KEY_HERE")
|
48
|
+
exchange.quotes_latest
|
49
|
+
# represents "/exchange/quotes/latest" - Returns the latest aggregate market data for 1 or more exchanges.
|
50
|
+
```
|
51
|
+
|
52
|
+
### 3. GlobalMetrics
|
53
|
+
Represents the "global-metrics" endpoint category.
|
54
|
+
This class has methods (representing endpoints) that return aggregate market data such as global market cap and BTC dominance.
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
global_metrics = CoinMarketCapitalization::GlobalMetrics.new(api_key: "PUT_YOUR_API_KEY_HERE")
|
58
|
+
global_metrics.quotes_latest
|
59
|
+
# represents "/global-metrics/quotes/latest" - Returns the latest global cryptocurrency market metrics
|
60
|
+
```
|
61
|
+
|
62
|
+
### 4. Blockchain
|
63
|
+
Represents the "blockchain" endpoint category.
|
64
|
+
This class has methods (representing endpoints) that return data block explorer related data for blockchains
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
blockchain = CoinMarketCapitalization::Blockchain.new(api_key: "PUT_YOUR_API_KEY_HERE")
|
68
|
+
blockchain.statistics_latest
|
69
|
+
# represents "/blockchain/statistics/latest" - Returns the latest blockchain statistics data for 1 or more blockchains. Bitcoin, Litecoin, and Ethereum are currently supported.
|
70
|
+
```
|
71
|
+
|
72
|
+
### 5. Fiat
|
73
|
+
Represents the "fiat" endpoint category.
|
74
|
+
This class has methods (representing endpoints) that return data around fiats currencies including mapping to CMC IDs.
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
fiat = CoinMarketCapitalization::Fiat.new(api_key: "PUT_YOUR_API_KEY_HERE")
|
78
|
+
fiat.map
|
79
|
+
# represents "/fiat/map" - Returns a mapping of all supported fiat currencies to unique CoinMarketCap ids
|
80
|
+
```
|
81
|
+
|
82
|
+
### 6. Content
|
83
|
+
Represents the "content" endpoint category.
|
84
|
+
This class has methods (representing endpoints) that return cryptocurrency-related news, headlines, articles, posts, and comments.
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
content = CoinMarketCapitalization::Content.new(api_key: "PUT_YOUR_API_KEY_HERE")
|
88
|
+
content.latest
|
89
|
+
# represents "/content/latest" - Returns a paginated list of content pulled from CMC News/Headlines and Alexandria articles.
|
90
|
+
```
|
91
|
+
|
92
|
+
### 7. key
|
93
|
+
Represents the "key" endpoint category.
|
94
|
+
This class has methods (representing endpoints) for API key administration (to review and manage your usage).
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
key = CoinMarketCapitalization::Key.new(api_key: "PUT_YOUR_API_KEY_HERE")
|
98
|
+
key.info
|
99
|
+
# represents "/key/info" - Returns API key details and usage stats.
|
100
|
+
```
|
21
101
|
|
22
102
|
## Development
|
23
103
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative "coin_market_capitalization/version"
|
4
4
|
|
5
|
-
#
|
5
|
+
# CoinMarketCapitalization - autoload classes
|
6
6
|
module CoinMarketCapitalization
|
7
7
|
autoload(:Base, "coin_market_capitalization/base")
|
8
8
|
autoload(:Cryptocurrency, "coin_market_capitalization/cryptocurrency")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coin_market_capitalization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Enow Mbi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|