Class: Ari::ListResource

Inherits:
Object
  • Object
show all
Defined in:
lib/ari/list_resource.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, resource_klass) ⇒ ListResource

Returns a new instance of ListResource.


4
5
6
7
# File 'lib/ari/list_resource.rb', line 4

def initialize(client, resource_klass)
  @client = client
  @resource_klass = resource_klass
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (private)


11
12
13
14
15
16
17
18
19
20
# File 'lib/ari/list_resource.rb', line 11

def method_missing(method, *args, &block)
  if @resource_klass.respond_to? method
    options = args.first
    options ||= {}
    options.merge!(client: @client)
    @resource_klass.send(method, options, &block)
  else
    super
  end
end