coinmarketcap.rb 0.5.0 → 0.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 062b9e78e37727a2772e8d0264347b7ae0a96379059aa3d7e1f7411b34a444f5
4
- data.tar.gz: d502d3d41cdc431475dfb0e6531ebfa0108f4ffa734fae2d8c12910f03cca5ee
3
+ metadata.gz: 4e2248fec84988c40e7973c1ada6f06019f2d1c07a5570af95c469a49de2afd2
4
+ data.tar.gz: 3f030d0f7b25646ceba951e3c5271586f14794db38913e7b9d5dfc965f9c47ea
5
5
  SHA512:
6
- metadata.gz: 2e0e470c2dbc0494817f5b5fae1ef0e9ec546f4201ab56cd0729096413a6b5860b1e1cdf6864e7edf523a6826044e3be7f97f446cca9bb42b58430db7fc10480
7
- data.tar.gz: 5afc30240b2f1be31cfc65be047a83e37c5217089a2fa2f90f6b51ccb1b2fdb3c67102eeba3b2a5b9597624c2ec4edbf355f3674ce6dcd32118d776cf6b3c4fc
6
+ metadata.gz: 53aad33c51a71a6ef91f919bf5050c2925e12cc37ff5742c19843c8c2eb1b8def3e8d8e67762d14785bb654b9b4195530a83e2405c627158157b9a50ff83bbdc
7
+ data.tar.gz: 3e7173c834af80b8004d4627c425c085144502d849dacc0c9d47105943f06792eca95a913af96f69eab187b0f16ffabdfb6b8b40d2032922d87208c5a893831f
@@ -2,9 +2,7 @@ require_relative './lib/CoinMarketCap/VERSION'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'coinmarketcap.rb'
5
-
6
5
  spec.version = CoinMarketCap::VERSION
7
- spec.date = '2025-05-13'
8
6
 
9
7
  spec.summary = "Access the coinmarketcap.com API with Ruby."
10
8
  spec.description = "Access the coinmarketcap.com API with Ruby."
@@ -26,57 +26,96 @@ module CoinMarketCap
26
26
 
27
27
  class << self
28
28
  def path_prefix
29
- '/v1/cryptocurrency'
29
+ '/v1'
30
30
  end
31
31
  end # class << self
32
32
 
33
+ # /cryptocurrency
34
+
33
35
  def airdrop(id:)
34
- response = get(path: '/airdrop', args: {id: id})
36
+ response = get(path: '/cryptocurrency/airdrop', args: {id: id})
35
37
  handle_response(response)
36
38
  end
37
39
 
38
40
  def airdrops
39
- response = get(path: '/airdrops')
41
+ response = get(path: '/cryptocurrency/airdrops')
40
42
  handle_response(response)
41
43
  end
42
44
 
43
45
  def categories
44
- response = get(path: '/categories')
46
+ response = get(path: '/cryptocurrency/categories')
45
47
  handle_response(response)
46
48
  end
47
49
 
48
50
  def category(id:)
49
- response = get(path: '/category', args: {id: id})
51
+ response = get(path: '/cryptocurrency/category', args: {id: id})
50
52
  handle_response(response)
51
53
  end
52
54
 
53
55
  def listings_historical
54
- response = get(path: '/listings/historical')
56
+ response = get(path: '/cryptocurrency/listings/historical')
55
57
  handle_response(response)
56
58
  end
57
59
 
58
60
  def listings_latest(**args)
59
- response = get(path: '/listings/latest', args: args)
61
+ response = get(path: '/cryptocurrency/listings/latest', args: args)
60
62
  handle_response(response)
61
63
  end
62
64
 
63
65
  def map
64
- response = get(path: '/map')
66
+ response = get(path: '/cryptocurrency/map')
65
67
  handle_response(response)
66
68
  end
67
69
 
68
70
  def trending_gainers_losers
69
- response = get(path: '/trending/gainers-losers')
71
+ response = get(path: '/cryptocurrency/trending/gainers-losers')
70
72
  handle_response(response)
71
73
  end
72
74
 
73
75
  def trending_latest
74
- response = get(path: '/trending/latest')
76
+ response = get(path: '/cryptocurrency/trending/latest')
75
77
  handle_response(response)
76
78
  end
77
79
 
78
80
  def trending_most_visited
