Class: PramataFileDelivery::ContractController

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/pramata_file_delivery/contract_controller.rb

Instance Method Summary collapse

Instance Method Details

#get_object(key) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'app/controllers/pramata_file_delivery/contract_controller.rb', line 11

def get_object key
  t = @tenant
  s3 = Aws::S3::Client.new(
    region:               t.s3_region,
    access_key_id:        t.s3_access_key,
    secret_access_key:    t.s3_access_secret
  )
  s3.get_object(key: key, bucket: t.s3_bucket_name).body
end

#pdfObject



4
5
6
7
8
9
# File 'app/controllers/pramata_file_delivery/contract_controller.rb', line 4

def pdf
  # render json: {}.to_json
  # return
  res = get_object "contract_file/po_number/#{@pramata_number}.pdf"
  send_data res.read, :type => "application/pdf", :disposition => 'inline'
end