Sha256: e53f2506f687bd29f70288ef1278934ddd69ff1f4995d2fb54d8065874863f08
Contents?: true
Size: 941 Bytes
Versions: 5
Compression:
Stored size: 941 Bytes
Contents
# frozen_string_literal: true module Usps module Faraday module Request def get(path, options = {}) request(:get, path, options) end def post(path, options = {}) request(:post, path, options) end def put(path, options = {}) request(:put, path, options) end def delete(path, options = {}) request(:delete, path, options) end private def request(method, path, options) # options = options.merge(token: token) response = connection.send(method) do |request| case method when :get, :delete request.url(path, options) when :post, :put request.path = path request.body = options unless options.empty? end request.options.merge!(options.delete(:request)) if options.key?(:request) end response.body end end end end
Version data entries
5 entries across 5 versions & 1 rubygems