Module: Extension::ClassMethods
- Defined in:
- lib/fastapi/extension.rb
Instance Method Summary collapse
- #fastapi ⇒ Object
- #fastapi_custom_order ⇒ Object
-
#fastapi_default_filters(filters) ⇒ Hash
Used to set any default filters for the top level fastapi response.
-
#fastapi_define_order(keys) ⇒ Hash
Define custom ORDER BY strings for specific keys.
- #fastapi_fields ⇒ Object
- #fastapi_fields_sub ⇒ Object
- #fastapi_filters ⇒ Object
- #fastapi_filters_whitelist ⇒ Object
-
#fastapi_safe_fields(fields) ⇒ Array
Set safe fields for FastAPIInstance.safe_filter These are the fields that can be actively filtered by.
-
#fastapi_standard_interface(fields) ⇒ Array
Used to set the standard interface for the top level of a fastapi response.
-
#fastapi_standard_interface_nested(fields) ⇒ Array
Used to set the standard interface for the second level of a fastapi response (nested).
Instance Method Details
#fastapi ⇒ Object
68 69 70 |
# File 'lib/fastapi/extension.rb', line 68 def fastapi FastAPI::Wrapper.new(self) end |
#fastapi_custom_order ⇒ Object
48 49 50 |
# File 'lib/fastapi/extension.rb', line 48 def fastapi_custom_order @fastapi_custom_order || {} end |
#fastapi_default_filters(filters) ⇒ Hash
Used to set any default filters for the top level fastapi response
36 37 38 |
# File 'lib/fastapi/extension.rb', line 36 def fastapi_default_filters(filters) @fastapi_filters = filters end |
#fastapi_define_order(keys) ⇒ Hash
Define custom ORDER BY strings for specific keys
44 45 46 |
# File 'lib/fastapi/extension.rb', line 44 def fastapi_define_order(keys) @fastapi_custom_order = keys end |
#fastapi_fields ⇒ Object
52 53 54 |
# File 'lib/fastapi/extension.rb', line 52 def fastapi_fields @fastapi_fields || [:id] end |
#fastapi_fields_sub ⇒ Object
56 57 58 |
# File 'lib/fastapi/extension.rb', line 56 def fastapi_fields_sub @fastapi_fields_sub || [:id] end |
#fastapi_filters ⇒ Object
64 65 66 |
# File 'lib/fastapi/extension.rb', line 64 def fastapi_filters @fastapi_filters || {} end |
#fastapi_filters_whitelist ⇒ Object
60 61 62 |
# File 'lib/fastapi/extension.rb', line 60 def fastapi_filters_whitelist @fastapi_filters_whitelist || @fastapi_fields || [:id] end |
#fastapi_safe_fields(fields) ⇒ Array
Set safe fields for FastAPIInstance.safe_filter These are the fields that can be actively filtered by
28 29 30 |
# File 'lib/fastapi/extension.rb', line 28 def fastapi_safe_fields(fields) @fastapi_filters_whitelist = fields end |
#fastapi_standard_interface(fields) ⇒ Array
Used to set the standard interface for the top level of a fastapi response
11 12 13 |
# File 'lib/fastapi/extension.rb', line 11 def fastapi_standard_interface(fields) @fastapi_fields = fields end |
#fastapi_standard_interface_nested(fields) ⇒ Array
Used to set the standard interface for the second level of a fastapi response (nested)
19 20 21 |
# File 'lib/fastapi/extension.rb', line 19 def fastapi_standard_interface_nested(fields) @fastapi_fields_sub = fields end |