Blame view

lib/syspro/api_operations/request.rb 617 Bytes
db76748d   Isaac Lewis   cop a bunch of St...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  module Syspro
    module ApiOperations
      module Request
        def request(method, url, params = {}, opts = {})
            client = SysproClient.active_client
  
            headers = opts.clone
  
            resp = client.execute_request(
              method, url,
              headers: headers,
              params: params
            )
  
            resp
        end
  
        def warn_on_opts_in_params(params)
            Util::OPTS_USER_SPECIFIED.each do |opt|
              if params.key?(opt)
                $stderr.puts("WARNING: #{opt} should be in opts instead of params.")
              end
            end
        end
      end
    end
  end