kenui 2.0.0 → 2.0.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 +5 -5
- data/Rakefile +3 -5
- data/app/controllers/kenui/email_notifications_controller.rb +15 -15
- data/app/helpers/kenui/application_helper.rb +2 -0
- data/app/services/kenui/email_notification_service.rb +13 -15
- data/config/routes.rb +3 -2
- data/lib/kenui.rb +11 -9
- data/lib/kenui/engine.rb +2 -0
- data/lib/kenui/version.rb +3 -1
- data/lib/tasks/kenui_tasks.rake +1 -0
- metadata +64 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b76968b1d5c9dcb1623de1ceac472406ea58af60
|
4
|
+
data.tar.gz: 57501928ef165b590c037073f621e53bd42f6b26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f164f62f6a2e878df64b1834c9b104a5403866943c4291cbce34045250ff89189d78fe7f945e581885a1f057c49c099e13667f57188d6e6c4512ce64edb4c3f
|
7
|
+
data.tar.gz: 939e139a1d58c8cf876aa4203ddc04a1ef80d85544defe8bdaee282e082e0cfa81fbffab9ce5e8c36c3066777501f41a9e4005ba55cab0b9cdd581c6a93ab524
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
begin
|
2
4
|
require 'bundler/setup'
|
3
5
|
rescue LoadError
|
@@ -14,14 +16,11 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
16
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
17
|
end
|
16
18
|
|
17
|
-
APP_RAKEFILE = File.expand_path(
|
19
|
+
APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
|
18
20
|
load 'rails/tasks/engine.rake'
|
19
21
|
|
20
|
-
|
21
22
|
load 'rails/tasks/statistics.rake'
|
22
23
|
|
23
|
-
|
24
|
-
|
25
24
|
require 'bundler/gem_tasks'
|
26
25
|
|
27
26
|
require 'rake/testtask'
|
@@ -32,5 +31,4 @@ Rake::TestTask.new(:test) do |t|
|
|
32
31
|
t.verbose = false
|
33
32
|
end
|
34
33
|
|
35
|
-
|
36
34
|
task default: :test
|
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kenui
|
2
4
|
class EmailNotificationsController < Kenui::EngineController
|
3
|
-
|
4
5
|
def index
|
5
|
-
@record_total = (KillBillClient::Model::Account.find_in_batches(nil,nil,false,false,options_for_klient) || []).size
|
6
|
+
@record_total = (KillBillClient::Model::Account.find_in_batches(nil, nil, false, false, options_for_klient) || []).size
|
6
7
|
end
|
7
8
|
|
8
9
|
# get account list, no sorting
|
@@ -13,13 +14,13 @@ module Kenui
|
|
13
14
|
record_total = (params[:record_total] || 100).to_i
|
14
15
|
data = []
|
15
16
|
|
16
|
-
if search_key.present?
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
rows = if search_key.present?
|
18
|
+
KillBillClient::Model::Account.find_in_batches_by_search_key(search_key, offset, limit, false, false, options_for_klient)
|
19
|
+
else
|
20
|
+
KillBillClient::Model::Account.find_in_batches(offset, limit, false, false, options_for_klient)
|
21
|
+
end
|
21
22
|
|
22
|
-
account_ids = rows.map
|
23
|
+
account_ids = rows.map(&:account_id)
|
23
24
|
email_notifications_configuration = Kenui::EmailNotificationService.get_configurations(account_ids, options_for_klient)
|
24
25
|
|
25
26
|
rows.each do |row|
|
@@ -36,12 +37,12 @@ module Kenui
|
|
36
37
|
view_context.link_to('<i class="fa fa-cog" aria-hidden="true"></i>'.html_safe,
|
37
38
|
'#configureEmailNotification',
|
38
39
|
data: { name: row.name, account_id: row.account_id,
|
39
|
-
events: events, toggle: 'modal', target: '#configureEmailNotification'})
|
40
|
+
events: events, toggle: 'modal', target: '#configureEmailNotification' })
|
40
41
|
]
|
41
42
|
end
|
42
43
|
|
43
44
|
respond_to do |format|
|
44
|
-
format.json { render json: { data: data, recordsTotal: record_total, recordsFiltered: record_total} }
|
45
|
+
format.json { render json: { data: data, recordsTotal: record_total, recordsFiltered: record_total } }
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
@@ -49,16 +50,16 @@ module Kenui
|
|
49
50
|
data = Kenui::EmailNotificationService.get_events_to_consider(options_for_klient)
|
50
51
|
|
51
52
|
respond_to do |format|
|
52
|
-
format.json { render json: { data: data} }
|
53
|
+
format.json { render json: { data: data } }
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
56
57
|
def configuration
|
57
58
|
account_id = params.require(:account_id)
|
58
|
-
data = Kenui::EmailNotificationService.get_configuration_per_account(account_id,options_for_klient)
|
59
|
+
data = Kenui::EmailNotificationService.get_configuration_per_account(account_id, options_for_klient)
|
59
60
|
|
60
61
|
respond_to do |format|
|
61
|
-
format.json { render json: { data: data} }
|
62
|
+
format.json { render json: { data: data } }
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
@@ -68,7 +69,7 @@ module Kenui
|
|
68
69
|
is_success, message = Kenui::EmailNotificationService.set_configuration_per_account(configuration[:account_id],
|
69
70
|
configuration[:event_types],
|
70
71
|
'kenui', nil, nil,
|
71
|
-
options_for_klient
|
72
|
+
options_for_klient)
|
72
73
|
|
73
74
|
if is_success
|
74
75
|
flash[:notice] = message
|
@@ -77,6 +78,5 @@ module Kenui
|
|
77
78
|
end
|
78
79
|
redirect_to email_notifications_path
|
79
80
|
end
|
80
|
-
|
81
81
|
end
|
82
82
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kenui
|
2
4
|
# class where email notification services resides
|
3
5
|
class EmailNotificationService < KillBillClient::Model::Resource
|
4
|
-
|
5
6
|
KILLBILL_EMAIL_NOTIFICATION_PREFIX = '/plugins/killbill-email-notifications/v1'
|
6
7
|
|
7
8
|
class << self
|
8
|
-
|
9
9
|
def get_events_to_consider(options = {})
|
10
10
|
path = "#{KILLBILL_EMAIL_NOTIFICATION_PREFIX}/eventsToConsider"
|
11
11
|
response = KillBillClient::API.get path, {}, options
|
@@ -14,11 +14,11 @@ module Kenui
|
|
14
14
|
|
15
15
|
def get_configurations(account_ids, options = {})
|
16
16
|
path = "#{KILLBILL_EMAIL_NOTIFICATION_PREFIX}/accounts"
|
17
|
-
response = KillBillClient::API.get path, {:
|
17
|
+
response = KillBillClient::API.get path, { kbAccountId: account_ids }, options
|
18
18
|
|
19
19
|
JSON.parse(response.body).map(&:symbolize_keys)
|
20
|
-
rescue => e
|
21
|
-
|
20
|
+
rescue StandardError => e
|
21
|
+
[false, e.message.to_s]
|
22
22
|
end
|
23
23
|
|
24
24
|
def get_configuration_per_account(account_id, options = {})
|
@@ -26,8 +26,8 @@ module Kenui
|
|
26
26
|
response = KillBillClient::API.get path, {}, options
|
27
27
|
|
28
28
|
JSON.parse(response.body).map(&:symbolize_keys)
|
29
|
-
rescue => e
|
30
|
-
|
29
|
+
rescue StandardError => e
|
30
|
+
[false, e.message.to_s]
|
31
31
|
end
|
32
32
|
|
33
33
|
def set_configuration_per_account(account_id, event_types, user = 'kenui', reason = nil, comment = nil, options = {})
|
@@ -39,23 +39,21 @@ module Kenui
|
|
39
39
|
|
40
40
|
KillBillClient::API.post path, event_types, {}, options.merge(more_options)
|
41
41
|
|
42
|
-
|
43
|
-
rescue => e
|
44
|
-
|
42
|
+
[true, "Email notifications for account #{account_id} was successfully updated"]
|
43
|
+
rescue StandardError => e
|
44
|
+
[false, e.message.to_s]
|
45
45
|
end
|
46
46
|
|
47
47
|
def email_notification_plugin_available?(options = nil)
|
48
|
-
|
49
48
|
# inquire if the plugin is listening
|
50
49
|
path = KILLBILL_EMAIL_NOTIFICATION_PREFIX
|
51
50
|
KillBillClient::API.get path, nil, options
|
52
51
|
|
53
|
-
|
52
|
+
[true, nil]
|
54
53
|
# Response error if email notification plugin is not listening
|
55
54
|
rescue KillBillClient::API::ResponseError => e
|
56
|
-
|
55
|
+
[false, e.message.to_s]
|
57
56
|
end
|
58
|
-
|
59
57
|
end
|
60
58
|
end
|
61
|
-
end
|
59
|
+
end
|
data/config/routes.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
Kenui::Engine.routes.draw do
|
3
4
|
root to: 'email_notifications#index'
|
4
5
|
|
5
|
-
resources :email_notifications, :
|
6
|
+
resources :email_notifications, only: [:index]
|
6
7
|
|
7
8
|
scope '/email_notifications' do
|
8
9
|
match '/pagination' => 'email_notifications#pagination', :via => :get, :as => 'email_notification_pagination'
|
data/lib/kenui.rb
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'kenui/engine'
|
2
4
|
|
3
5
|
module Kenui
|
4
6
|
mattr_accessor :current_tenant_user
|
5
7
|
mattr_accessor :layout
|
6
8
|
|
7
|
-
self.current_tenant_user = lambda { |
|
8
|
-
{:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
self.current_tenant_user = lambda { |_session, _user|
|
10
|
+
{ username: 'admin',
|
11
|
+
password: 'password',
|
12
|
+
session_id: nil,
|
13
|
+
api_key: KillBillClient.api_key,
|
14
|
+
api_secret: KillBillClient.api_secret }
|
13
15
|
}
|
14
16
|
|
15
|
-
def self.config
|
17
|
+
def self.config
|
16
18
|
{
|
17
|
-
|
19
|
+
layout: layout || 'kenui/layouts/kenui_application'
|
18
20
|
}
|
19
21
|
end
|
20
22
|
end
|
data/lib/kenui/engine.rb
CHANGED
data/lib/kenui/version.rb
CHANGED
data/lib/tasks/kenui_tasks.rake
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kenui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kill Bill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: rails
|
14
|
+
name: jquery-datatables-rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jquery-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,33 +39,33 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '4.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: sass-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '5.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '5.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: font-awesome-rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,13 +95,13 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.2'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: twitter-bootstrap-rails
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
|
-
type: :
|
104
|
+
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
@@ -109,7 +109,35 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: gem-release
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.2'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.2'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: json
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.8.6
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.8.6
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: listen
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
114
142
|
requirements:
|
115
143
|
- - ">="
|
@@ -123,7 +151,7 @@ dependencies:
|
|
123
151
|
- !ruby/object:Gem::Version
|
124
152
|
version: '0'
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
154
|
+
name: rake
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
128
156
|
requirements:
|
129
157
|
- - ">="
|
@@ -137,19 +165,33 @@ dependencies:
|
|
137
165
|
- !ruby/object:Gem::Version
|
138
166
|
version: '0'
|
139
167
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
168
|
+
name: rubocop
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.88.0
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 0.88.0
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: simplecov
|
141
183
|
requirement: !ruby/object:Gem::Requirement
|
142
184
|
requirements:
|
143
185
|
- - ">="
|
144
186
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
187
|
+
version: '0'
|
146
188
|
type: :development
|
147
189
|
prerelease: false
|
148
190
|
version_requirements: !ruby/object:Gem::Requirement
|
149
191
|
requirements:
|
150
192
|
- - ">="
|
151
193
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
194
|
+
version: '0'
|
153
195
|
description: Rails UI plugin for the Email notification plugin.
|
154
196
|
email: killbilling-users@googlegroups.com
|
155
197
|
executables: []
|
@@ -197,7 +239,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
239
|
- !ruby/object:Gem::Version
|
198
240
|
version: '0'
|
199
241
|
requirements: []
|
200
|
-
|
242
|
+
rubyforge_project:
|
243
|
+
rubygems_version: 2.6.13
|
201
244
|
signing_key:
|
202
245
|
specification_version: 4
|
203
246
|
summary: Kill Bill Email Notification UI mountable engine
|