79
- response = get(path: '/trending/most-visited')
81
+ response = get(path: '/cryptocurrency/trending/most-visited')
82
+ handle_response(response)
83
+ end
84
+
85
+ # /exchange
86
+
87
+ def exchange_assets(id:)
88
+ response = get(path: '/exchange/assets', args: {id: id})
89
+ handle_response(response)
90
+ end
91
+
92
+ def exchange_info(**args)
93
+ response = get(path: '/exchange/info', args: args)
94
+ handle_response(response)
95
+ end
96
+
97
+ def exchange_map(**args)
98
+ response = get(path: "/exchange/map", args: args)
99
+ handle_response(response)
100
+ end
101
+
102
+ def exchange_listings_latest(**args)
103
+ response = get(path: "/exchange/listings/latest", args: args)
104
+ handle_response(response)
105
+ end
106
+
107
+ def exchange_market_pairs_latest(**args)
108
+ response = get(path: "/exchange/market-pairs/latest", args: args)
109
+ handle_response(response)
110
+ end
111
+
112
+ def exchange_quotes_historical(**args)
113
+ response = get(path: "/exchange/quotes/historical", args: args)
114
+ handle_response(response)
115
+ end
116
+
117
+ def exchange_quotes_latest(**args)
118
+ response = get(path: "/exchange/quotes/latest", args: args)
80
119
  handle_response(response)
81
120
  end
82
121
  end
@@ -2,5 +2,5 @@
2
2
  # CoinMarketCap::VERSION
3
3
 
4
4
  module CoinMarketCap
5
- VERSION = '0.5.0'
5
+ VERSION = '0.6.0'
6
6
  end
@@ -137,6 +137,81 @@ describe CoinMarketCap::V1::Client do
137
137
  end
138
138
  end
139
139
 
140
+ describe "#exchange_assets" do
141
+ it "returns exchange assets" do
142
+ VCR.use_cassette('v1/exchange/assets') do
143
+ response = client.exchange_assets(id: 270)
144
+ _(response).must_include('data')
145
+ end
146
+ end
147
+ end
148
+
149
+ describe "#exchange_info" do
150
+ it "returns exchange info" do
151
+ VCR.use_cassette('v1/exchange/info') do
152
+ response = client.exchange_info(slug: 'binance,gdax')
153
+ _(response).must_include('data')
154
+ end
155
+ end
156
+ end
157
+
158
+ describe "#exchange_map" do
159
+ it "returns exchange map" do
160
+ VCR.use_cassette('v1/exchange/map') do
161
+ response = client.exchange_map
162
+ _(response).must_include('data')
163
+ end
164
+ end
165
+ end
166
+
167
+ describe "#exchange_listings_latest" do
168
+ it "returns latest exchange listings" do
169
+ VCR.use_cassette('v1/exchange/listings/latest') do
170
+ assert_raises CoinMarketCap::Error do
171
+ response = client.exchange_listings_latest
172
+ # _(response).must_include('data')
173
+ _(JSON.parse(response.body).dig('status', 'error_message')).must_equal "Your API Key subscription plan doesn't support this endpoint."
174
+ end
175
+ end
176
+ end
177
+ end
178
+
179
+ describe "#exchange_market_pairs_latest" do
180
+ it "returns latest exchange market pairs" do
181
+ VCR.use_cassette('v1/exchange/market-pairs/latest') do
182
+ assert_raises CoinMarketCap::Error do
183
+ response = client.exchange_market_pairs_latest(id: '1')
184
+ # _(response).must_include('data')
185
+ _(JSON.parse(response.body).dig('status', 'error_message')).must_equal "Your API Key subscription plan doesn't support this endpoint."
186
+ end
187
+ end
188
+ end
189
+ end
190
+
191
+ describe "#exchange_quotes_historical" do
192
+ it "returns historical exchange quotes" do
193
+ VCR.use_cassette('v1/exchange/quotes/historical') do
194
+ assert_raises CoinMarketCap::Error do
195
+ response = client.exchange_quotes_historical(id: '1')
196
+ # _(response).must_include('data')
197
+ _(JSON.parse(response.body).dig('status', 'error_message')).must_equal "Your API Key subscription plan doesn't support this endpoint."
198
+ end
199
+ end
200
+ end
201
+ end
202
+
203
+ describe "#exchange_quotes_latest" do
204
+ it "returns latest exchange quotes" do
205
+ VCR.use_cassette('v1/exchange/quotes/latest') do
206
+ assert_raises CoinMarketCap::Error do
207
+ response = client.exchange_quotes_latest(id: '1')
208
+ # _(response).must_include('data')
209
+ _(JSON.parse(response.body).dig('status', 'error_message')).must_equal "Your API Key subscription plan doesn't support this endpoint."
210
+ end
211
+ end
212
+ end
213
+ end
214
+
140
215
  describe "#handle_response" do
141
216
  it "handles a successful response" do
142
217
  raw_response = OpenStruct.new(success?: true, body: '{"data": {}}')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coinmarketcap.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoran
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: http.rb
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  requirements: []
64
- rubygems_version: 3.6.8
64
+ rubygems_version: 4.0.6
65
65
  specification_version: 4
66
66
  summary: Access the coinmarketcap.com API with Ruby.
67
67
  test_files: []