Module: LingutestClient::Api::Operations::List
- Defined in:
- lib/lingutest_client/api/operations/list.rb
Constant Summary collapse
- DELEGATED_METHODS =
%i[ each empty? find first last map reject select size ].freeze
Class Method Summary collapse
-
.module(list_type, params_schema = nil) ⇒ Object
rubocop:disable Metrics/MethodLength.
Class Method Details
.module(list_type, params_schema = nil) ⇒ Object
rubocop:disable Metrics/MethodLength
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/lingutest_client/api/operations/list.rb', line 20 def module(list_type, params_schema = nil) # rubocop:disable Metrics/MethodLength Module.new do class_methods_module = Module.new class_methods_module.define_method :list do |**| params = .dup if params_schema result = params_schema.call() raise ArgumentError, result.errors if result.failure? params = result.to_h end list_type.new(Client.get(resource_url, **params).body) end define_singleton_method :included do |base| base.extend class_methods_module end end end |