aga-architecture 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: b7d7d252e3ca062ba6a7abf934ff405209a5ec36e3dd069e603f85d87ebd9f93
4
+ data.tar.gz: a332d281793309d76a2f8fbd7ee3878b47265e4751c69ff1384907d248a03436
5
+ SHA512:
6
+ metadata.gz: 201c3a1bee304d48397063e6f28c3775753eaceb461c2260c9089545ec928de81984b9586b3095baed54a9be0c26b201f95f9bffd99b2ec8b84d237a7a51c166
7
+ data.tar.gz: 82a0368fdadc27b9c4777d70b3e90a37b705f8979eb6f652820ab82eab48456be53be3d54038c4d5095c240b1defc885c97e2789094c4eadfa75ffe9233a2cac
data/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # Aga-architecture
2
+
3
+ Aga-architecture is a Ruby gem that provides a convenient way to receive cryptocurrency payloads, format them into messages, and send them via Telegram. It enables seamless integration between your cryptocurrency system and Telegram, allowing you to deliver important updates and information to your users in real-time.
4
+
5
+
6
+ ## Features
7
+
8
+ - Receive cryptocurrency payloads from your system or external APIs.
9
+ - Format and customize the payload data into informative messages suitable for Telegram.
10
+ - Support for various types of cryptocurrency data, including price updates, market trends, news, and more.
11
+ - Integration with the Telegram Bot API for easy and secure message sending.
12
+
13
+
14
+ ## Installation
15
+
16
+ Install the gem and add to the application's Gemfile by executing:
17
+
18
+ $ bundle add aga-architecture
19
+
20
+ If bundler is not being used to manage dependencies, install the gem by executing:
21
+
22
+ $ gem install aga-architecture
23
+
24
+ ## Usage
25
+
26
+ To use Aga-telegram in your application, require the gem and start making requests. Here's a basic example:
27
+
28
+ ```
29
+ require 'architecture'
30
+
31
+ a = Architecture::Middleware.new(start: 1, service: :arbitrage, movement: 0)
32
+ response = a.run
33
+
34
+ puts response
35
+
36
+ # Output:
37
+
38
+ ["šŸ¤‘<b>MOVEMENT 1/06</b> šŸ¤‘\n\nCrypto: <b>Bitcoin (BTC)</b>\nšŸš©: <b>BitMart($ 26,546.85393333)</b>\nšŸ: <b>Bittrex($ 26,685.88931023)</b>\nšŸ’ø: <b>0.52%</b>\n\n ========================== \nšŸ¤‘<b>MOVEMENT 2/06</b> šŸ¤‘\n\nCrypto: <b>Ethereum (ETH)</b>\nšŸš©: <b>BitMart($ 1,842.74209494)</b>\nšŸ: <b>Bittrex($ 1,855.85752369)</b>\nšŸ’ø: <b>0.71%</b>\n\n ========================== \nšŸ¤‘<b>MOVEMENT 3/06</b> šŸ¤‘\n\nCrypto: <b>Xrp (XRP)</b>\nšŸš©: <b>Bittrex($ 0.53098908)</b>\nšŸ: <b>Crypto.com Exchange($ 0.53294904)</b>\nšŸ’ø: <b>0.37%</b>\n\n ========================== \nšŸ¤‘<b>MOVEMENT 4/06</b> šŸ¤‘\n\nCrypto: <b>Litecoin (LTC)</b>\nšŸš©: <b>Bittrex($ 88.69185857)</b>\nšŸ: <b>MEXC($ 89.40816088)</b>\nšŸ’ø: <b>0.81%</b>\n"]
39
+
40
+ ```
41
+
42
+ ## Contributing
43
+
44
+ Contributions to Aga-architecture are welcome! If you encounter any issues or have suggestions for improvements, please submit an issue on the repository. Pull requests are also encouraged.
45
+
46
+
47
+ ## Private License
48
+
49
+ Version 0.0.2, 01/06/2023
50
+
51
+ 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.
52
+
53
+ 1. License Grant
54
+
55
+ 1.1 You are granted a non-exclusive, non-transferable license to use the Software for internal purposes only.
56
+
57
+ 1.2 You may not distribute, sublicense, sell, or transfer the Software to any third party without prior written permission from AIGreenAnt.
58
+
59
+ 2. Intellectual Property
60
+
61
+ 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.
62
+
63
+ 2.2 You may not remove, alter, or obscure any proprietary notices or labels on the Software.
64
+
65
+ 3. Limitation of Liability
66
+
67
+ 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.
68
+
69
+ 4. Termination
70
+
71
+ 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.
72
+
73
+ 4.2 Upon termination, you must immediately cease all use of the Software and destroy all copies in your possession or control.
74
+
75
+ 5. Governing Law
76
+
77
+ 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.
78
+
79
+ 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.
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'zeitwerk'
4
+
5
+ module Architecture
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 = 'architecture'
23
+ loader.inflector = Inflector.new
24
+ loader.push_dir(LIB_PATH)
25
+ loader.collapse(::File.join(LIB_PATH, 'architecture', '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, 'architecture', 'patches')
37
+ ].freeze
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Architecture
4
+ class Base
5
+ class << self
6
+ attr_accessor :app_info
7
+ end
8
+
9
+ self.app_info = ::ENV['APP_INFO'] || "#{::Architecture::NAME} V#{::Architecture.version}"
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ keys:
2
+ arbitrage:
3
+ token: 5472947783:AAFbTGGE9hasxoDvM4VFcOFdMQ3P2Uw9n4Y
4
+ chat: -1001807941262
5
+ new:
6
+ token: 6232812083:AAHm8W6gsFq_4Dz6PtEarsjolCVGVlGx5-s
7
+ chat: -1001914204813
8
+ top:
9
+ token: 5741138267:AAEttI7GOmbXinTqoh4Y7Vsx2bWD-O9XZ0U
10
+ chat: -1001983579638
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+ require 'telegram'
5
+
6
+ module Architecture
7
+ class Alert < Common
8
+ # rubocop: disable Lint/MissingSuper, Lint/MissingCopEnableDirective
9
+ def initialize(service)
10
+ @service = service
11
+ end
12
+
13
+ def run(response)
14
+ tm = Telegram::Message.new(token: token, chat: chat)
15
+ response&.dig(:result)&.each do |r|
16
+ tm.send(r)
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def configuration
23
+ file_path = File.expand_path('../config/keys.yml', __dir__)
24
+ YAML.load_file(file_path)
25
+ end
26
+
27
+ def token
28
+ configuration.dig('keys', @service.to_s, 'token')
29
+ end
30
+
31
+ def chat
32
+ configuration.dig('keys', @service.to_s, 'chat')
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'message'
4
+
5
+ module Architecture
6
+ class Builder < Common
7
+ def run(result)
8
+ Message.configuration
9
+ dissipator = Message::Helpers::Dissipator.new(result: result,
10
+ service: @service,
11
+ count: @movement)
12
+ response = dissipator.run
13
+ empty_response?(response) ? [] : alert(response)
14
+ end
15
+
16
+ private
17
+
18
+ def alert(response)
19
+ Architecture::Alert.new(@service).run(response)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Architecture
4
+ class Common
5
+ def initialize(start:, service:, movement:)
6
+ @start = start || 1
7
+ @service = service&.to_sym
8
+ @movement = movement
9
+ end
10
+
11
+ private
12
+
13
+ def empty_response?(response)
14
+ response.nil? || response&.empty?
15
+ end
16
+
17
+ def service_class(gem)
18
+ "#{gem}::#{@service.to_s.capitalize}"
19
+ end
20
+
21
+ attr_accessor :start, :movement, :service
22
+ end
23
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'money'
4
+
5
+ module Architecture
6
+ class Middleware < Common
7
+ def run
8
+ obj = Object.const_get(service_class('Money'))
9
+ service = obj.new(start: @start, service: @service)
10
+ result = service.run
11
+ @start = service.instance_variable_get(:@start)
12
+
13
+ empty_response?(result) ? [] : builder(result)
14
+ end
15
+
16
+ private
17
+
18
+ def builder(result)
19
+ obj = Architecture::Builder.new(start: @start, service: @service,
20
+ movement: @movement)
21
+
22
+ @movement += result.size
23
+ obj.run(result)
24
+ end
25
+
26
+ attr_accessor :start, :movement, :service
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Architecture
4
+ VERSION = '0.0.0'
5
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './architecture/autoloader'
4
+
5
+ module Architecture
6
+ NAME = 'Architecture Ruby'
7
+
8
+ @mutex = ::Mutex.new
9
+
10
+ class << self
11
+ def app_info=(value)
12
+ ::Architecture::Base.app_info = value
13
+ end
14
+
15
+ def ping
16
+ { status: 200 }
17
+ end
18
+
19
+ def version
20
+ VERSION
21
+ end
22
+ end
23
+ end
24
+
25
+ ::Architecture::Autoloader.setup!
metadata ADDED
@@ -0,0 +1,291 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aga-architecture
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-12 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: bump
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.8'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: digest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.1.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.8'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.8'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.16'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.16'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: activesupport
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 7.0.5
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 7.0.5
139
+ - !ruby/object:Gem::Dependency
140
+ name: aga-message
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.0.2
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.0.2
153
+ - !ruby/object:Gem::Dependency
154
+ name: aga-money
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: aga-telegram
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 0.0.2
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 0.0.2
181
+ - !ruby/object:Gem::Dependency
182
+ name: i18n
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 1.14.0
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 1.14.0
195
+ - !ruby/object:Gem::Dependency
196
+ name: pry
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '0.14'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '0.14'
209
+ - !ruby/object:Gem::Dependency
210
+ name: telegram-bot-ruby
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '1.0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '1.0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: tzinfo
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: 2.0.6
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: 2.0.6
237
+ - !ruby/object:Gem::Dependency
238
+ name: yaml
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - "~>"
242
+ - !ruby/object:Gem::Version
243
+ version: 0.2.1
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "~>"
249
+ - !ruby/object:Gem::Version
250
+ version: 0.2.1
251
+ description: Architecture Ruby is a lightweight gem for manage operations of aga gems.
252
+ email:
253
+ - stefanobaldazzi40@gmail.com
254
+ executables: []
255
+ extensions: []
256
+ extra_rdoc_files: []
257
+ files:
258
+ - README.md
259
+ - lib/architecture.rb
260
+ - lib/architecture/autoloader.rb
261
+ - lib/architecture/base.rb
262
+ - lib/architecture/config/keys.yml
263
+ - lib/architecture/resources/alert.rb
264
+ - lib/architecture/resources/builder.rb
265
+ - lib/architecture/resources/common.rb
266
+ - lib/architecture/resources/middleware.rb
267
+ - lib/architecture/version.rb
268
+ homepage: https://github.com/Baldaz02/aga-architecture-ruby
269
+ licenses:
270
+ - MIT
271
+ metadata: {}
272
+ post_install_message:
273
+ rdoc_options: []
274
+ require_paths:
275
+ - lib
276
+ required_ruby_version: !ruby/object:Gem::Requirement
277
+ requirements:
278
+ - - ">="
279
+ - !ruby/object:Gem::Version
280
+ version: '2.7'
281
+ required_rubygems_version: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - ">="
284
+ - !ruby/object:Gem::Version
285
+ version: '0'
286
+ requirements: []
287
+ rubygems_version: 3.3.24
288
+ signing_key:
289
+ specification_version: 4
290
+ summary: aga-architecture0.0.0
291
+ test_files: []