Class: SevenApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/seven_api/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ Client

Returns a new instance of Client.

Parameters:



22
23
24
25
26
27
28
29
30
# File 'lib/seven_api/client.rb', line 22

def initialize(resource)
  SevenApi::Util::get_namespace_classes(SevenApi::Resources).each do |cls|
    name = cls.name.split('::').last

    instance_variable_set("@#{name}", cls.new(resource))

    singleton_class.instance_eval("attr_reader :#{name}")
  end
end