class Layer::RelationProxy

Attributes

base[R]
resource_type[R]

Public Class Methods

new(base, resource_type, operations = [], &block) click to toggle source
# File lib/layer/relation_proxy.rb, line 7
def initialize(base, resource_type, operations = [], &block)
  @resource_type = resource_type
  @base = base

  operations.each { |operation| singleton_class.send(:include, operation::ClassMethods) }

  instance_eval(&block) if block_given?
end

Public Instance Methods

client() click to toggle source
# File lib/layer/relation_proxy.rb, line 24
def client
  base.client
end
each(&block) click to toggle source
# File lib/layer/relation_proxy.rb, line 28
def each(&block)
  all.each(&block)
end
respond_to_missing?(method, include_private = false) click to toggle source
Calls superclass method
# File lib/layer/relation_proxy.rb, line 20
def respond_to_missing?(method, include_private = false)
  resource_type.respond_to?(method, include_private) || super
end
url() click to toggle source
# File lib/layer/relation_proxy.rb, line 16
def url
  "#{base.url}#{resource_type.url}"
end

Private Instance Methods

method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/layer/relation_proxy.rb, line 34
def method_missing(method, *args, &block)
  if resource_type.respond_to?(method)
    resource_type.public_send(method, *args, &block)
  else
    super
  end
end