Module: ForstokTrigger::Qc::Repository::QcRepository
- Defined in:
- lib/forstok_trigger/qc/repository/qc_repository.rb
Overview
This TriggerRepository is class for connect to database
Class Method Summary collapse
- .configuration ⇒ Object
- .now ⇒ Object
- .qc_insert_pending(listing_id, account_id, channel_id, mode) ⇒ Object
- .qc_insert_query ⇒ Object
- .qc_insert_value(listing_id, account_id, channel_id, mode) ⇒ Object
Class Method Details
.configuration ⇒ Object
31 32 33 |
# File 'lib/forstok_trigger/qc/repository/qc_repository.rb', line 31 def self.configuration @configuration ||= ForstokTrigger::Qc.configuration end |
.now ⇒ Object
27 28 29 |
# 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) ⇒ Object
21 22 23 24 25 |
# 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 ⇒ Object
8 9 10 11 12 13 14 |
# 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) ⇒ Object
16 17 18 19 |
# 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 |