Module: FastAPIExtension::ClassMethods
- Defined in:
- lib/fastapi/active_record_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_fields_whitelist ⇒ Object
- #fastapi_filters ⇒ Object
-
#fastapi_safe_fields(fields) ⇒ Array
Set safe fields for FastAPIInstance.safe_filter.
-
#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
69 70 71 |
# File 'lib/fastapi/active_record_extension.rb', line 69 def fastapi FastAPI.new(self) end |
#fastapi_custom_order ⇒ Object
49 50 51 |
# File 'lib/fastapi/active_record_extension.rb', line 49 def fastapi_custom_order @fastapi_custom_order or {} end |
#fastapi_default_filters(filters) ⇒ Hash
Used to set any default filters for the top level fastapi response
37 38 39 |
# File 'lib/fastapi/active_record_extension.rb', line 37 def fastapi_default_filters(filters) @fastapi_filters = filters end |
#fastapi_define_order(keys) ⇒ Hash
Define custom ORDER BY strings for specific keys
45 46 47 |
# File 'lib/fastapi/active_record_extension.rb', line 45 def fastapi_define_order(keys) @fastapi_custom_order = keys end |
#fastapi_fields ⇒ Object
53 54 55 |
# File 'lib/fastapi/active_record_extension.rb', line 53 def fastapi_fields @fastapi_fields or [:id] end |
#fastapi_fields_sub ⇒ Object
57 58 59 |
# File 'lib/fastapi/active_record_extension.rb', line 57 def fastapi_fields_sub @fastapi_fields_sub or [:id] end |
#fastapi_fields_whitelist ⇒ Object
61 62 63 |
# File 'lib/fastapi/active_record_extension.rb', line 61 def fastapi_fields_whitelist @fastapi_fields_whitelist or @fastapi_fields or [:id] end |
#fastapi_filters ⇒ Object
65 66 67 |
# File 'lib/fastapi/active_record_extension.rb', line 65 def fastapi_filters @fastapi_filters or {} end |
#fastapi_safe_fields(fields) ⇒ Array
Set safe fields for FastAPIInstance.safe_filter
29 30 31 |
# File 'lib/fastapi/active_record_extension.rb', line 29 def fastapi_safe_fields(fields) @fastapi_fields_whitelist = fields end |
#fastapi_standard_interface(fields) ⇒ Array
Used to set the standard interface for the top level of a fastapi response
13 14 15 |
# File 'lib/fastapi/active_record_extension.rb', line 13 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)
21 22 23 |
# File 'lib/fastapi/active_record_extension.rb', line 21 def fastapi_standard_interface_nested(fields) @fastapi_fields_sub = fields end |