lib/pina/rest_adapter.rb in pina-0.14.0 vs lib/pina/rest_adapter.rb in pina-0.14.2
- old
+ new
@@ -60,11 +60,11 @@
}
end
def headers
auth_header.merge('Accept-Encoding' => 'application/json',
- 'Content-Type' => 'application/json')
+ 'Content-Type' => 'application/json')
end
def request(uri, method, payload)
request = net_http_class_for(method).new(uri)
headers.each do |k, v|
@@ -85,10 +85,11 @@
def multipart_payload(payload)
return payload unless payload.is_a? Hash
payload.map do |key, val|
next unless val.respond_to?(:path)
+
payload[key] = UploadIO.new(val, 'application/pdf', val.path.split('/').last)
end
payload
end
@@ -103,10 +104,10 @@
Pina.configuration.base_url + "#{resource}/#{id_or_params}"
end
end
def prepare_params_for_request(params)
- params.map { |key, value| "#{URI::escape(key.to_s)}=#{URI::escape(value.to_s)}" }.join('&')
+ params.map { |key, value| "#{URI.escape(key.to_s)}=#{URI.escape(value.to_s)}" }.join('&')
end
def resource_with_namespace(*resource)
resource.join('/')
end