Sha256: c7a317d6f931565570365ea6d696820bcf6a8a351bbc5c9375bb62cebd66dd49

Contents?: true

Size: 470 Bytes

Versions: 1

Compression:

Stored size: 470 Bytes

Contents

module PostmanMta
  class ApiClient
    [:get, :post, :put, :patch, :delete].each do |type|
      define_method type do |url, options = {}|
        perform_request(type.to_s.upcase, url, options)
      end
    end

    private

    def perform_request(request_type, path, options = {})
      api_request = ApiRequest.new(request_type, path, options)
      response = api_request.perform

      { json: response.parsed_response, status: response.code }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
postman_mta-0.1.4 lib/postman_mta/api_client.rb