aga-architecture 0.0.0 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7d7d252e3ca062ba6a7abf934ff405209a5ec36e3dd069e603f85d87ebd9f93
4
- data.tar.gz: a332d281793309d76a2f8fbd7ee3878b47265e4751c69ff1384907d248a03436
3
+ metadata.gz: a49fc8de05087bd2b4e9ab2da81731c1f1116fed9d2b32c5d5e940be92ff2683
4
+ data.tar.gz: cfb0565d79b0044a41cf44b46d1b38607b0afbacce75ff651039ecd32066d2ca
5
5
  SHA512:
6
- metadata.gz: 201c3a1bee304d48397063e6f28c3775753eaceb461c2260c9089545ec928de81984b9586b3095baed54a9be0c26b201f95f9bffd99b2ec8b84d237a7a51c166
7
- data.tar.gz: 82a0368fdadc27b9c4777d70b3e90a37b705f8979eb6f652820ab82eab48456be53be3d54038c4d5095c240b1defc885c97e2789094c4eadfa75ffe9233a2cac
6
+ metadata.gz: 588c8aebbecdae9371d21a7a4b7cd6ed6d8a17f353adf3e15a25edaa0e1d94938848bbc4bec5b13abd5a047c98786fefb3d6f3c224b16f7c422881cddc9e5cc7
7
+ data.tar.gz: d0f377e3d555fbea06adca7583fa2569f0ff2133d5938276c115a77d3af559ccff3fb284ee5cf4db80c742022cf35e020fc2bb6e086f12cb4bef8e8c75c988c9
data/README.md CHANGED
@@ -23,7 +23,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
23
23
 
24
24
  ## Usage
25
25
 
26
- To use Aga-telegram in your application, require the gem and start making requests. Here's a basic example:
26
+ To use Aga-architecture in your application, require the gem and start making requests. Here's a basic example:
27
27
 
28
28
  ```
29
29
  require 'architecture'
@@ -12,24 +12,37 @@ module Architecture
12
12
 
13
13
  def run(response)
14
14
  tm = Telegram::Message.new(token: token, chat: chat)
15
- response&.dig(:result)&.each do |r|
16
- tm.send(r)
17
- end
15
+ result = response&.dig(:result)
16
+ send_message(result: result, tm: tm)
18
17
  end
19
18
 
20
19
  private
20
+
21
+ def chat
22
+ configuration.dig('keys', @service.to_s, 'chat')
23
+ end
21
24
 
22
25
  def configuration
23
26
  file_path = File.expand_path('../config/keys.yml', __dir__)
24
27
  YAML.load_file(file_path)
25
28
  end
29
+
30
+ def send_message(result: ,tm:)
31
+ if result.is_a?(Array)
32
+ send_multiple(result: result, tm: tm)
33
+ else
34
+ tm.send(result)
35
+ end
36
+ end
37
+
38
+ def send_multiple(result: ,tm:)
39
+ result&.each do |r|
40
+ tm.send(r)
41
+ end
42
+ end
26
43
 
27
44
  def token
28
45
  configuration.dig('keys', @service.to_s, 'token')
29
46
  end
30
-
31
- def chat
32
- configuration.dig('keys', @service.to_s, 'chat')
33
- end
34
47
  end
35
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Architecture
4
- VERSION = '0.0.0'
4
+ VERSION = '0.0.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aga-architecture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Baldazzi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-12 00:00:00.000000000 Z
11
+ date: 2023-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 0.0.2
159
+ version: 0.0.4
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 0.0.2
166
+ version: 0.0.4
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: aga-telegram
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -287,5 +287,5 @@ requirements: []
287
287
  rubygems_version: 3.3.24
288
288
  signing_key:
289
289
  specification_version: 4
290
- summary: aga-architecture0.0.0
290
+ summary: aga-architecture0.0.4
291
291
  test_files: []