Module: RestAPIBuilder::APIClient
- Defined in:
- lib/rest_api_builder/api_client.rb
Instance Method Summary collapse
Instance Method Details
#define_resource_shortcuts(resources, resources_scope:, init_with:) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/rest_api_builder/api_client.rb', line 5 def define_resource_shortcuts(resources, resources_scope:, init_with:) resources.each do |name| class_name = RestAPIBuilder::Helpers::StringHelper.camelize(name.to_s) resource_class = Object.const_get("#{resources_scope}::#{class_name}") define_singleton_method(name) do init_with.call(resource_class) end end end |