Sha256: c95d16445b6cae06e2724c7578f979c0239f9c19a912674b0c863d7a5b1240f5

Contents?: true

Size: 484 Bytes

Versions: 2

Compression:

Stored size: 484 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 = ::PostmanMta::ApiRequest.new(request_type, path, options)
      response = api_request.perform

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
postman_mta-0.1.6 lib/postman_mta/api_client.rb
postman_mta-0.1.5 lib/postman_mta/api_client.rb