lib/immoscout/models/actions/attachment.rb in immoscout-1.1.0 vs lib/immoscout/models/actions/attachment.rb in immoscout-1.2.0
- old
+ new
@@ -21,10 +21,14 @@
attachable_id = attachable.try(:id) || attachable
response = api.post(
"user/#{api.user_name}/realestate/#{attachable_id}/attachment",
nil,
attachment: Faraday::UploadIO.new(file, content_type, file_name),
- metadata: as_json
+ metadata: Faraday::UploadIO.new(
+ StringIO.new(to_json),
+ 'application/json',
+ 'metadata.json'
+ )
)
handle_response(response)
self.id = id_from_response(response)
self
end