coinmarketcap_free 0.3.0 → 0.4.1

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: 552fa8d6dc0bd48c3d3038139498e4c87df3e593411d18cd0ca669e3257f3d43
4
- data.tar.gz: e53685f824b0cf866cf8e0e7b0e29ffd235f37930253d56da98eff8c3416e7cc
3
+ metadata.gz: 75e112c92ffd0e8f5692d2497af36cc97bf9df213219a47b974f13f6d3d21558
4
+ data.tar.gz: 244626426b7fb8a930c71d8b5ff468e39b22fffc476151c944c19e2af9c1c0d2
5
5
  SHA512:
6
- metadata.gz: 9771e08a82dcf2314d982c763ab1f6a230efa16bde1ca684cb4ec30a0b562fac29a027180cabeaa24a87df4280d19981e882dbf0565688950cd9fac0a448af7e
7
- data.tar.gz: c33962fc9682813b91eea1177e53b7325d1b578c66a0c76f0357d1478493fbf0438168e8c876e59ad6c77c439e53bbcbaf758dd98603c511809bb8d687df9642
6
+ metadata.gz: c23c10123ee29cb2e3db88477123abae457575357d8e173bfacf7df2ee8c8b9199382e828fc1d416e556758eacab7b73ba0c7bdfeabca1675b324a571d6267c9
7
+ data.tar.gz: 211ee8c04dd9995e19a760c84f75da00ef726995e35e03db44847f423315652f14ae9b2f1a7a71cfd1dd0a75336fb1f7887192e66842774d1006499e869ae280
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coinmarketcap_free (0.3.0)
4
+ coinmarketcap_free (0.4.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -28,4 +28,4 @@ DEPENDENCIES
28
28
  uri (~> 0.12.1)
29
29
 
30
30
  BUNDLED WITH
31
- 2.4.20
31
+ 2.5.3
data/README.md CHANGED
@@ -18,6 +18,12 @@ If bundler is not being used to manage dependencies, install the gem by executin
18
18
  list = CoinmarketcapFree::Coin.list
19
19
  ```
20
20
 
21
+ or short
22
+
23
+ ``` Ruby
24
+ list = CoinmarketcapFree::coins
25
+ ```
26
+
21
27
  Result:
22
28
  ``` JSON
23
29
  {
@@ -153,6 +159,13 @@ coin = CoinmarketcapFree::CoinHistory.custom_time(1, '1D')
153
159
  coin = CoinmarketcapFree::CoinHistory.custom_time(1, '1668981600~1671659999')
154
160
  ```
155
161
 
162
+ or short
163
+
164
+ ``` Ruby
165
+ coin = CoinmarketcapFree.coin_history(1, '1D')
166
+ coin = CoinmarketcapFree.coin_history(1, '1668981600~1671659999')
167
+ ```
168
+
156
169
  or
157
170
 
158
171
  ``` Ruby
@@ -6,7 +6,7 @@ module CoinmarketcapFree
6
6
  class << self
7
7
  # Generate URI image of a coin
8
8
  #
9
- # logo = CoinmarketcapFree::Icon.img_coin(1, 64)
9
+ # logo = CoinmarketcapFree::Icon.generate_url(1, 64)
10
10
  #
11
11
  # Result:
12
12
  # "https://s2.coinmarketcap.com/static/img/coins/64x64/1.png"
@@ -3,8 +3,8 @@
3
3
  # Get data from Coinmarketcap API without requiring an API key.
4
4
  module CoinmarketcapFree
5
5
  MAJOR = 0
6
- MINOR = 3
7
- PATCH = 0
6
+ MINOR = 4
7
+ PATCH = 1
8
8
 
9
9
  private_constant :MAJOR, :MINOR, :PATCH
10
10
 
@@ -7,4 +7,97 @@ require_relative 'coinmarketcap_free/version'
7
7
 
8
8
  # Get data from Coinmarketcap API without requiring an API key.
9
9
  module CoinmarketcapFree
10
- end
10
+ class << self
11
+ # Get a list of cryptocurrencies
12
+ #
13
+ # list = CoinmarketcapFree.coins(limit: 100, start: 1)
14
+ #
15
+ # If you want to sort in ascending, just write parameter:
16
+ #
17
+ # list = CoinmarketcapFree.coins(limit: 100, start: 1, sort_type:'asc')
18
+ #
19
+ # or
20
+ #
21
+ # list = CoinmarketcapFree.coins(limit: 100, start: 1, sort_type:'desc')
22
+ #
23
+ # You can also adding sort by:
24
+ #
25
+ # list = CoinmarketcapFree.coins(limit: 100, start: 1, sort_type:'asc', sort_by: 'name')
26
+ #
27
+ # Convert cryptocurrency to::
28
+ #
29
+ # list = CoinmarketcapFree.coins(limit: 100, start: 1, convert: 'USD,BTC,ETH')
30
+ #
31
+ # Also you can use this method like this:
32
+ #
33
+ # list = CoinmarketcapFree.coins(limit: 100, start: 1, convert: 'USD,BTC,ETH') do |data|
34
+ # JSON.parse(data)
35
+ # end
36
+ #
37
+ #
38
+ # @param start [Integer] Optionally offset the start (1-based index) of the paginated list of items to return.
39
+ # @param limit [Integer] Optionally specify the number of results to return. Use this parameter and the 'start' parameter to determine your own pagination size.
40
+ # @param sort_by [String] What field to sort the list of cryptocurrencies by. ('rank', 'name', 'symbol', 'date_added', 'market_cap', 'market_cap_strict', 'price', 'circulating_supply', 'total_supply', 'max_supply', 'num_market_pairs', 'volume_24h', 'percent_change_1h', 'percent_change_24h', 'percent_change_7d', 'market_cap_by_total_supply_strict', 'volume_7d', 'volume_30d")
41
+ # @param sort_type [String] The direction in which to order cryptocurrencies against the specified sort. ('asc', 'desc')
42
+ # @param convert [String] Select cryptocurrencies to exchange ('AUD', 'BRL', 'CAD', 'CHF', 'CLP', 'CNY', 'CZK', 'DKK', 'EUR', 'GBP', 'HKD', 'HUF', 'IDR', 'ILS', 'INR', 'JPY', 'KRW', 'MXN', 'MYR', 'NOK', 'NZD', 'PHP', 'PKR', 'PLN', 'RUB', 'SEK', 'SGD', 'THB', 'TRY', 'TWD', 'ZAR'). For example, many 'USD,BTC,ETH' to convert or only one 'USD'
43
+ # @param crypto_type [String] The type of cryptocurrency to include. ('all', 'coins', 'tokens')
44
+ # @param tag_type [String] The tag of cryptocurrency to include. ('all', 'defi', 'filesharing')
45
+ # @param audited [TrueClass, FalseClass] Show audited 'true' or not 'false'
46
+ # @param aux [String] Optionally specify a comma-separated list of supplemental data fields to return. Pass 'ath, atl, high24h, low24h, num_market_pairs, cmc_rank, date_added, max_supply, circulating_supply, total_supply, volume_7d, volume_30d, self_reported_circulating_supply, self_reported_market_cap' to include all auxiliary fields.
47
+ # @param tags [String] If you want to see cryptocurrencies that can be mined, just type 'mineable'.
48
+ # @param volume24h_range [String] Optionally specify a threshold 24 hour USD volume to filter results by. For example, '0~100000000000000000'
49
+ # @param percent_change24h_range [String] Optionally specify a threshold 24 hour percent change to filter results by. For example, '0~100' or '-10~100'
50
+ # @param circulating_supply_range [String] Optionally specify a threshold circulating supply to filter results by. For example, '0~100000000000000000'
51
+ # @param price_range [String] Optionally specify a threshold USD price to filter results by. For example, '0~100000000000000000'
52
+ # @param market_cap_range [String] Optionally specify a threshold market cap to filter results by. For example, '0~100000000000000000'
53
+ # @return [Hash]
54
+ def coins(**params)
55
+ data = Coin.list(**params)
56
+
57
+ return yield data if block_given?
58
+
59
+ JSON.parse(data)
60
+ end
61
+
62
+ # Returns an interval of historic market quotes for any cryptocurrency based on time and interval parameters.
63
+ #
64
+ # You can use one of the following intervals: 1D, 7D, 1M, 3M, 1Y, YTD, ALL
65
+ #
66
+ # history = CoinmarketcapFree.coin_history(1, '1D')
67
+ #
68
+ # Also you can use this method like this:
69
+ #
70
+ # history = CoinmarketcapFree.coin_history(1, '1668981600~1671659999') do |data|
71
+ # JSON.parse(data)
72
+ # end
73
+ #
74
+ # 'data' - Results of your query returned as an object map.
75
+ # 'points' - Price range history
76
+ # 'status' - Standardized status object for API calls.
77
+ #
78
+ # @param id [Integer] Cryptocurrency identifier from coinmarketcap. For example, Bitcoin has the number 1
79
+ # @param range_time [String] Range time. For example, '1D', '7D', '1M', '3M', '1Y', 'YTD', 'ALL' or custom range '1668981600~1671659999'
80
+ # @return [Hash]
81
+ def coin_history(id, range_time)
82
+ data = CoinHistory.custom_time(id, range_time)
83
+
84
+ return yield data if block_given?
85
+
86
+ JSON.parse(data)
87
+ end
88
+
89
+ # Generate URI image of a coin
90
+ #
91
+ # logo = CoinmarketcapFree.coin_icon(1, 64)
92
+ #
93
+ # Result:
94
+ # "https://s2.coinmarketcap.com/static/img/coins/64x64/1.png"
95
+ #
96
+ # @param [Integer] id_coin Identify coin. For example, bitcoin has 1
97
+ # @param [Integer] size Choose one size: 64, 128, 200
98
+ # @return [String] Return URI from coinmarketcap
99
+ def coin_icon(id_coin, size)
100
+ Icon.generate_url(id_coin, size)
101
+ end
102
+ end
103
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coinmarketcap_free
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitalii Bakun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-10 00:00:00.000000000 Z
11
+ date: 2024-02-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Cryptocurrency information from the Coinmarketcap site without a key.
14
14
  email:
@@ -23,7 +23,6 @@ files:
23
23
  - LICENSE.txt
24
24
  - README.md
25
25
  - Rakefile
26
- - coinmarketcap_free.gemspec
27
26
  - lib/coinmarketcap_free.rb
28
27
  - lib/coinmarketcap_free/coin.rb
29
28
  - lib/coinmarketcap_free/coin_history.rb
@@ -52,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
51
  - !ruby/object:Gem::Version
53
52
  version: '0'
54
53
  requirements: []
55
- rubygems_version: 3.4.20
54
+ rubygems_version: 3.5.3
56
55
  signing_key:
57
56
  specification_version: 4
58
57
  summary: Cryptocurrency information from the Coinmarketcap site without a key.
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/coinmarketcap_free/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "coinmarketcap_free"
7
- spec.version = CoinmarketcapFree::VERSION
8
- spec.authors = ["Vitalii Bakun"]
9
- spec.email = ["crossdoh@gmail.com"]
10
-
11
- spec.summary = "Cryptocurrency information from the Coinmarketcap site without a key."
12
- spec.description = "Cryptocurrency information from the Coinmarketcap site without a key."
13
- spec.license = "MIT"
14
- spec.required_ruby_version = ">= 2.7.0"
15
-
16
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
-
18
- spec.metadata["source_code_uri"] = 'https://github.com/vitalii-bakun/coinmarketcap_free'
19
-
20
- # Specify which files should be added to the gem when it is released.
21
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
- spec.files = Dir.chdir(__dir__) do
23
- `git ls-files -z`.split("\x0").reject do |f|
24
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
25
- end
26
- end
27
- spec.bindir = "exe"
28
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
- spec.require_paths = ["lib"]
30
-
31
- # Uncomment to register a new dependency of your gem
32
- # spec.add_dependency "example-gem", "~> 1.0"
33
-
34
- # For more information and examples about making a new gem, check out our
35
- # guide at: https://bundler.io/guides/creating_gem.html
36
- spec.metadata['rubygems_mfa_required'] = 'true'
37
- end