rapid_api 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -0
- data/lib/rapid_api.rb +0 -0
- data/lib/rapid_api/action_controller.rb +0 -0
- data/lib/rapid_api/action_controller/errors.rb +0 -0
- data/lib/rapid_api/action_controller/filterable_params.rb +0 -0
- data/lib/rapid_api/action_controller/macros.rb +0 -0
- data/lib/rapid_api/action_controller/permitted_params.rb +0 -0
- data/lib/rapid_api/action_controller/resource_actions.rb +0 -0
- data/lib/rapid_api/action_controller/scope.rb +0 -0
- data/lib/rapid_api/auth.rb +0 -0
- data/lib/rapid_api/auth/concerns.rb +0 -0
- data/lib/rapid_api/auth/concerns/authenticated_controller.rb +0 -0
- data/lib/rapid_api/auth/concerns/jwt_helpers.rb +0 -0
- data/lib/rapid_api/auth/concerns/sessions_controller.rb +0 -0
- data/lib/rapid_api/auth/support.rb +0 -0
- data/lib/rapid_api/auth/support/jwt.rb +0 -0
- data/lib/rapid_api/configuration.rb +0 -0
- data/lib/rapid_api/model_adapters.rb +0 -0
- data/lib/rapid_api/model_adapters/abstract.rb +0 -0
- data/lib/rapid_api/model_adapters/active_record_adapter.rb +0 -0
- data/lib/rapid_api/model_adapters/query_result.rb +0 -0
- data/lib/rapid_api/serializer_adapters.rb +0 -0
- data/lib/rapid_api/serializer_adapters/abstract.rb +0 -0
- data/lib/rapid_api/serializer_adapters/ams_adapter.rb +0 -0
- data/lib/rapid_api/services.rb +0 -0
- data/lib/rapid_api/services/base_service.rb +6 -3
- data/lib/rapid_api/services/service_response.rb +0 -0
- data/lib/rapid_api/version.rb +1 -1
- data/test/integration/ams_ar_test.rb +0 -0
- data/test/support/code_climate.rb +0 -0
- data/test/support/models.rb +0 -0
- data/test/support/schema.rb +0 -0
- data/test/support/serializers.rb +0 -0
- data/test/support/services.rb +11 -0
- data/test/support/test_model_adapter.rb +0 -0
- data/test/support/test_module/test_model_adapter.rb +0 -0
- data/test/support/test_serializer_adapter.rb +0 -0
- data/test/test_helper.rb +1 -1
- data/test/unit/rapid_api/action_controller/errors_test.rb +0 -0
- data/test/unit/rapid_api/action_controller/filterable_params_test.rb +0 -0
- data/test/unit/rapid_api/action_controller/permitted_params_test.rb +0 -0
- data/test/unit/rapid_api/action_controller/resource_actions_test.rb +0 -0
- data/test/unit/rapid_api/action_controller/scope_test.rb +0 -0
- data/test/unit/rapid_api/auth/concerns/authenticated_controller_test.rb +0 -0
- data/test/unit/rapid_api/auth/concerns/sessions_controller_test.rb +0 -0
- data/test/unit/rapid_api/auth/support/jwt_test.rb +0 -0
- data/test/unit/rapid_api/model_adapters/abstract_test.rb +0 -0
- data/test/unit/rapid_api/model_adapters/active_record_adapter_test.rb +0 -0
- data/test/unit/rapid_api/serializer_adapters/abstract_test.rb +0 -0
- data/test/unit/rapid_api/serializer_adapters/ams_adapter_test.rb +0 -0
- data/test/unit/rapid_api/services/base_service_test.rb +52 -0
- data/test/unit/rapid_api/test_configuration.rb +0 -0
- metadata +20 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27f70358adf551f185272dd5818bcb3554b6a35bcda5b2b5a8dba49b08365b4d
|
4
|
+
data.tar.gz: 69eb18fd601ebe97dfe75f90f74665988faac4eccb4c7093d5ade819b73aeb34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e71f0d6e94f44e96c62f1653eaa0718513d102a7f721a9af2658b60a96964e64696a78a07840bf87885a29fac8040c9dd086e376013715902d377dab17cbeb2
|
7
|
+
data.tar.gz: 539db845f659efc97598a02b4780d02911b3e6f8690716328f808615107c0f860b91c913823b943578294640c1cea1b927edcacbefcd06c71098eb83176262bb
|
data/README.md
CHANGED
File without changes
|
data/lib/rapid_api.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/rapid_api/auth.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/rapid_api/services.rb
CHANGED
File without changes
|
@@ -39,9 +39,12 @@ module RapidApi
|
|
39
39
|
def add_error(key, message)
|
40
40
|
raise "#{key}: #{message}" if bang_mode
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
if response.errors.key? key
|
43
|
+
response.errors[key] << message
|
44
|
+
else
|
45
|
+
response.errors[key] = []
|
46
|
+
response.errors[key] << message
|
47
|
+
end
|
45
48
|
end
|
46
49
|
|
47
50
|
def return_value(value)
|
File without changes
|
data/lib/rapid_api/version.rb
CHANGED
File without changes
|
File without changes
|
data/test/support/models.rb
CHANGED
File without changes
|
data/test/support/schema.rb
CHANGED
File without changes
|
data/test/support/serializers.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/test/test_helper.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require File.expand_path '../../../../test_helper.rb', __FILE__
|
2
|
+
|
3
|
+
module RapidApi
|
4
|
+
module Services
|
5
|
+
class BaseServiceTest < Minitest::Test
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@service = BrickService
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_response_without_errors
|
12
|
+
service_response = @service.without_errors(value: 'red bricks')
|
13
|
+
refute service_response.has_errors?
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_response_with_errors
|
17
|
+
service_response = @service.with_errors
|
18
|
+
assert service_response.has_errors?
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_response_value
|
22
|
+
value = 'red bricks'
|
23
|
+
service_response = @service.without_errors(value: value)
|
24
|
+
assert_equal value, service_response.value
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_response_errors
|
28
|
+
error_key = 'foo'
|
29
|
+
error_message = 'bar'
|
30
|
+
errors = {}
|
31
|
+
errors[error_key] = [ error_message ]
|
32
|
+
service_response = @service.with_errors(key: error_key, message: error_message)
|
33
|
+
assert_equal errors, service_response.errors
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_bang_mode
|
37
|
+
value = 'yellow bricks'
|
38
|
+
service_response = @service.without_errors!(value: value)
|
39
|
+
assert_equal value, service_response
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_bang_mode_error
|
43
|
+
error_key = 'foo'
|
44
|
+
error_message = 'bar'
|
45
|
+
exception_message = "#{error_key}: #{error_message}"
|
46
|
+
assert_raises exception_message do
|
47
|
+
@service.with_errors!(key: error_key, message: error_message)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapid_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- briandavidwetzel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- test/support/models.rb
|
135
135
|
- test/support/schema.rb
|
136
136
|
- test/support/serializers.rb
|
137
|
+
- test/support/services.rb
|
137
138
|
- test/support/test_model_adapter.rb
|
138
139
|
- test/support/test_module/test_model_adapter.rb
|
139
140
|
- test/support/test_serializer_adapter.rb
|
@@ -150,6 +151,7 @@ files:
|
|
150
151
|
- test/unit/rapid_api/model_adapters/active_record_adapter_test.rb
|
151
152
|
- test/unit/rapid_api/serializer_adapters/abstract_test.rb
|
152
153
|
- test/unit/rapid_api/serializer_adapters/ams_adapter_test.rb
|
154
|
+
- test/unit/rapid_api/services/base_service_test.rb
|
153
155
|
- test/unit/rapid_api/test_configuration.rb
|
154
156
|
homepage: ''
|
155
157
|
licenses:
|
@@ -176,25 +178,27 @@ signing_key:
|
|
176
178
|
specification_version: 4
|
177
179
|
summary: A framework for rapid development of Rails APIs.
|
178
180
|
test_files:
|
179
|
-
- test/
|
180
|
-
- test/support/code_climate.rb
|
181
|
-
- test/support/models.rb
|
182
|
-
- test/support/schema.rb
|
183
|
-
- test/support/serializers.rb
|
184
|
-
- test/support/test_model_adapter.rb
|
185
|
-
- test/support/test_module/test_model_adapter.rb
|
186
|
-
- test/support/test_serializer_adapter.rb
|
187
|
-
- test/test_helper.rb
|
181
|
+
- test/unit/rapid_api/action_controller/resource_actions_test.rb
|
188
182
|
- test/unit/rapid_api/action_controller/errors_test.rb
|
189
183
|
- test/unit/rapid_api/action_controller/filterable_params_test.rb
|
190
184
|
- test/unit/rapid_api/action_controller/permitted_params_test.rb
|
191
|
-
- test/unit/rapid_api/action_controller/resource_actions_test.rb
|
192
185
|
- test/unit/rapid_api/action_controller/scope_test.rb
|
186
|
+
- test/unit/rapid_api/model_adapters/active_record_adapter_test.rb
|
187
|
+
- test/unit/rapid_api/model_adapters/abstract_test.rb
|
188
|
+
- test/unit/rapid_api/auth/support/jwt_test.rb
|
193
189
|
- test/unit/rapid_api/auth/concerns/authenticated_controller_test.rb
|
194
190
|
- test/unit/rapid_api/auth/concerns/sessions_controller_test.rb
|
195
|
-
- test/unit/rapid_api/auth/support/jwt_test.rb
|
196
|
-
- test/unit/rapid_api/model_adapters/abstract_test.rb
|
197
|
-
- test/unit/rapid_api/model_adapters/active_record_adapter_test.rb
|
198
|
-
- test/unit/rapid_api/serializer_adapters/abstract_test.rb
|
199
191
|
- test/unit/rapid_api/serializer_adapters/ams_adapter_test.rb
|
192
|
+
- test/unit/rapid_api/serializer_adapters/abstract_test.rb
|
200
193
|
- test/unit/rapid_api/test_configuration.rb
|
194
|
+
- test/unit/rapid_api/services/base_service_test.rb
|
195
|
+
- test/integration/ams_ar_test.rb
|
196
|
+
- test/support/test_model_adapter.rb
|
197
|
+
- test/support/schema.rb
|
198
|
+
- test/support/test_module/test_model_adapter.rb
|
199
|
+
- test/support/test_serializer_adapter.rb
|
200
|
+
- test/support/code_climate.rb
|
201
|
+
- test/support/serializers.rb
|
202
|
+
- test/support/models.rb
|
203
|
+
- test/support/services.rb
|
204
|
+
- test/test_helper.rb
|