Class: BigDoor::NamedLevelCollection

Inherits:
Object
  • Object
show all
Includes:
ClassMethods
Defined in:
lib/big-door/named_level_collection.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ClassMethods

app_key, included, #parse_out_classes, #perform_request, #remote_id, secret_key

Constructor Details

#initialize(params) ⇒ NamedLevelCollection

Returns a new instance of NamedLevelCollection.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/big-door/named_level_collection.rb', line 5

def initialize(params)
  params.each_pair do |key, val|
    self.class.class_eval do
      next if self.instance_methods.include?(key) and key.to_s != 'id'
      self.instance_eval do
        attr_accessor key
      end
    end
    instance_variable_set("@#{key}", val)
  end

  self.named_levels = parse_out_classes(params['named_levels'])
end

Class Method Details

.allObject



19
20
21
# File 'lib/big-door/named_level_collection.rb', line 19

def self.all
  perform_request('get', 'named_level_collection')
end

.find(params = {}) ⇒ Object



23
24
25
# File 'lib/big-door/named_level_collection.rb', line 23

def self.find(params={})
  results = perform_request('get', 'named_level_collection', params)
end