Sha256: 4d70c09e1309e283960479ce36365759c49a1d6a2a576c922b71f6b6fb4a9fc1

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

module Panda
  class EncodingScope < Scope

    def initialize(parent)
      super(parent, Encoding)
    end

    def non_delegate_methods
      super + [:status, :profile_id, :profile_name, :video, :page, :per_page, :[]]
    end

    def page(this_page)
      @scoped_attributes[:page] = this_page
      self
    end

    def per_page(this_per_page)
      @scoped_attributes[:per_page] = this_per_page
      self
    end

    def video(this_video_id)
      @scoped_attributes[:video_id] = this_video_id
      self
    end

    def status(this_status)
      @scoped_attributes[:status] = this_status
      self
    end

    def profile(this_profile_id)
      @scoped_attributes[:profile_id] = this_profile_id
      self
    end

    def profile_name(this_profile_name)
      @scoped_attributes[:profile_name] = this_profile_name 
      self
    end

    def find_by_profile_name(this_profile_name)
      @scoped_attributes[:profile_name] = this_profile_name
      trigger_request.first
    end

    def [](index)
      if(index.is_a? String)
        proxy_found.select{|e| e.profile_name == index}[0]
      else
        proxy_found[index]
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
panda-1.6.1 lib/panda/proxies/encoding_scope.rb
panda-1.6.0 lib/panda/proxies/encoding_scope.rb
panda-1.5.0 lib/panda/proxies/encoding_scope.rb