module Neutrino::AudiomaticRails

This module providing methods to extend your ActiveRecord model to simplify use Audiomatic.
If you want to use them, you'll need to include it in your model:

   class MyModel < ApplicationRecord
     include Neutrino::AudiomaticRails::Model
   end

And now you can customize your model. You have to show your model file to anlyze and set up what you want to analyze

=== Example:

   class MyModel < ApplicationRecord
     include Neutrino::AudiomaticRails::Model
      audiomatic_file_url :my_url=
      analyze :duraion, field: :duration
   end

Constants

VERSION

Public Class Methods

add_route(klass, strategy) click to toggle source
# File lib/neutrino_audiomatic_rails.rb, line 17
def self.add_route(klass, strategy)
  @@routes[klass] = {auth_strategy: strategy}
end
gen_callback_path(model, options={}) click to toggle source
# File lib/neutrino_audiomatic_rails.rb, line 21
def  self.gen_callback_path(model, options={})
 url = Rails.application.routes.url_helpers.send( "neutrino_audiomatic_#{ model.class.to_s.underscore }_url")
 case Neutrino::AudiomaticRails.routes[model.class][:auth_strategy]
  when :reference  then
    url
  when :signature then  
    url += "?id=#{model.id}"
    hash = Neutrino::AudiomaticRails::HMAC.gen_hash(url)
    url += "&signature=#{hash}"
  end
end
routes() click to toggle source
# File lib/neutrino_audiomatic_rails.rb, line 33
def self.routes
  @@routes
end