3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/klaviyo/client_dsl.rb', line 3
def define_api_method(resource:, action:)
@@resources ||= {}
@@resources[resource] ||
begin
@@resources[resource] = Class.new do
class << self
attr_accessor :client
def define_action(resource, action)
define_singleton_method action do |*args|
client.invoke(resource, action, *args)
end
end
end
end
define_method resource do
@@resources[resource].client = self
@@resources[resource]
end
end
@@resources[resource].define_action(resource, action)
end
|