Sha256: ebf279191016d5683a105b55eb6968509583459011a4f06242158218d23d5566

Contents?: true

Size: 505 Bytes

Versions: 23

Compression:

Stored size: 505 Bytes

Contents

module Locomotive::Coal
  module Resources

    class ContentTypes < Base

      def by_slug(slug)
        get('content_types').each do |attributes|
          return Resource.new(attributes) if attributes['slug'].to_s == slug.to_s
        end
        nil
      end

      def method_missing(meth, *args)
        if content_type = by_slug(meth)
          Locomotive::Coal::Resources::ContentEntries.new(uri, credentials, content_type)
        else
          super
        end
      end

    end

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
locomotivecms_coal-1.8.0.alpha1 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.7.0 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.6.0 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.6.0.rc2 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.6.0.rc1 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.6.0.beta1 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.5.1 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.5.0 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.4.0 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.3.0 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.3.0.rc1 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.3.0.rc lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.2.0 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.1.0 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.0.0 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.0.0.rc4 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.0.0.rc3 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.0.0.rc2 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.0.0.rc1 lib/locomotive/coal/resources/content_types.rb
locomotivecms_coal-1.0.0.pre.beta.2 lib/locomotive/coal/resources/content_types.rb