Module: LazyAnt::DSL::Endpoint::ClassMethods

Defined in:
lib/lazy_ant/dsl/endpoint.rb

Instance Method Summary collapse

Instance Method Details

#api(name, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/lazy_ant/dsl/endpoint.rb', line 12

def api(name, options = {})
  method, path = endpoint(options)
  converter = entity_converter(options)
  define_method name do |*args|
    params = args.extract_options!
    path = generate_url(path, args)
    response = connection.send(method, path, params)
    converter.call(response.body)
  end
end