Class: Hubspot::FilesConnection

Inherits:
Connection show all
Defined in:
lib/hubspot/connection.rb

Class Method Summary collapse

Methods inherited from Connection

delete_json, get_json, post_json, put_json

Class Method Details

.get(path, opts) ⇒ Object



136
137
138
139
140
141
142
# File 'lib/hubspot/connection.rb', line 136

def get(path, opts)
  url = generate_url(path, opts)
  response = super(url, read_timeout: read_timeout(opts), open_timeout: open_timeout(opts))
  log_request_and_response url, response
  raise(Hubspot::RequestError.new(response)) unless response.success?
  response.parsed_response
end

.post(path, opts) ⇒ Object



144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/hubspot/connection.rb', line 144

def post(path, opts)
  url = generate_url(path, opts[:params])
  response = super(
    url,
    body: opts[:body],
    headers: { 'Content-Type' => 'multipart/form-data' },
    read_timeout: read_timeout(opts), open_timeout: open_timeout(opts)
  )
  log_request_and_response url, response, opts[:body]
  raise(Hubspot::RequestError.new(response)) unless response.success?

  response
end