lib/web_merge/api.rb in web_merge-1.0.2 vs lib/web_merge/api.rb in web_merge-1.0.3

- old
+ new

@@ -33,10 +33,14 @@ def get_document_fields(doc_id, &block) get("#{WebMerge::Constants::DOCUMENTS}/#{doc_id}/fields", &block) end + def get_document_file(doc_id, &block) + get("#{WebMerge::Constants::DOCUMENTS}/#{doc_id}/file", &block) + end + # doc_id The Document ID # example: 436346 # doc_key The Document Key # example: firm3 # field_mappings The data to be merged in name/value pairs @@ -96,12 +100,12 @@ def request(verb, url_string, form_data = nil, &block) parsed_response_body = nil uri = URI.parse(url_string) Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http| action_klass = "Net::HTTP::#{verb.camelize}".constantize - request = action_klass.new(uri.request_uri) + request = action_klass.new(uri.request_uri, 'Content-Type' => 'application/json') request.basic_auth(@api_key, @api_secret) - request.set_form_data(form_data) if form_data.present? + request.body = form_data.to_json if form_data.present? http.request(request) do |response| if block_given? return block.call(response) else begin