class Dhis2::CollectionWrapper

Public Class Methods

new(resource_name, client) click to toggle source
# File lib/dhis2/collection_wrapper.rb, line 5
def initialize(resource_name, client)
  @klass  = get_resource_klass(resource_name)[client.version]
  @client = client
end

Public Instance Methods

method_missing(method_name, *args, &block) click to toggle source
# File lib/dhis2/collection_wrapper.rb, line 10
def method_missing(method_name, *args, &block)
  args = args.unshift(@client)
  @klass.public_send(method_name, *args, &block)
end
respond_to_missing?(method_name) click to toggle source
# File lib/dhis2/collection_wrapper.rb, line 15
def respond_to_missing?(method_name)
  @klass.respond_to? method_name
end

Private Instance Methods

get_resource_klass(resource_name) click to toggle source
# File lib/dhis2/collection_wrapper.rb, line 21
def get_resource_klass(resource_name)
  Object.const_get "Dhis2::#{resource_name}"
end