kybus-server 0.1.1 → 0.1.2

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: 241297935e3c516fad7194a56e888e6c2a1d8b140b11c5a1cd7ddfb4ec7b4778
4
- data.tar.gz: 3f5d6d82a0b055e8857d3bde6cb566a13c6ca48ad59bbfbb4576cabd5612b219
3
+ metadata.gz: 43a70fed44bee83a21a0696e8e07aae38a81f64d3097130f43164f277dca9777
4
+ data.tar.gz: 8f4ecfa657152420b52a7e3c1bbbd0a4537ca597b6b96ea787c5f35899f26eac
5
5
  SHA512:
6
- metadata.gz: 223cbfa1a4a00e252c18f94b0669257e7b6293297fcc7a61ac864208c5deb5569a41c1df1dfbead272322450a9d7c5f2b7e62b576b4c45993c1be105d191c3eb
7
- data.tar.gz: c68a165e527a0b66f6c9730dd818e21785b4d17049b4d9b15c1654fafcb620141e379b4a0522edf7c6801e8805d6ab966f4de8e5e3888f4d3a50d0f0d8f7e914
6
+ metadata.gz: 0ee4bd2ce66e82cc022f1d175001374ab5b67a292d390e2bb0b192ae174d874716a4a3c8135dab7547e2c4089dfeb1492104e73fa6509e314e1ea4dde39c8761
7
+ data.tar.gz: 5f040f932a873579011dd889ff4bad70dd692807791d761d479f27771b26ec311db1841319d9c02e15369e99a02e0e5438ae8b33cf519881918a61fc8d43bad9
@@ -38,7 +38,7 @@ module Kybus
38
38
  ##
39
39
  # helper to sumarize fatal and error status
40
40
  def error_format(level, code, message, data)
41
- { status: level, code: code, message: message, data: data }
41
+ { status: level, code:, message:, data: }
42
42
  end
43
43
  end
44
44
  end
@@ -12,7 +12,7 @@ module Kybus
12
12
  lambda do |env, level, ex|
13
13
  params = env['api.endpoint'].params
14
14
  request = env['api.endpoint'].request
15
- pkg = RequestResponse.new(request: request, params: params)
15
+ pkg = RequestResponse.new(request:, params:)
16
16
  pkg.exception = ex
17
17
  Server::Response.logger.send(level, pkg)
18
18
  Server::Response.format.send(level, pkg)
@@ -41,9 +41,9 @@ module Kybus
41
41
  # :nocov: #
42
42
  def self.configure_grape_exceptions(base)
43
43
  base.rescue_from(Grape::Exceptions::Base) do |ex|
44
- ant_ex = Kybus::Exceptions::AntFail.new(ex.message)
44
+ kybus_ex = Kybus::Exceptions::KybusFail.new(ex.message)
45
45
  response = Kybus::Server::GrapeDecorator
46
- .handler.call(env, :fail, ant_ex)
46
+ .handler.call(env, :fail, kybus_ex)
47
47
  error!(response, 400)
48
48
  end
49
49
  end
@@ -81,7 +81,7 @@ module Kybus
81
81
  base.after do
82
82
  params = env['api.endpoint'].params
83
83
  request = env['api.endpoint'].request
84
- pkg = RequestResponse.new(request: request, params: params)
84
+ pkg = RequestResponse.new(request:, params:)
85
85
  Server::Response.logger.access(pkg)
86
86
  end
87
87
  end
@@ -6,8 +6,9 @@ module Kybus
6
6
  # to track monitoring logs and format the response after the endpoint was
7
7
  # executed
8
8
  class RequestResponse
9
- attr_reader :params, :exception, :result, :start_timestamp
10
- attr_writer :exception, :result, :start_timestamp
9
+ attr_accessor :exception, :result, :start_timestamp
10
+ attr_reader :params
11
+
11
12
  def initialize(request:, params:)
12
13
  @request = request
13
14
  @params = params
@@ -30,9 +30,9 @@ module Kybus
30
30
  end
31
31
 
32
32
  def configure_defaults!
33
- recover_from!(Exceptions::AntSuccess, :success)
34
- recover_from!(Exceptions::AntFail, :fail)
35
- recover_from!(Exceptions::AntError, :error)
33
+ recover_from!(Exceptions::KybusSuccess, :success)
34
+ recover_from!(Exceptions::KybusFail, :fail)
35
+ recover_from!(Exceptions::KybusError, :error)
36
36
  register(:loggers, :cute_logger, Server::Logger.new)
37
37
  register(:formats, :jsend, Server::Format.new)
38
38
  log_mode(:cute_logger)
@@ -59,11 +59,11 @@ module Kybus
59
59
 
60
60
  def process_request
61
61
  params[:__init_time] = Time.now
62
- data = RequestResponse.new(request: request, params: params)
62
+ data = RequestResponse.new(request:, params:)
63
63
  resolver = :success
64
64
  Server::Response.logger.access(data)
65
65
  begin
66
- raise(AntError, 'No implementation given') unless block_given?
66
+ raise(KybusError, 'No implementation given') unless block_given?
67
67
 
68
68
  data.result = yield
69
69
  # rubocop: disable Lint/RescueException
data/lib/kybus/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Kybus
4
4
  module Server
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,172 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kybus-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gilberto Vargas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-15 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kybus-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.1'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: kybus-logger
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.1'
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0.1'
41
- - !ruby/object:Gem::Dependency
42
- name: grape
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.2'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '1.2'
55
- - !ruby/object:Gem::Dependency
56
- name: minitest
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '5.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '5.0'
69
- - !ruby/object:Gem::Dependency
70
- name: mocha
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.8'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.8'
83
- - !ruby/object:Gem::Dependency
84
- name: pry
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '0.10'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '0.10'
97
- - !ruby/object:Gem::Dependency
98
- name: rack-minitest
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '0.0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '0.0'
111
- - !ruby/object:Gem::Dependency
112
- name: rake
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '10.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '10.0'
125
- - !ruby/object:Gem::Dependency
126
- name: rdoc
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '6.1'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '6.1'
139
- - !ruby/object:Gem::Dependency
140
- name: simplecov
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '0.16'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '0.16'
153
- - !ruby/object:Gem::Dependency
154
- name: webmock
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '3.5'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: '3.5'
40
+ version: '0'
167
41
  description: This gems can be used along a server app with jsonformat messages
168
42
  email:
169
- - tachoguitar@gmail.com
43
+ - tachomexgems@gmail.com
170
44
  executables: []
171
45
  extensions: []
172
46
  extra_rdoc_files: []
@@ -181,7 +55,8 @@ files:
181
55
  homepage: https://github.com/tachomex/kybus
182
56
  licenses:
183
57
  - MIT
184
- metadata: {}
58
+ metadata:
59
+ rubygems_mfa_required: 'true'
185
60
  post_install_message:
186
61
  rdoc_options: []
187
62
  require_paths:
@@ -197,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
72
  - !ruby/object:Gem::Version
198
73
  version: '0'
199
74
  requirements: []
200
- rubygems_version: 3.1.4
75
+ rubygems_version: 3.5.14
201
76
  signing_key:
202
77
  specification_version: 4
203
78
  summary: Implements Kybus format on server applications