Sha256: 7eef5c0308a1fd3dcf3e1dba90f7b272a654395d0b5a97aeee0186dd305f7e7c
Contents?: true
Size: 856 Bytes
Versions: 9
Compression:
Stored size: 856 Bytes
Contents
# frozen_string_literal: true class <%= "#{class_name}ApiClient" %> < ::ApplicationApiClient endpoint '<%= options[:endpoint] %>' # error_handling json: { '$.errors.code': 10 }, raise: MyApiClient::Error def initialize end <% yeild_request_arguments do |action, http_method, pathname| -%> # <%= "#{http_method.upcase} #{pathname}" %> # # @return [Sawyer::Resource] description_of_the_api_response # @raise [MyApiClient::Error] description_of_the_error # @see Reference of the API def <%= action %> <% if http_method == 'get' -%> query = {} <%= http_method %> '<%= pathname %>', query: query, headers: headers <% else -%> body = {} <%= http_method %> '<%= pathname %>', body: body, headers: headers <% end -%> end <% end -%> private def headers { 'Content-Type': 'application/json', } end end
Version data entries
9 entries across 9 versions & 1 rubygems