Module: Payjp::APIOperations::Request::ClassMethods
- Defined in:
- lib/payjp/api_operations/request.rb
Constant Summary collapse
- OPTS_KEYS_TO_PERSIST =
Set[:api_key, :api_base, :payjp_account, :payjp_version]
Instance Method Summary collapse
Instance Method Details
#request(method, url, params = {}, opts = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/payjp/api_operations/request.rb', line 7 def request(method, url, params = {}, opts = {}) opts = Util.normalize_opts(opts) headers = opts.clone api_key = headers.delete(:api_key) api_base = headers.delete(:api_base) # Assume all remaining opts must be headers response, opts[:api_key] = Payjp.request(method, url, api_key, params, headers, api_base) # Hash#select returns an array before 1.9 opts_to_persist = {} opts.each do |k, v| opts_to_persist[k] = v if OPTS_KEYS_TO_PERSIST.include?(k) end [response, opts_to_persist] end |