module ForstokTrigger::Export::Repository::ExportRepository

This TriggerRepository is class for connect to database

Public Class Methods

configuration() click to toggle source
# File lib/forstok_trigger/export/repository/export_repository.rb, line 31
def self.configuration
  @configuration ||= ForstokTrigger::Export.configuration
end
export_insert_pending(listing_id, account_id, channel_id, mode) click to toggle source
# File lib/forstok_trigger/export/repository/export_repository.rb, line 21
def self.export_insert_pending(listing_id, account_id, channel_id, mode)
  sql = export_insert_query
  sql += export_insert_value(listing_id, account_id, channel_id, mode)
  ForstokTrigger::Export::Repository.client.query(sql)
end
export_insert_query() click to toggle source
# File lib/forstok_trigger/export/repository/export_repository.rb, line 8
def self.export_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
export_insert_value(listing_id, account_id, channel_id, mode) click to toggle source
# File lib/forstok_trigger/export/repository/export_repository.rb, line 16
def self.export_insert_value(listing_id, account_id, channel_id, mode)
  "(#{listing_id}, #{account_id}, #{channel_id}, " \
  "'#{mode}', '#{now}', '#{now}')"
end
now() click to toggle source
# File lib/forstok_trigger/export/repository/export_repository.rb, line 27
def self.now
  @now = Time.now.strftime('%Y-%m-%d %H:%M:%S')
end