Sha256: cffcf28098e77b14225f2964517e0192dd519c690642656cf1cc234ec9e49268
Contents?: true
Size: 978 Bytes
Versions: 1
Compression:
Stored size: 978 Bytes
Contents
# frozen_string_literal: true module Qravan # Resource processing class class Resource attr_accessor :connections, :cargo def initialize(name, data, cargo = {}) @resource = name @resource_data = data @cargo ||= cargo @connections = cargo.connections end def validate @resource_data end def extract source_name = "#{cargo.models[@resource]["extract"]["source"]["name"]}_source" @connections[source_name.to_s].extract(sql) end def sql [ :select, @resource_data["attributes"].join(","), :from, cargo.models[@resource]["extract"]["source"]["table"], where ].flatten.join(" ") end def where if @resource_data["conditions"] [ :where, @resource_data["conditions"].map { |k, v| "#{k}='#{v}'" } .join(" and ") ] else [""] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
qravan-0.1.1 | lib/qravan/resource/resource.rb |