Skip to content

Instantly share code, notes, and snippets.

@ddikman
Created January 18, 2022 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddikman/c673b1763fedbc985e359707e9356059 to your computer and use it in GitHub Desktop.
Save ddikman/c673b1763fedbc985e359707e9356059 to your computer and use it in GitHub Desktop.
在庫連携するためのRuby例
require 'net/http'
File.open("MY_CSV_FILE.csv") do |csv_file|
uri = URI.parse('https://api.facy.jp/integration/inventory')
req = Net::HTTP::Post.new(uri.path)
req["X-Api-Key"] = "MY_KEY"
req.set_form([["file", csv_file]], "multipart/form-data")
res = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
http.request(req)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment