Class: Panda::Proxy

Inherits:
Object
  • Object
show all
Includes:
Builders::ClassMethods, CloudConnection, Finders::FindMany, Finders::FindOne, Router::ClassMethods
Defined in:
lib/panda/proxies/proxy.rb

Direct Known Subclasses

Scope

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CloudConnection

#connection

Methods included from Finders::FindOne

#find, #find_by_path, #find_object_by_path

Methods included from Finders::FindMany

#all, #find_by

Methods included from Builders::ClassMethods

#create, #create!

Methods included from Router::ClassMethods

#build_hash_many_path, #create_rest_url, #many_path, #match, #one_path, #resource_path

Constructor Details

#initialize(parent, klass) ⇒ Proxy

Returns a new instance of Proxy.



13
14
15
16
# File 'lib/panda/proxies/proxy.rb', line 13

def initialize(parent, klass)
  @parent = parent
  @klass = klass
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Panda::Finders::FindMany

Instance Attribute Details

#klassObject

Returns the value of attribute klass.



11
12
13
# File 'lib/panda/proxies/proxy.rb', line 11

def klass
  @klass
end

#parentObject

Returns the value of attribute parent.



11
12
13
# File 'lib/panda/proxies/proxy.rb', line 11

def parent
  @parent
end

Instance Method Details

#cloudObject



18
19
20
# File 'lib/panda/proxies/proxy.rb', line 18

def cloud
  @parent.is_a?(Cloud) ? @parent : @parent.cloud
end

#sti_nameObject



22
23
24
# File 'lib/panda/proxies/proxy.rb', line 22

def sti_name
  klass.sti_name
end