Class: Qravan::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/qravan/source.rb

Overview

Sources for data extractions class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cargo = {}) ⇒ Source

Returns a new instance of Source.



10
11
12
# File 'lib/qravan/source.rb', line 10

def initialize(cargo = {})
  @sources ||= cargo.sources
end

Instance Attribute Details

#sourcesObject

Returns the value of attribute sources.



8
9
10
# File 'lib/qravan/source.rb', line 8

def sources
  @sources
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/qravan/source.rb', line 14

def call(env)
  body = [unpassworded.to_json]
  status  = 200
  headers = { "content-type" => "application/json" }

  [status, headers, body]
end

#unpasswordedObject



22
23
24
25
# File 'lib/qravan/source.rb', line 22

def unpassworded
  sources.map { |key, value| sources[key]["password"] = "******" if sources[key]["password"] }
  sources
end