Method: PMP::Credential#request

Defined in:
lib/pmp/credential.rb

#request(method, url, body = {}) ⇒ Object

:nodoc:



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/pmp/credential.rb', line 46

def request(method, url, body={}) # :nodoc:

  headers = {
    'Accept' => "*/*",
    'Content-Type' => [:put, :post].include?(method) ? "application/x-www-form-urlencoded" : nil
  }

  conn_opts = current_options.merge({headers: headers, basic_auth: true})

  raw = connection(conn_opts).send(method, url, body)
  PMP::Response.new(raw, {method: method, url: url, body: body})
end