Module: Miasma::Utils::ApiMethoding

Included in:
Types::Collection, Types::Model
Defined in:
lib/miasma/utils/api_methoding.rb

Instance Method Summary collapse

Instance Method Details

#api_method_for(action) ⇒ Object

Generate the supported API method for a given action



9
10
11
12
13
# File 'lib/miasma/utils/api_methoding.rb', line 9

def api_method_for(action)
  klass = self.respond_to?(:model) ? model : self.class
  m_name = "#{Bogo::Utility.snake(klass.name.split("::").last)}_#{action}"
  self.api.respond_to?(m_name) ? m_name : nil
end