Module: ForstokTrigger::Validity::Repository::ValidityRepository
- Defined in:
- lib/forstok_trigger/validity/repository/validity_repository.rb
Overview
This TriggerRepository is class for connect to database
Class Method Summary collapse
- .configuration ⇒ Object
- .now ⇒ Object
- .validity_insert_pending(l_id, a_id, c_id, mode) ⇒ Object
- .validity_insert_query ⇒ Object
- .validity_insert_value(listing_id, account_id, channel_id, mode) ⇒ Object
Class Method Details
.configuration ⇒ Object
31 32 33 |
# File 'lib/forstok_trigger/validity/repository/validity_repository.rb', line 31 def self.configuration @configuration ||= ForstokTrigger::Validity.configuration end |
.now ⇒ Object
27 28 29 |
# File 'lib/forstok_trigger/validity/repository/validity_repository.rb', line 27 def self.now @now = Time.now.strftime('%Y-%m-%d %H:%M:%S') end |
.validity_insert_pending(l_id, a_id, c_id, mode) ⇒ Object
21 22 23 24 25 |
# File 'lib/forstok_trigger/validity/repository/validity_repository.rb', line 21 def self.validity_insert_pending(l_id, a_id, c_id, mode) sql = validity_insert_query sql += validity_insert_value(l_id, a_id, c_id, mode) ForstokTrigger::Validity::Repository.client.query(sql) end |
.validity_insert_query ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/forstok_trigger/validity/repository/validity_repository.rb', line 8 def self.validity_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 |
.validity_insert_value(listing_id, account_id, channel_id, mode) ⇒ Object
16 17 18 19 |
# File 'lib/forstok_trigger/validity/repository/validity_repository.rb', line 16 def self.validity_insert_value(listing_id, account_id, channel_id, mode) "(#{listing_id}, #{account_id}, #{channel_id}, " \ "'#{mode}', '#{now}', '#{now}')" end |