Class: TranslationCms::Api::Requestor

Inherits:
JsonApiClient::Query::Requestor
  • Object
show all
Defined in:
lib/translation_cms/api/requestor.rb

Instance Method Summary collapse

Instance Method Details

#custom(method_name, options, params) ⇒ Object

overriden to remove extra params from associations for custom endpoint methods



7
8
9
10
11
12
13
# File 'lib/translation_cms/api/requestor.rb', line 7

def custom(method_name, options, params)
  path = resource_path(params)
  params.delete(klass.primary_key)
  path = File.join([path, options.fetch(:path, method_name).to_s].reject(&:blank?))
  klass.associations.each { |a| params.delete(a.param) } if klass.associations.present?
  request(options.fetch(:request_method, :get), path, params)
end