webhook_trigger 0.2.0 → 0.2.1
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 +4 -4
- data/.reek.yml +5 -0
- data/Jenkinsfile +18 -0
- data/lib/webhook_trigger/repository.rb +10 -7
- data/lib/webhook_trigger/repository/trigger_repository.rb +25 -11
- data/lib/webhook_trigger/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44e67259d8d301e5ebb37248d8504161c7c919bb01eb527d0947b52bcbe4121c
|
4
|
+
data.tar.gz: bc148ca56ba429239e4a68f1484b4faaab66d1d6fb650928880d7a84246310e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f03040f8109c546dddd0fdbd840b7f5e64f4abeca2ee9556142b26b8a7961886bf24d5e36de9bc48cd5b3e46109850dbf7f24a8787cf8eb326aee0ada984c2a
|
7
|
+
data.tar.gz: 75e81cdbb3c84cfad23a7069986bbe697d8320dea39edbf1ab82f3d054c984c5ef90622f00ce61f64ff2d43cb20cd4f90e7672f3a8cb8d9d3142b533995b9aa9
|
data/.reek.yml
ADDED
data/Jenkinsfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
pipeline {
|
2
|
+
agent none
|
3
|
+
stages{
|
4
|
+
stage('linter'){
|
5
|
+
agent { docker { image 'ruby:2.6.5' } }
|
6
|
+
steps {
|
7
|
+
sh 'gem install rubocop'
|
8
|
+
sh 'gem install reek'
|
9
|
+
sh 'gem install fasterer'
|
10
|
+
sh 'gem install rails_best_practices'
|
11
|
+
sh 'rubocop'
|
12
|
+
sh 'reek'
|
13
|
+
sh 'fasterer'
|
14
|
+
sh 'rails_best_practices .'
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
@@ -4,14 +4,17 @@ module WebhookTrigger
|
|
4
4
|
# Class Trigger is main class for run perform
|
5
5
|
module Repository
|
6
6
|
def self.client
|
7
|
-
|
8
|
-
host:
|
9
|
-
port:
|
10
|
-
username:
|
11
|
-
password:
|
12
|
-
database:
|
7
|
+
Mysql2::Client.new(
|
8
|
+
host: configuration.host,
|
9
|
+
port: configuration.port,
|
10
|
+
username: configuration.username,
|
11
|
+
password: configuration.password,
|
12
|
+
database: configuration.db
|
13
13
|
)
|
14
|
-
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.configuration
|
17
|
+
@configuration ||= WebhookTrigger.configuration
|
15
18
|
end
|
16
19
|
end
|
17
20
|
end
|
@@ -6,25 +6,25 @@ module WebhookTrigger
|
|
6
6
|
# This TriggerRepository is class for connect to database
|
7
7
|
module TriggerRepository
|
8
8
|
def self.webhook_list_query_select
|
9
|
-
sql = 'SELECT ' +
|
10
|
-
sql +=
|
11
|
-
sql +=
|
9
|
+
sql = 'SELECT ' + configuration_list + '.id, '
|
10
|
+
sql += configuration_list + '.url, '
|
11
|
+
sql += configuration_event + '.name '
|
12
12
|
sql += webhook_list_query_join
|
13
13
|
sql
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.webhook_list_query_join
|
17
|
-
sql = ' FROM ' +
|
18
|
-
sql += ' JOIN ' +
|
19
|
-
sql += ' on ' +
|
20
|
-
sql +=
|
17
|
+
sql = ' FROM ' + configuration_list
|
18
|
+
sql += ' JOIN ' + configuration_event
|
19
|
+
sql += ' on ' + configuration_list + '.event_id='
|
20
|
+
sql += configuration_event + '.id '
|
21
21
|
sql
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.webhook_list_query_condition(event, account_id)
|
25
|
-
sql = 'WHERE ' +
|
25
|
+
sql = 'WHERE ' + configuration_list
|
26
26
|
sql += '.account_id=' + account_id.to_s
|
27
|
-
sql += ' AND ' +
|
27
|
+
sql += ' AND ' + configuration_event
|
28
28
|
sql += ".name like '" + event.to_s + "'"
|
29
29
|
sql
|
30
30
|
end
|
@@ -37,8 +37,8 @@ module WebhookTrigger
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def self.webhook_insert_query
|
40
|
-
sql = 'INSERT INTO ' +
|
41
|
-
sql +=
|
40
|
+
sql = 'INSERT INTO ' + configuration.db + '.'
|
41
|
+
sql += configuration.buffer_table
|
42
42
|
sql += '(url, event, event_source_id) VALUES '
|
43
43
|
sql
|
44
44
|
end
|
@@ -54,6 +54,20 @@ module WebhookTrigger
|
|
54
54
|
sql += webhook_insert_value(event, url, event_source_id)
|
55
55
|
WebhookTrigger::Repository.client.query(sql)
|
56
56
|
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def configuration_list
|
61
|
+
configuration_list.list
|
62
|
+
end
|
63
|
+
|
64
|
+
def configuration_event
|
65
|
+
configuration.event
|
66
|
+
end
|
67
|
+
|
68
|
+
def configuration
|
69
|
+
@configuration ||= WebhookTrigger.configuration
|
70
|
+
end
|
57
71
|
end
|
58
72
|
end
|
59
73
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webhook_trigger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
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-01-
|
11
|
+
date: 2020-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -102,11 +102,13 @@ extensions: []
|
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
104
|
- ".gitignore"
|
105
|
+
- ".reek.yml"
|
105
106
|
- ".rspec"
|
106
107
|
- ".rubocop.yml"
|
107
108
|
- ".travis.yml"
|
108
109
|
- CODE_OF_CONDUCT.md
|
109
110
|
- Gemfile
|
111
|
+
- Jenkinsfile
|
110
112
|
- LICENSE.txt
|
111
113
|
- README.md
|
112
114
|
- Rakefile
|