forstok_trigger 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9659938e3fc59397c318c2e6950e5066e78d029b6f723f1c9338d71de34ff99
4
- data.tar.gz: fed552ca07376e37511062d6d86a54f361ca56876a2019deb33bdfc6051520ca
3
+ metadata.gz: 8d9ffb48c10fd3801e0b7d06fd0e55e6f783b78aa617db48373f1b8e0500d23d
4
+ data.tar.gz: f84ea0196b70800c65baa971c977b9fa1bb28a70529981b126fe8b413b419c52
5
5
  SHA512:
6
- metadata.gz: 94400a937beb695877f7772d9cc4fe9e998e0ebf7fbd494de1167ea621b38a3da9366e5e5b229615554770a45a274e8fb0cf113148805c1997b3748e8f65653b
7
- data.tar.gz: c66b701ea536b9765c4199ddaf168ddba3664ecd4f429a5d1ee524c2e32ee280e0ea9c3112c7d2aa3fc3e0e99e2207b44d8e2cb174be3be522ba212e7b1c5394
6
+ metadata.gz: 1503933060dfb1400cb468e70a5dd796023c416c947f27cb7c4ab509e6096f1fee9ae7b08b3e94419aabd8a5ed687ff7e5848b2903b4593ddf2517c089400de0
7
+ data.tar.gz: 0e2efc82a3692676480a0f9b78c75192fbc1a1351ea2607447316e2ecddef4caa6ab1e9628c8d9e88ef99dbf5ff4500356a40291ff0889b6cab4c6367baea5dc
@@ -3,7 +3,7 @@
3
3
  module ForstokTrigger
4
4
  class Configuration
5
5
  # This Configuration class is for initialize config to database
6
- class ValidityConfiguration < Configuration
6
+ class ValidConfiguration < Configuration
7
7
  attr_accessor :buffer_table
8
8
  end
9
9
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'Time'
3
4
  module ForstokTrigger
4
5
  module Export
5
6
  module Repository
@@ -8,14 +9,14 @@ module ForstokTrigger
8
9
  def self.export_insert_query
9
10
  sql = 'INSERT INTO ' + configuration.db + '.'
10
11
  sql += configuration.buffer_table
11
- sql += '(listing_id, account_id, channel_id, mode) VALUES '
12
+ sql += '(listing_id, account_id, channel_id, mode, created_at'
13
+ sql += ', updated_at) VALUES '
12
14
  sql
13
15
  end
14
16
 
15
17
  def self.export_insert_value(listing_id, account_id, channel_id, mode)
16
- sql = '(' + listing_id.to_s + ', ' + account_id.to_s + ', '
17
- sql += channel_id.to_s + ", '" + mode.to_s + "')"
18
- sql
18
+ "(#{listing_id}, #{account_id}, #{channel_id}, " \
19
+ "'#{mode}', '#{now}', '#{now}')"
19
20
  end
20
21
 
21
22
  def self.export_insert_pending(listing_id, account_id, channel_id, mode)
@@ -24,6 +25,10 @@ module ForstokTrigger
24
25
  ForstokTrigger::Export::Repository.client.query(sql)
25
26
  end
26
27
 
28
+ def self.now
29
+ @now = Time.now.strftime('%Y-%m-%d %H:%M:%S')
30
+ end
31
+
27
32
  def self.configuration
28
33
  @configuration ||= ForstokTrigger::Export.configuration
29
34
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'Time'
3
4
  module ForstokTrigger
4
5
  module Qc
5
6
  module Repository
@@ -8,14 +9,14 @@ module ForstokTrigger
8
9
  def self.qc_insert_query
9
10
  sql = 'INSERT INTO ' + configuration.db + '.'
10
11
  sql += configuration.buffer_table
11
- sql += '(listing_id, account_id, channel_id, mode) VALUES '
12
+ sql += '(listing_id, account_id, channel_id, mode, created_at'
13
+ sql += ', updated_at) VALUES '
12
14
  sql
13
15
  end
14
16
 
15
17
  def self.qc_insert_value(listing_id, account_id, channel_id, mode)
16
- sql = '(' + listing_id.to_s + ', ' + account_id.to_s + ', '
17
- sql += channel_id.to_s + ", '" + mode.to_s + "')"
18
- sql
18
+ "(#{listing_id}, #{account_id}, #{channel_id}, " \
19
+ "'#{mode}', '#{now}', '#{now}')"
19
20
  end
20
21
 
