rubypitaya 3.6.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rubypitaya/app-template/Gemfile +1 -1
- data/lib/rubypitaya/app-template/Gemfile.lock +2 -2
- data/lib/rubypitaya/app-template/app/constants/status_codes.rb +1 -0
- data/lib/rubypitaya/app-template/app/handlers/error_handler.rb +1 -1
- data/lib/rubypitaya/app-template/app/handlers/hello_world_handler.rb +13 -2
- data/lib/rubypitaya/app-template/app/handlers/player_handler.rb +1 -4
- data/lib/rubypitaya/app-template/features/hello_world.feature +24 -0
- data/lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb +10 -0
- data/lib/rubypitaya/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d18288d711a487bc0b84dcd073c63ed0192ca0412fb99fcbc1e0305c587df97
|
4
|
+
data.tar.gz: 1c5b6be9550df23b8d625806ae0b2a0f3a6b454e01a9ba32f27d890b5f169272
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0326e18138b4eeae46b59d4d43df908446072b95838e724dcf9fd46125c937519bdf3781e177ba97c7e7db5d3aeabbc5a25675f0602d2aeaa4a640637bc1fc2e
|
7
|
+
data.tar.gz: cfe3acbd44442ea99606bb6ba4e51b7103febecdad79551228a1bf2a2aaf5fda80b219d168fed4e8055eed6efc006aea0c0d582df6d0a15d6f7ab5e83769ee6c
|
@@ -99,7 +99,7 @@ GEM
|
|
99
99
|
rspec-support (~> 3.11.0)
|
100
100
|
rspec-support (3.11.0)
|
101
101
|
ruby2_keywords (0.0.5)
|
102
|
-
rubypitaya (3.
|
102
|
+
rubypitaya (3.7.0)
|
103
103
|
activerecord (= 7.0.2)
|
104
104
|
etcdv3 (= 0.11.5)
|
105
105
|
google-protobuf (= 3.19.4)
|
@@ -138,7 +138,7 @@ DEPENDENCIES
|
|
138
138
|
listen (= 3.7.1)
|
139
139
|
pry (= 0.14.1)
|
140
140
|
rspec (= 3.11.0)
|
141
|
-
rubypitaya (= 3.
|
141
|
+
rubypitaya (= 3.7.0)
|
142
142
|
sinatra-contrib (= 2.1.0)
|
143
143
|
|
144
144
|
BUNDLED WITH
|
@@ -1,13 +1,24 @@
|
|
1
1
|
class HelloWorldHandler < RubyPitaya::HandlerBase
|
2
2
|
|
3
|
-
non_authenticated_actions :sayHello
|
3
|
+
non_authenticated_actions :sayHello, :showMessage
|
4
4
|
|
5
5
|
def sayHello
|
6
6
|
response = {
|
7
|
-
code:
|
7
|
+
code: StatusCodes::CODE_OK,
|
8
8
|
data: {
|
9
9
|
message: 'Hello!'
|
10
10
|
}
|
11
11
|
}
|
12
12
|
end
|
13
|
+
|
14
|
+
def showMessage
|
15
|
+
message = @params[:message]
|
16
|
+
|
17
|
+
response = {
|
18
|
+
code: StatusCodes::CODE_OK,
|
19
|
+
data: {
|
20
|
+
message: message
|
21
|
+
}
|
22
|
+
}
|
23
|
+
end
|
13
24
|
end
|
@@ -59,10 +59,7 @@ class PlayerHandler < RubyPitaya::HandlerBase
|
|
59
59
|
bind_session_response = @postman.bind_session(@session)
|
60
60
|
|
61
61
|
unless bind_session_response.dig(:error, :code).nil?
|
62
|
-
|
63
|
-
code: RubyPitaya::StatusCodes::CODE_AUTHENTICATION_ERROR,
|
64
|
-
msg: 'Error to authenticate',
|
65
|
-
}
|
62
|
+
raise RubyPitaya::RouteError.new(StatusCodes::CODE_AUTHENTICATION_ERROR, 'Error to authenticate')
|
66
63
|
end
|
67
64
|
|
68
65
|
response = {
|
@@ -6,3 +6,27 @@ Feature: Hello World
|
|
6
6
|
Given client call route 'rubypitaya.helloWorldHandler.sayHello'
|
7
7
|
Then server should response 'code' as 'RP-200'
|
8
8
|
And server should response 'data.message' as 'Hello!'
|
9
|
+
|
10
|
+
Scenario: Custom message
|
11
|
+
When client call route 'rubypitaya.helloWorldHandler.showMessage' with params:
|
12
|
+
| message |
|
13
|
+
| Hello World! |
|
14
|
+
Then server should response 'code' as 'RP-200'
|
15
|
+
And server should response 'data.message' as 'Hello World!'
|
16
|
+
|
17
|
+
Scenario: Custom message with json
|
18
|
+
When client call route 'rubypitaya.helloWorldHandler.showMessage' with json params:
|
19
|
+
"""
|
20
|
+
{
|
21
|
+
"message": "Hello World!"
|
22
|
+
}
|
23
|
+
"""
|
24
|
+
Then server should response the following json:
|
25
|
+
"""
|
26
|
+
{
|
27
|
+
"code": "RP-200",
|
28
|
+
"data": {
|
29
|
+
"message": "Hello World!"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
"""
|
@@ -2,6 +2,16 @@ Given(/^[Cc]lient call route ["'](.+)["']$/) do |route|
|
|
2
2
|
@handler_helper.request(route)
|
3
3
|
end
|
4
4
|
|
5
|
+
Given(/^[Cc]lient call route ["'](.+)["'] with param[s]*[:]*$/) do |route, table|
|
6
|
+
params = table.hashes.first.symbolize_keys
|
7
|
+
@handler_helper.request(route, params)
|
8
|
+
end
|
9
|
+
|
10
|
+
Given(/^[Cc]lient call route ["'](.+)["'] with json param[s]*[:]*$/) do |route, json|
|
11
|
+
params = JSON.parse(json, symbolize_names: true)
|
12
|
+
@handler_helper.request(route, params)
|
13
|
+
end
|
14
|
+
|
5
15
|
Given(/^[Ss]erver should response ["'](.+)["'] as ["'](.+)["']$/) do |response_key, expected_value|
|
6
16
|
response_value = @handler_helper.response.dig(*response_key.split('.').map(&:to_sym))
|
7
17
|
|
data/lib/rubypitaya/version.rb
CHANGED