# frozen_string_literal: true module Meroku # Logic related to making rest api calls to backend rails server module Api def post(data) # response = RestClient.post "https://www.example.net", data.to_json # puts "DB8 #{response.inspect}" # true # response = RestClient.post(url, data.to_json, # timeout: 1, # content_type: :json, # accept: :json) # r = JSON.parse(response) # yield(r["data"]) if r.key?("data") # return unless r.key?("errors") && r["errors"].size.positive? # puts "error: #{r['errors'].map { |x| x['detail'] }.join('. ')}" end end end