Module: Booqable::Resources
- Included in:
- Client
- Defined in:
- lib/booqable/resources.rb
Overview
Resource-related methods for Client
This module dynamically defines methods for each resource listed in the ‘resources.json` file. Each resource method returns a ResourceProxy that provides standard CRUD operations for that resource type.
The resources.json file can contain either simple strings or hash mappings for aliases. For example:
This would define the following methods on Client:
-
‘orders` - returns ResourceProxy for orders
-
‘customers` - returns ResourceProxy for customers
-
‘order_status_transitions` - returns ResourceProxy for order_status_transitions
-
‘transitions` - alias for order_status_transitions
Constant Summary collapse
- RESOURCES_FILE_PATH =
Path to the resources definition file
File.join(File.dirname(__FILE__), "resources.json")
- ALL_RESOURCES =
All resources loaded from the resources.json file
JSON.parse(File.read(RESOURCES_FILE_PATH))