module ForstokTrigger::Qc::Repository::QcRepository

This TriggerRepository is class for connect to database

Public Class Methods

configuration() click to toggle source
# File lib/forstok_trigger/qc/repository/qc_repository.rb, line 31
def self.configuration
  @configuration ||= ForstokTrigger::Qc.configuration
end
now() click to toggle source
# File lib/forstok_trigger/qc/repository/qc_repository.rb, line 27
def self.now
  @now = Time.now.strftime('%Y-%m-%d %H:%M:%S')
end
qc_insert_pending(listing_id, account_id, channel_id, mode) click to toggle source
# File lib/forstok_trigger/qc/repository/qc_repository.rb, line 21
def self.qc_insert_pending(listing_id, account_id, channel_id, mode)
  sql = qc_insert_query
  sql += qc_insert_value(listing_id, account_id, channel_id, mode)
  ForstokTrigger::Qc::Repository.client.query(sql)
end
qc_insert_query() click to toggle source
# File lib/forstok_trigger/qc/repository/qc_repository.rb, line 8
def self.qc_insert_query
  sql = 'INSERT INTO ' + configuration.db + '.'
  sql += configuration.buffer_table
  sql += '(listing_id, account_id, channel_id, mode, created_at'
  sql += ', updated_at) VALUES '
  sql
end
qc_insert_value(listing_id, account_id, channel_id, mode) click to toggle source
# File lib/forstok_trigger/qc/repository/qc_repository.rb, line 16
def self.qc_insert_value(listing_id, account_id, channel_id, mode)
  "(#{listing_id}, #{account_id}, #{channel_id}, " \
  "'#{mode}', '#{now}', '#{now}')"
end