Module: DlocalGo::EndpointGenerator::ClassMethods
- Defined in:
- lib/dlocal_go/endpoint_generator.rb
Overview
“Define the DSL”
Instance Method Summary collapse
Instance Method Details
#endpoint(method, uri:, verb:, dto_class:) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dlocal_go/endpoint_generator.rb', line 19 def endpoint(method, uri:, verb:, dto_class:) define_method(method) do |params = {}| if params[:country].present? && supported_countries.exclude?(params[:country]) raise DlocalGo::Error, "Unsupported country" end response = call_api(verb, uri, params) parse_response(response, dto_class) end end |