Sha256: 1711c72d4928efca74a81e4315d74b4bc739b76a2f9ed95d4e9ccbc80d40c359
Contents?: true
Size: 732 Bytes
Versions: 1
Compression:
Stored size: 732 Bytes
Contents
require 'rest_in_peace/template_sanitizer' require 'rest_in_peace/api_call' module RESTinPeace class DefinitionProxy class CollectionMethodDefinitions def initialize(target) @target = target end def get(method_name, url_template, default_params = {}) @target.rip_registry[:collection] << { method: :get, name: method_name, url: url_template } @target.send(:define_singleton_method, method_name) do |given_params| params = default_params.merge(given_params) call = RESTinPeace::ApiCall.new(api, url_template, self, params) call.extend(params.delete(:paginate_with)) if params[:paginate_with] call.get end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rest-in-peace-1.2.0 | lib/rest_in_peace/definition_proxy/collection_method_definitions.rb |