Sha256: 55a026625d41641656ff682a3733059b262fbc101162311d151b6ecbd93c89c8

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

module KalturaFu
  module Entry
    module Metadata
      
      module ClassAndInstanceMethods
        
        ##
        # Checks if a requested attribute is in fact a valid MediaEntry atrribute.  
        ##
        def valid_entry_attribute?(request_attribute)
          object_methods, media_entry_methods = Object.instance_methods , Kaltura::MediaEntry.instance_methods

          #clean out all the setter methods from the media entry methods
          valid_media_entry_methods = media_entry_methods.map{|m| m unless m =~/^(.*)=/}.compact!

          valid_media_entry_methods -= object_methods
          valid_media_entry_methods.find{|m| m.to_sym == request_attribute.to_sym} ? true : false
        end
         
        ##
        # Determines if an attribute is valid in the sense of the add method making sense.  Only 
        # categories and tags are currently considered valid.
        ## 
        def valid_add_attribute?(request_attribute)
          case request_attribute.to_s
            when /^(.*)_(categor(y|ies)|(tag|tags))/ 
              return true
            when /^(categor(y|ies)|tag)/
              return true
          else
            return false
          end 
        end
        
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kaltura_fu-0.1.3 lib/kaltura_fu/entry/metadata/class_and_instance_methods.rb