forstok_trigger 0.1.0 → 0.1.5
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.rb +8 -0
- data/lib/forstok_trigger/configuration/{validity_configuration.rb → qc_configuration.rb} +1 -1
- data/lib/forstok_trigger/configuration/valid_configuration.rb +10 -0
- data/lib/forstok_trigger/export/repository/export_repository.rb +8 -4
- data/lib/forstok_trigger/qc.rb +21 -0
- data/lib/forstok_trigger/qc/repository.rb +23 -0
- data/lib/forstok_trigger/qc/repository/qc_repository.rb +37 -0
- data/lib/forstok_trigger/qc/trigger.rb +19 -0
- data/lib/forstok_trigger/validity.rb +3 -3
- data/lib/forstok_trigger/validity/repository/validity_repository.rb +10 -6
- data/lib/forstok_trigger/version.rb +1 -1
- data/lib/forstok_trigger/webhook/repository/webhook_repository.rb +7 -6
- data/lib/forstok_trigger/webhook/trigger.rb +2 -1
- metadata +13 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06cf6820f92b3b3fefed2b24df423164d86144cc029186f36e0da41868bb8a3d
|
4
|
+
data.tar.gz: a11b7e9417a5fc51804c82fd19eddb5869e2f41c561d33f10a34b4bc62773f09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c76a0529d3422f75eadf84a8cb9b18164d14f51d2bae22dfaa58d1ed9274380bbe2a5bc5535cb05b84e05bf98b82b346ac761e5d0c1a5c38ffd7dd47c2296a41
|
7
|
+
data.tar.gz: 81790137706adb33b9563576df450c169e2ba97705d811cf029a285c64403dd988ba07f9c8421b1a587a24cf23e8b7d13f5bdd811d401b5b06ef63c74087c090
|
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
|
@@ -8,14 +8,14 @@ module ForstokTrigger
|
|
8
8
|
def self.export_insert_query
|
9
9
|
sql = 'INSERT INTO ' + configuration.db + '.'
|
10
10
|
sql += configuration.buffer_table
|
11
|
-
sql += '(listing_id, account_id, channel_id, mode
|
11
|
+
sql += '(listing_id, account_id, channel_id, mode, created_at'
|
12
|
+
sql += ', updated_at) VALUES '
|
12
13
|
sql
|
13
14
|
end
|
14
15
|
|
15
16
|
def self.export_insert_value(listing_id, account_id, channel_id, mode)
|
16
|
-
|
17
|
-
|
18
|
-
sql
|
17
|
+
"(#{listing_id}, #{account_id}, #{channel_id}, " \
|
18
|
+
"'#{mode}', '#{now}', '#{now}')"
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.export_insert_pending(listing_id, account_id, channel_id, mode)
|
@@ -24,6 +24,10 @@ module ForstokTrigger
|
|
24
24
|
ForstokTrigger::Export::Repository.client.query(sql)
|
25
25
|
end
|
26
26
|
|
27
|
+
def self.now
|
28
|
+
@now = Time.now.strftime('%Y-%m-%d %H:%M:%S')
|
29
|
+
end
|
30
|
+
|
27
31
|
def self.configuration
|
28
32
|
@configuration ||= ForstokTrigger::Export.configuration
|
29
33
|
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
|
@@ -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,37 @@
|
|
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, created_at'
|
12
|
+
sql += ', updated_at) VALUES '
|
13
|
+
sql
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.qc_insert_value(listing_id, account_id, channel_id, mode)
|
17
|
+
"(#{listing_id}, #{account_id}, #{channel_id}, " \
|
18
|
+
"'#{mode}', '#{now}', '#{now}')"
|
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.now
|
28
|
+
@now = Time.now.strftime('%Y-%m-%d %H:%M:%S')
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.configuration
|
32
|
+
@configuration ||= ForstokTrigger::Qc.configuration
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
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
|
@@ -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/
|
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::
|
10
|
+
@configuration ||= ForstokTrigger::Configuration::ValidConfiguration.new
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.reset
|
14
|
-
@configuration = ForstokTrigger::Configuration::
|
14
|
+
@configuration = ForstokTrigger::Configuration::ValidConfiguration.new
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.configure
|
@@ -8,22 +8,26 @@ module ForstokTrigger
|
|
8
8
|
def self.validity_insert_query
|
9
9
|
sql = 'INSERT INTO ' + configuration.db + '.'
|
10
10
|
sql += configuration.buffer_table
|
11
|
-
sql += '(listing_id, account_id, channel_id, mode
|
11
|
+
sql += '(listing_id, account_id, channel_id, mode, created_at'
|
12
|
+
sql += ', updated_at) VALUES '
|
12
13
|
sql
|
13
14
|
end
|
14
15
|
|
15
16
|
def self.validity_insert_value(listing_id, account_id, channel_id, mode)
|
16
|
-
|
17
|
-
|
18
|
-
sql
|
17
|
+
"(#{listing_id}, #{account_id}, #{channel_id}, " \
|
18
|
+
"'#{mode}', '#{now}', '#{now}')"
|
19
19
|
end
|
20
20
|
|
21
|
-
def self.validity_insert_pending(
|
21
|
+
def self.validity_insert_pending(l_id, a_id, c_id, mode)
|
22
22
|
sql = validity_insert_query
|
23
|
-
sql += validity_insert_value(
|
23
|
+
sql += validity_insert_value(l_id, a_id, c_id, mode)
|
24
24
|
ForstokTrigger::Validity::Repository.client.query(sql)
|
25
25
|
end
|
26
26
|
|
27
|
+
def self.now
|
28
|
+
@now = Time.now.strftime('%Y-%m-%d %H:%M:%S')
|
29
|
+
end
|
30
|
+
|
27
31
|
def self.configuration
|
28
32
|
@configuration ||= ForstokTrigger::Validity.configuration
|
29
33
|
end
|
@@ -39,19 +39,20 @@ 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)
|
47
|
-
sql = "('" + url.to_s + "', '" + event.to_s + "', "
|
48
|
-
sql += event_payload.to_s + '
|
46
|
+
def self.webhook_insert_value(event, url, event_payload, channel_id)
|
47
|
+
sql = "('" + url.to_s + "', '" + event.to_s + "', '"
|
48
|
+
sql += Mysql2::Client.escape(event_payload.to_s) + "', "
|
49
|
+
sql += channel_id.to_s + ')'
|
49
50
|
sql
|
50
51
|
end
|
51
52
|
|
52
|
-
def self.webhook_insert_pending(event, url, event_payload)
|
53
|
+
def self.webhook_insert_pending(event, url, event_payload, channel_id)
|
53
54
|
sql = webhook_insert_query
|
54
|
-
sql += webhook_insert_value(event, url, event_payload)
|
55
|
+
sql += webhook_insert_value(event, url, event_payload, channel_id)
|
55
56
|
ForstokTrigger::Webhook::Repository.client.query(sql)
|
56
57
|
end
|
57
58
|
|
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.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Ivander
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -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/
|
107
|
+
- lib/forstok_trigger/configuration/qc_configuration.rb
|
108
|
+
- lib/forstok_trigger/configuration/valid_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
|
@@ -119,13 +124,13 @@ files:
|
|
119
124
|
- lib/forstok_trigger/webhook/repository.rb
|
120
125
|
- lib/forstok_trigger/webhook/repository/webhook_repository.rb
|
121
126
|
- lib/forstok_trigger/webhook/trigger.rb
|
122
|
-
homepage:
|
127
|
+
homepage:
|
123
128
|
licenses:
|
124
129
|
- MIT
|
125
130
|
metadata:
|
126
131
|
allowed_push_host: https://rubygems.org
|
127
132
|
source_code_uri: https://bitbucket.org/forstok/forstok_trigger/src/master
|
128
|
-
post_install_message:
|
133
|
+
post_install_message:
|
129
134
|
rdoc_options: []
|
130
135
|
require_paths:
|
131
136
|
- lib
|
@@ -140,8 +145,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
145
|
- !ruby/object:Gem::Version
|
141
146
|
version: '0'
|
142
147
|
requirements: []
|
143
|
-
rubygems_version: 3.
|
144
|
-
signing_key:
|
148
|
+
rubygems_version: 3.1.4
|
149
|
+
signing_key:
|
145
150
|
specification_version: 4
|
146
151
|
summary: Forstok Trigger
|
147
152
|
test_files: []
|