aga-cmc 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 818692734e778568df44f917306f0b1e8f9e4599f6b3ebca18a197526cc31f95
4
+ data.tar.gz: 4c609c8d6fa45c27b195b3495ee4b47c273d23fe92fe0c247c5615f26429da13
5
+ SHA512:
6
+ metadata.gz: b0a072c8e1bba0b4e321e92cb988a747eb2aa97d42ca3c4ba2b2a316d2eba0738876fe01a511477e73447e03c11f364065b3d525dfa58ed4d07335070a3740c4
7
+ data.tar.gz: 82b1ec59babc535fe4288522a57769e8f3d6ef5b85f643eaa3ed4d5def332f53fdc15b4ef27efb1d965b46a3cdee8f4b13867f6b60d2ffe627a63bc31f64db0f
data/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # Aga-cmc
2
+
3
+ Aga request is a Ruby gem that provides a convenient way to make HTTP requests, including passing parameters, headers, and more. It simplifies the process of interacting with APIs and web services and handles the complexities of handling HTTP requests and responses.
4
+
5
+ ## Features
6
+
7
+ - Make GET, POST, PUT, DELETE, and other HTTP requests easily.
8
+ - Pass parameters and headers with the requests.
9
+ - Handle response parsing automatically, returning JSON responses.
10
+ - Get access to the response status, headers, and body.
11
+
12
+ ## Installation
13
+
14
+ Install the gem and add to the application's Gemfile by executing:
15
+
16
+ $ bundle add aga-cmc
17
+
18
+ If bundler is not being used to manage dependencies, install the gem by executing:
19
+
20
+ $ gem install aga-cmc
21
+
22
+ ## Usage
23
+
24
+ To use Aga-request in your application, require the gem and start making requests. Here's a basic example:
25
+
26
+ ```
27
+ require 'cmc'
28
+
29
+ r = Request::Http.new
30
+ response = r.get('https://api.example.com/resource', { 'key' => 'value' }, { 'Authorization' => 'Bearer TOKEN' })
31
+
32
+ puts response[:status] # Output: true or false
33
+ puts response[:response] # Output: {"data": "example"}
34
+
35
+ ```
36
+
37
+ ## Contributing
38
+
39
+ Contributions to Aga-request are welcome! If you encounter any issues or have suggestions for improvements, please submit an issue on the repository. Pull requests are also encouraged.
40
+
41
+
42
+ ## Private License
43
+
44
+ Version 0.0.2, 01/06/2023
45
+
46
+ By obtaining a copy of this software and associated documentation files (the "Software"), you agree that the Software is proprietary to AIGreenAnt and is protected under intellectual property laws. This license grants you limited rights to use the Software solely for internal purposes within your organization.
47
+
48
+ 1. License Grant
49
+
50
+ 1.1 You are granted a non-exclusive, non-transferable license to use the Software for internal purposes only.
51
+
52
+ 1.2 You may not distribute, sublicense, sell, or transfer the Software to any third party without prior written permission from AIGreenAnt.
53
+
54
+ 2. Intellectual Property
55
+
56
+ 2.1 The Software and any associated intellectual property rights, including but not limited to copyrights, patents, trademarks, trade secrets, and any other proprietary rights, are and shall remain the exclusive property of AIGreenAnt.
57
+
58
+ 2.2 You may not remove, alter, or obscure any proprietary notices or labels on the Software.
59
+
60
+ 3. Limitation of Liability
61
+
62
+ 3.1 In no event shall AIGreenAnt be liable for any direct, indirect, incidental, special, or consequential damages arising out of the use or inability to use the Software, even if AIGreenAnt has been advised of the possibility of such damages.
63
+
64
+ 4. Termination
65
+
66
+ 4.1 This license is effective until terminated. AIGreenAnt may terminate this license at any time if you fail to comply with the terms and conditions of this agreement.
67
+
68
+ 4.2 Upon termination, you must immediately cease all use of the Software and destroy all copies in your possession or control.
69
+
70
+ 5. Governing Law
71
+
72
+ 5.1 This license shall be governed by and construed in accordance with the laws of Italy, without regard to its conflict of laws principles.
73
+
74
+ By using the Software, you acknowledge that you have read and understood this license agreement and agree to be bound by its terms and conditions.
75
+
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'zeitwerk'
4
+
5
+ module Cmc
6
+ class Autoloader
7
+ class Inflector < ::Zeitwerk::Inflector
8
+ INFLECTIONS_MAP = {
9
+ version: 'VERSION'
10
+ }.freeze
11
+
12
+ def camelize(basename, _abspath)
13
+ INFLECTIONS_MAP[basename.to_sym] || super
14
+ end
15
+ end
16
+
17
+ class << self
18
+ LIB_PATH = ::File.dirname(__dir__).freeze
19
+
20
+ def setup!
21
+ loader = ::Zeitwerk::Loader.new
22
+ loader.tag = 'cmc'
23
+ loader.inflector = Inflector.new
24
+ loader.push_dir(LIB_PATH)
25
+ loader.collapse(::File.join(LIB_PATH, 'cmc', 'resources'))
26
+
27
+ ignored_paths.each { |path| loader.ignore(path) }
28
+
29
+ loader.setup
30
+ end
31
+
32
+ private
33
+
34
+ def ignored_paths
35
+ [
36
+ ::File.join(LIB_PATH, 'cmc', 'patches')
37
+ ].freeze
38
+ end
39
+ end
40
+ end
41
+ end
data/lib/cmc/base.rb ADDED
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'request'
4
+ require 'uri'
5
+
6
+ module Cmc
7
+ class Base
8
+ class << self
9
+ attr_accessor :app_info, :path_prefix
10
+
11
+ def initialize; end
12
+
13
+ def request
14
+ Request::Http.new
15
+ end
16
+
17
+ def headers
18
+ { 'Content-Type' => 'application/json' }
19
+ end
20
+
21
+ private
22
+
23
+ def build_url(path, params)
24
+ query = URI.encode_www_form(params)
25
+ "#{Cmc::Base.path_prefix}#{path}?#{query}"
26
+ end
27
+ end
28
+
29
+ self.app_info = ::ENV['APP_INFO'] || "#{::Cmc::NAME} V#{::Cmc.version}"
30
+ self.path_prefix = 'https://api.coinmarketcap.com/data-api/v3/cryptocurrency/market-pairs/latest'
31
+ end
32
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cmc
4
+ class Exchange
5
+ LIMIT = 1000
6
+
7
+ def initialize(params = {})
8
+ @slug = params.fetch(:slug, 'bitcoin')
9
+ @quote = params.fetch(:quote, 825)
10
+
11
+ @start = params.fetch(:start, 1)
12
+ @limit = params.fetch(:limit, LIMIT)
13
+ end
14
+
15
+ def list
16
+ url = Cmc::Base.send(:build_url, '', slug: @slug, start: @start,
17
+ quoteCurrencyId: @quote, limit: @limit, category: 'spot',
18
+ centerType: 'all', sort: 'cmc_rank_advanced')
19
+ Cmc::Base.request.get(url, headers: Cmc::Base.headers)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cmc
4
+ VERSION = '0.0.0'
5
+ end
data/lib/cmc.rb ADDED
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './cmc/autoloader'
4
+
5
+ module Cmc
6
+ NAME = 'Cmc Ruby'
7
+
8
+ @mutex = ::Mutex.new
9
+
10
+ class << self
11
+ def app_info=(value)
12
+ ::Cmc::Base.app_info = value
13
+ end
14
+
15
+ def path_prefix=(value)
16
+ ::Cmc::Base.path_prefix = value
17
+ end
18
+
19
+ def ping
20
+ { status: 200 }
21
+ end
22
+
23
+ def version
24
+ VERSION
25
+ end
26
+ end
27
+ end
28
+
29
+ ::Cmc::Autoloader.setup!
metadata ADDED
@@ -0,0 +1,217 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aga-cmc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Stefano Baldazzi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-06-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: zeitwerk
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 7.0.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 7.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bump
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: digest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.1.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.1.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: faraday
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.7'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.7'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '13.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '13.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.8'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.8'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.16'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.16'
139
+ - !ruby/object:Gem::Dependency
140
+ name: webmock
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '3.0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '3.0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: aga-request
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.0.2
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 0.0.2
167
+ - !ruby/object:Gem::Dependency
168
+ name: pry
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.14'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.14'
181
+ description: Aga cmc Ruby is a lightweight gem for call CoinMarketCap API.
182
+ email:
183
+ - stefanobaldazzi40@gmail.com
184
+ executables: []
185
+ extensions: []
186
+ extra_rdoc_files: []
187
+ files:
188
+ - README.md
189
+ - lib/cmc.rb
190
+ - lib/cmc/autoloader.rb
191
+ - lib/cmc/base.rb
192
+ - lib/cmc/resources/exchange.rb
193
+ - lib/cmc/version.rb
194
+ homepage: https://github.com/Baldaz02/aga-cmc-ruby
195
+ licenses:
196
+ - MIT
197
+ metadata: {}
198
+ post_install_message:
199
+ rdoc_options: []
200
+ require_paths:
201
+ - lib
202
+ required_ruby_version: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - ">="
205
+ - !ruby/object:Gem::Version
206
+ version: '2.7'
207
+ required_rubygems_version: !ruby/object:Gem::Requirement
208
+ requirements:
209
+ - - ">="
210
+ - !ruby/object:Gem::Version
211
+ version: '0'
212
+ requirements: []
213
+ rubygems_version: 3.3.24
214
+ signing_key:
215
+ specification_version: 4
216
+ summary: cmc v-0.0.0
217
+ test_files: []