Sha256: e1878ba00ed8e7f678830de366fe3e12673524addbf63ba76a37ff2bdbdc9248
Contents?: true
Size: 566 Bytes
Versions: 12
Compression:
Stored size: 566 Bytes
Contents
module Meroku module Api # Wrapper around RestClient.post module Request def self.post(url, data) 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 end
Version data entries
12 entries across 12 versions & 1 rubygems