aga-bnb 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: 214c3ce010d94cff9c9a5ffb49acf832b7d7d828b22a9fb91d229edd1616060e
4
+ data.tar.gz: 06125c79a378ec9e18fba11bde9ed81d8ba4db6737054ed0ee2ded0e1d6c7433
5
+ SHA512:
6
+ metadata.gz: c9e8bdc27a01a3689c757cea2a933b3d57af234daa0a80bbc21fdd1ba3ee8d7aa11992b5e5516497b4a4445c90e5ffa12435f756fc9351590c5c1b5f4a372e3b
7
+ data.tar.gz: c033ed7ccdfe0b5d59f56a79275a4de32579e9de36a7bd1d7ff32052d9b2c595ccf3257c8ef14f580379fee42df42e4a5159f06ee2c0141a52cdaec2c605972f
data/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # Aga-bnb
2
+
3
+ Aga request is a Ruby gem that provides a convenient way to interact with the Binance API. It allows you to retrieve information about new cryptocurrencies, all cryptocurrencies, and gainers (cryptocurrencies with price gains) from the Binance exchange.
4
+
5
+ ## Features
6
+
7
+ - Get information about newly listed cryptocurrencies on Binance.
8
+ - Fetch details of all cryptocurrencies available on Binance.
9
+ - Retrieve a list of gainers (cryptocurrencies with price gains) on Binance.
10
+
11
+ ## Installation
12
+
13
+ Install the gem and add to the application's Gemfile by executing:
14
+
15
+ $ bundle add aga-bnb
16
+
17
+ If bundler is not being used to manage dependencies, install the gem by executing:
18
+
19
+ $ gem install aga-bnb
20
+
21
+ ## Usage
22
+
23
+ To use Aga-request in your application, require the gem and start making requests. Here's a basic example:
24
+
25
+ ```
26
+ require 'bnb'
27
+
28
+ r = Request::Http.new
29
+ response = r.get('https://api.example.com/resource', { 'key' => 'value' }, { 'Authorization' => 'Bearer TOKEN' })
30
+
31
+ puts response[:status] # Output: true or false
32
+ puts response[:response] # Output: {"data": "example"}
33
+
34
+ ```
35
+
36
+ ## Contributing
37
+
38
+ Contributions to Aga-bnb are welcome! If you encounter any issues or have suggestions for improvements, please submit an issue on the repository. Pull requests are also encouraged.
39
+
40
+
41
+ ## Private License
42
+
43
+ Version 0.0.0, 01/06/2023
44
+
45
+ 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.
46
+
47
+ 1. License Grant
48
+
49
+ 1.1 You are granted a non-exclusive, non-transferable license to use the Software for internal purposes only.
50
+
51
+ 1.2 You may not distribute, sublicense, sell, or transfer the Software to any third party without prior written permission from AIGreenAnt.
52
+
53
+ 2. Intellectual Property
54
+
55
+ 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.
56
+
57
+ 2.2 You may not remove, alter, or obscure any proprietary notices or labels on the Software.
58
+
59
+ 3. Limitation of Liability
60
+
61
+ 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.
62
+
63
+ 4. Termination
64
+
65
+ 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.
66
+
67
+ 4.2 Upon termination, you must immediately cease all use of the Software and destroy all copies in your possession or control.
68
+
69
+ 5. Governing Law
70
+
71
+ 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.
72
+
73
+ 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.
74
+
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'zeitwerk'
4
+
5
+ module Bnb
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 = 'bnb'
23
+ loader.inflector = Inflector.new
24
+ loader.push_dir(LIB_PATH)
25
+ loader.collapse(::File.join(LIB_PATH, 'bnb', '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, 'bnb', 'patches')
37
+ ].freeze
38
+ end
39
+ end
40
+ end
41
+ end
data/lib/bnb/base.rb ADDED
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'request'
4
+ require 'uri'
5
+
6
+ module Bnb
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
+ "#{Bnb::Base.path_prefix}#{path}?#{query}"
26
+ end
27
+ end
28
+
29
+ self.app_info = ::ENV['APP_INFO'] || "#{::Bnb::NAME} V#{::Bnb.version}"
30
+ self.path_prefix = 'https://www.binance.com/bapi/composite/v1/public/promo/cmc/cryptocurrency'
31
+ end
32
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bnb
4
+ class All
5
+ ALL_LIMIT = 7
6
+
7
+ def initialize(params = {})
8
+ @start = params.fetch(:start, 1)
9
+ @limit = params.fetch(:limit, ALL_LIMIT)
10
+ end
11
+
12
+ def list
13
+ url = Bnb::Base.send(:build_url, '/listings/latest', limit: @limit, start: @start)
14
+ Bnb::Base.request.get(url, headers: Bnb::Base.headers)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bnb
4
+ class Gainer
5
+ GAIN_LIMIT = 100
6
+
7
+ def initialize(params = {})
8
+ @start = params.fetch(:start, 1)
9
+ @limit = params.fetch(:limit, GAIN_LIMIT)
10
+ end
11
+
12
+ def list
13
+ url = Bnb::Base.send(:build_url, '/trending/gainers-losers', sort_dir: 'desc', limit: @limit, start: @start)
14
+ Bnb::Base.request.get(url, headers: Bnb::Base.headers)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bnb
4
+ class New
5
+ NEW_LIMIT = 100
6
+
7
+ def initialize(params = {})
8
+ @start = params.fetch(:start, 1)
9
+ @limit = params.fetch(:limit, NEW_LIMIT)
10
+ end
11
+
12
+ def list
13
+ url = Bnb::Base.send(:build_url, '/listings/new', limit: @limit, start: @start)
14
+ Bnb::Base.request.get(url, headers: Bnb::Base.headers)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bnb
4
+ VERSION = '0.0.0'
5
+ end
data/lib/bnb.rb ADDED
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './bnb/autoloader'
4
+
5
+ module Bnb
6
+ NAME = 'Bnb Ruby'
7
+
8
+ @mutex = ::Mutex.new
9
+
10
+ class << self
11
+ def app_info=(value)
12
+ ::Bnb::Base.app_info = value
13
+ end
14
+
15
+ def path_prefix=(value)
16
+ ::Bnb::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
+ ::Bnb::Autoloader.setup!
metadata ADDED
@@ -0,0 +1,219 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aga-bnb
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-01 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 bnb Ruby is a lightweight gem for call Binance API.
182
+ email:
183
+ - stefanobaldazzi40@gmail.com
184
+ executables: []
185
+ extensions: []
186
+ extra_rdoc_files: []
187
+ files:
188
+ - README.md
189
+ - lib/bnb.rb
190
+ - lib/bnb/autoloader.rb
191
+ - lib/bnb/base.rb
192
+ - lib/bnb/resources/all.rb
193
+ - lib/bnb/resources/gainer.rb
194
+ - lib/bnb/resources/new.rb
195
+ - lib/bnb/version.rb
196
+ homepage: https://github.com/Baldaz02/aga-bnb-ruby
197
+ licenses:
198
+ - MIT
199
+ metadata: {}
200
+ post_install_message:
201
+ rdoc_options: []
202
+ require_paths:
203
+ - lib
204
+ required_ruby_version: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '2.7'
209
+ required_rubygems_version: !ruby/object:Gem::Requirement
210
+ requirements:
211
+ - - ">="
212
+ - !ruby/object:Gem::Version
213
+ version: '0'
214
+ requirements: []
215
+ rubygems_version: 3.3.24
216
+ signing_key:
217
+ specification_version: 4
218
+ summary: bnb v.0.0.0
219
+ test_files: []