Module: ForstokTrigger::Export::Repository::ExportRepository
- Defined in:
- lib/forstok_trigger/export/repository/export_repository.rb
Overview
This TriggerRepository is class for connect to database
Class Method Summary collapse
- .configuration ⇒ Object
- .export_insert_pending(listing_id, account_id, channel_id, mode) ⇒ Object
- .export_insert_query ⇒ Object
- .export_insert_value(listing_id, account_id, channel_id, mode) ⇒ Object
- .now ⇒ Object
Class Method Details
.configuration ⇒ Object
31 32 33 |
# 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) ⇒ Object
21 22 23 24 25 |
# 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 ⇒ Object
8 9 10 11 12 13 14 |
# 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) ⇒ Object
16 17 18 19 |
# 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 ⇒ Object
27 28 29 |
# 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 |