Sha256: f5203163b3511f64c2d7b3c5e65e57009d65f2e4edd29eb200e7aaad05e1a554
Contents?: true
Size: 687 Bytes
Versions: 20
Compression:
Stored size: 687 Bytes
Contents
module Ecoportal module API module Common module DocHelpers def get_body(doc) if doc.respond_to?(:as_update) doc.as_update elsif doc.respond_to?(:as_json) doc.as_json else doc end end def get_id(doc) id = nil id ||= doc.id if doc.respond_to?(:id) id ||= doc.external_id if doc.respond_to?(:external_id) id ||= doc["id"] if doc.is_a?(Hash) id ||= doc["external_id"] if doc.is_a?(Hash) id ||= doc if doc.is_a?(String) id or raise "No ID has been given!" id end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems