forstok_trigger 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/forstok_trigger/configuration/qc_configuration.rb +10 -0
- data/lib/forstok_trigger/qc/repository/qc_repository.rb +33 -0
- data/lib/forstok_trigger/qc/repository.rb +23 -0
- data/lib/forstok_trigger/qc/trigger.rb +19 -0
- data/lib/forstok_trigger/qc.rb +21 -0
- data/lib/forstok_trigger/version.rb +1 -1
- data/lib/forstok_trigger/webhook/repository/webhook_repository.rb +5 -5
- data/lib/forstok_trigger/webhook/trigger.rb +2 -1
- data/lib/forstok_trigger.rb +8 -0
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 680084f410b41a247a1de1be567266dc33acfe99e32a5d7f3e16752c0a8da541
|
4
|
+
data.tar.gz: 10952edaa0d5eef0a7729dafde6b32e690ed34591a621c7e2413551542e15c26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6179d09cd188d91b27fc96678e0db1bee4811c92b856f5fdb29f1a09b34891fcc08b035bb6ee239f1dd1ddd136f25cac2fa17f4dcc4a07df7a056aa94a73ba78
|
7
|
+
data.tar.gz: 1fa7ec2e062479f14a812acbc6811d8bbca8f2b47971d8285cf43a2bab20929da4b29e739f671d5b4448b8d6fdf69fbedb31eeee9a145236492898cd6101694c
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ForstokTrigger
|
4
|
+
module Qc
|
5
|
+
module Repository
|
6
|
+
# This TriggerRepository is class for connect to database
|
7
|
+
module QcRepository
|
8
|
+
def self.qc_insert_query
|
9
|
+
sql = 'INSERT INTO ' + configuration.db + '.'
|
10
|
+
sql += configuration.buffer_table
|
11
|
+
sql += '(listing_id, account_id, channel_id, mode) VALUES '
|
12
|
+
sql
|
13
|
+
end
|
14
|
+
|
15
|
+
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
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.qc_insert_pending(listing_id, account_id, channel_id, mode)
|
22
|
+
sql = qc_insert_query
|
23
|
+
sql += qc_insert_value(listing_id, account_id, channel_id, mode)
|
24
|
+
ForstokTrigger::Qc::Repository.client.query(sql)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.configuration
|
28
|
+
@configuration ||= ForstokTrigger::Qc.configuration
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'mysql2'
|
4
|
+
module ForstokTrigger
|
5
|
+
module Qc
|
6
|
+
# Class Trigger is main class for run perform
|
7
|
+
module Repository
|
8
|
+
def self.client
|
9
|
+
Mysql2::Client.new(
|
10
|
+
host: configuration.host,
|
11
|
+
port: configuration.port,
|
12
|
+
username: configuration.username,
|
13
|
+
password: configuration.password,
|
14
|
+
database: configuration.db
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.configuration
|
19
|
+
@configuration ||= ForstokTrigger::Qc.configuration
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'forstok_trigger/qc/repository/qc_repository.rb'
|
4
|
+
module ForstokTrigger
|
5
|
+
module Qc
|
6
|
+
# Module Trigger is main module for run perform qc trigger
|
7
|
+
module Trigger
|
8
|
+
def self.perform(listing_id, account_id, channel_id, mode)
|
9
|
+
ForstokTrigger::Qc::Repository::QcRepository
|
10
|
+
.qc_insert_pending(
|
11
|
+
listing_id,
|
12
|
+
account_id,
|
13
|
+
channel_id,
|
14
|
+
mode
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'forstok_trigger/qc/trigger.rb'
|
4
|
+
require 'forstok_trigger/qc/repository/qc_repository.rb'
|
5
|
+
require 'forstok_trigger/configuration/qc_configuration.rb'
|
6
|
+
module ForstokTrigger
|
7
|
+
# Class Trigger is main class for run perform
|
8
|
+
module Qc
|
9
|
+
def self.configuration
|
10
|
+
@configuration ||= ForstokTrigger::Configuration::QcConfiguration.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.reset
|
14
|
+
@configuration = ForstokTrigger::Configuration::QcConfiguration.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.configure
|
18
|
+
yield(configuration)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -39,19 +39,19 @@ module ForstokTrigger
|
|
39
39
|
def self.webhook_insert_query
|
40
40
|
sql = 'INSERT INTO ' + configuration.db + '.'
|
41
41
|
sql += configuration.buffer_table
|
42
|
-
sql += '(url, event, event_payload) VALUES '
|
42
|
+
sql += '(url, event, event_payload, channel_id) VALUES '
|
43
43
|
sql
|
44
44
|
end
|
45
45
|
|
46
|
-
def self.webhook_insert_value(event, url, event_payload)
|
46
|
+
def self.webhook_insert_value(event, url, event_payload, channel_id)
|
47
47
|
sql = "('" + url.to_s + "', '" + event.to_s + "', "
|
48
|
-
sql += event_payload.to_s + ')'
|
48
|
+
sql += event_payload.to_s + ', ' + channel_id.to_s + ')'
|
49
49
|
sql
|
50
50
|
end
|
51
51
|
|
52
|
-
def self.webhook_insert_pending(event, url, event_payload)
|
52
|
+
def self.webhook_insert_pending(event, url, event_payload, channel_id)
|
53
53
|
sql = webhook_insert_query
|
54
|
-
sql += webhook_insert_value(event, url, event_payload)
|
54
|
+
sql += webhook_insert_value(event, url, event_payload, channel_id)
|
55
55
|
ForstokTrigger::Webhook::Repository.client.query(sql)
|
56
56
|
end
|
57
57
|
|
data/lib/forstok_trigger.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'forstok_trigger/version'
|
4
4
|
require 'forstok_trigger/webhook'
|
5
5
|
require 'forstok_trigger/export'
|
6
|
+
require 'forstok_trigger/qc'
|
7
|
+
require 'forstok_trigger/validity'
|
6
8
|
require 'forstok_trigger/configuration'
|
7
9
|
require 'forstok_trigger/webhook/trigger'
|
8
10
|
require 'forstok_trigger/webhook/repository'
|
@@ -10,6 +12,12 @@ require 'forstok_trigger/webhook/repository/webhook_repository'
|
|
10
12
|
require 'forstok_trigger/export/trigger'
|
11
13
|
require 'forstok_trigger/export/repository'
|
12
14
|
require 'forstok_trigger/export/repository/export_repository'
|
15
|
+
require 'forstok_trigger/qc/trigger'
|
16
|
+
require 'forstok_trigger/qc/repository'
|
17
|
+
require 'forstok_trigger/qc/repository/qc_repository'
|
18
|
+
require 'forstok_trigger/validity/trigger'
|
19
|
+
require 'forstok_trigger/validity/repository'
|
20
|
+
require 'forstok_trigger/validity/repository/validity_repository'
|
13
21
|
|
14
22
|
module ForstokTrigger
|
15
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forstok_trigger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Ivander
|
@@ -104,12 +104,17 @@ files:
|
|
104
104
|
- lib/forstok_trigger.rb
|
105
105
|
- lib/forstok_trigger/configuration.rb
|
106
106
|
- lib/forstok_trigger/configuration/export_configuration.rb
|
107
|
+
- lib/forstok_trigger/configuration/qc_configuration.rb
|
107
108
|
- lib/forstok_trigger/configuration/validity_configuration.rb
|
108
109
|
- lib/forstok_trigger/configuration/webhook_configuration.rb
|
109
110
|
- lib/forstok_trigger/export.rb
|
110
111
|
- lib/forstok_trigger/export/repository.rb
|
111
112
|
- lib/forstok_trigger/export/repository/export_repository.rb
|
112
113
|
- lib/forstok_trigger/export/trigger.rb
|
114
|
+
- lib/forstok_trigger/qc.rb
|
115
|
+
- lib/forstok_trigger/qc/repository.rb
|
116
|
+
- lib/forstok_trigger/qc/repository/qc_repository.rb
|
117
|
+
- lib/forstok_trigger/qc/trigger.rb
|
113
118
|
- lib/forstok_trigger/validity.rb
|
114
119
|
- lib/forstok_trigger/validity/repository.rb
|
115
120
|
- lib/forstok_trigger/validity/repository/validity_repository.rb
|