21
22
  def self.qc_insert_pending(listing_id, account_id, channel_id, mode)
@@ -24,6 +25,10 @@ module ForstokTrigger
24
25
  ForstokTrigger::Qc::Repository.client.query(sql)
25
26
  end
26
27
 
28
+ def self.now
29
+ @now = Time.now.strftime('%Y-%m-%d %H:%M:%S')
30
+ end
31
+
27
32
  def self.configuration
28
33
  @configuration ||= ForstokTrigger::Qc.configuration
29
34
  end
@@ -2,16 +2,16 @@
2
2
 
3
3
  require 'forstok_trigger/validity/trigger.rb'
4
4
  require 'forstok_trigger/validity/repository/validity_repository.rb'
5
- require 'forstok_trigger/configuration/validity_configuration.rb'
5
+ require 'forstok_trigger/configuration/valid_configuration.rb'
6
6
  module ForstokTrigger
7
7
  # Class Trigger is main class for run perform
8
8
  module Validity
9
9
  def self.configuration
10
- @configuration ||= ForstokTrigger::Configuration::ValidityConfiguration.new
10
+ @configuration ||= ForstokTrigger::Configuration::ValidConfiguration.new
11
11
  end
12
12
 
13
13
  def self.reset
14
- @configuration = ForstokTrigger::Configuration::ValidityConfiguration.new
14
+ @configuration = ForstokTrigger::Configuration::ValidConfiguration.new
15
15
  end
16
16
 
17
17
  def self.configure
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'Time'
3
4
  module ForstokTrigger
4
5
  module Validity
5
6
  module Repository
@@ -8,22 +9,26 @@ module ForstokTrigger
8
9
  def self.validity_insert_query
9
10
  sql = 'INSERT INTO ' + configuration.db + '.'
10
11
  sql += configuration.buffer_table
11
- sql += '(listing_id, account_id, channel_id, mode) VALUES '
12
+ sql += '(listing_id, account_id, channel_id, mode, created_at'
13
+ sql += ', updated_at) VALUES '
12
14
  sql
13
15
  end
14
16
 
15
17
  def self.validity_insert_value(listing_id, account_id, channel_id, mode)
16
- sql = '(' + listing_id.to_s + ', ' + account_id.to_s + ', '
17
- sql += channel_id.to_s + ", '" + mode.to_s + "')"
18
- sql
18
+ "(#{listing_id}, #{account_id}, #{channel_id}, " \
19
+ "'#{mode}', '#{now}', '#{now}')"
19
20
  end
20
21
 
21
- def self.validity_insert_pending(listing_id, account_id, channel_id, mode)
22
+ def self.validity_insert_pending(l_id, a_id, c_id, mode)
22
23
  sql = validity_insert_query
23
- sql += validity_insert_value(listing_id, account_id, channel_id, mode)
24
+ sql += validity_insert_value(l_id, a_id, c_id, mode)
24
25
  ForstokTrigger::Validity::Repository.client.query(sql)
25
26
  end
26
27
 
28
+ def self.now
29
+ @now = Time.now.strftime('%Y-%m-%d %H:%M:%S')
30
+ end
31
+
27
32
  def self.configuration
28
33
  @configuration ||= ForstokTrigger::Validity.configuration
29
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForstokTrigger
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
@@ -45,7 +45,7 @@ module ForstokTrigger
45
45
 
46
46
  def self.webhook_insert_value(event, url, event_payload, channel_id)
47
47
  sql = "('" + url.to_s + "', '" + event.to_s + "', \""
48
- sql += Mysql2::Client.escape(event_payload.to_s) + "\", "
48
+ sql += Mysql2::Client.escape(event_payload.to_s) + '\", '
49
49
  sql += channel_id.to_s + ')'
50
50
  sql
51
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forstok_trigger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Ivander
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-10 00:00:00.000000000 Z
11
+ date: 2020-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -105,7 +105,7 @@ files:
105
105
  - lib/forstok_trigger/configuration.rb
106
106
  - lib/forstok_trigger/configuration/export_configuration.rb
107
107
  - lib/forstok_trigger/configuration/qc_configuration.rb
108
- - lib/forstok_trigger/configuration/validity_configuration.rb
108
+ - lib/forstok_trigger/configuration/valid_configuration.rb
109
109
  - lib/forstok_trigger/configuration/webhook_configuration.rb
110
110
  - lib/forstok_trigger/export.rb
111
111
  - lib/forstok_trigger/export/repository.rb