kaui 2.2.1 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a7e38ad91853cdb328e503ee3491a6aad1bf07aea22bc7729413f486791cd0e
4
- data.tar.gz: abd976c47fdaeb002ba0bbd3da8e177af0f8671701f947707ee5ec9967ccae8c
3
+ metadata.gz: 1c270a67aa73b6b9195aae2e4578519dde9bdefab0bdb4fdd1f7a59a8137fb7a
4
+ data.tar.gz: 48791ecdfe32bbb730a447e8e994ab127acabd36fc356bedb023f8e67dc174ef
5
5
  SHA512:
6
- metadata.gz: b811ab8ac402143c03beabb85775f543bfb8c15e574247657dc2d04677a4bc1f577592744d59161b714713cf109715f1c6521a01615c8b8fc1a628f1008f1820
7
- data.tar.gz: f62aedf1ddc89fbad6dcd755f69706b9ad5234e57b8c4567b1cf9333716496249bd6a8badf4e91af392e6484103c28f0a3795259c0aaf6fb32c27a249e7c04a6
6
+ metadata.gz: 13e7dc0a95b7a6bd39f3996a50fd32c7216b4eb7e2507b386a5bbe6cd959358e631a6520bafb6bf83f4573b730904bb9058a3475c851c7e3540ecd31e0280987
7
+ data.tar.gz: 402e25c2418833089ab69307de78deaa64597d76e0d40c07daa37dd15d050ba9b3b35e6e9a1485447faf07ee458e364de0d2c7dac02172bbb3c7bdf853e584b4
@@ -202,7 +202,7 @@ module Kaui
202
202
  render template: 'kaui/invoices/show'
203
203
  else
204
204
  # Redirect to fetch payments, etc.
205
- redirect_to invoice_path(invoice.invoice_id, account_id: account_id), notice: "Generated invoice #{invoice.invoice_number} for target date #{invoice.target_date}"
205
+ redirect_to invoice_path(invoice.invoice_id, account_id:), notice: "Generated invoice #{invoice.invoice_number} for target date #{invoice.target_date}"
206
206
  end
207
207
  end
208
208
 
@@ -448,10 +448,10 @@ module Kaui
448
448
 
449
449
  catalog << { version_date: data[:version_date],
450
450
  currencies: data[:currencies],
451
- plans: plans }
451
+ plans: }
452
452
  end
453
453
 
454
- { catalog: catalog }
454
+ { catalog: }
455
455
  end
456
456
  end
457
457
 
@@ -104,7 +104,7 @@ module Kaui
104
104
  error = e.message
105
105
  end
106
106
 
107
- { audits: audit_logs_with_history, error: error }
107
+ { audits: audit_logs_with_history, error: }
108
108
  end
109
109
  end
110
110
 
@@ -15,7 +15,7 @@ module Kaui
15
15
  currency = params[:currency] || 'USD'
16
16
  end
17
17
 
18
- @charge = Kaui::InvoiceItem.new(account_id: params.require(:account_id), invoice_id: invoice_id, amount: amount, currency: currency)
18
+ @charge = Kaui::InvoiceItem.new(account_id: params.require(:account_id), invoice_id:, amount:, currency:)
19
19
  end
20
20
 
21
21
  def create
@@ -15,7 +15,7 @@ module Kaui
15
15
  currency = params[:currency] || 'USD'
16
16
  end
17
17
 
18
- @credit = Kaui::Credit.new(account_id: params.require(:account_id), invoice_id: invoice_id, amount: amount, currency: currency)
18
+ @credit = Kaui::Credit.new(account_id: params.require(:account_id), invoice_id:, amount:, currency:)
19
19
  end
20
20
 
21
21
  def create
@@ -53,17 +53,15 @@ module Kaui
53
53
  pages.each { |page| json[:data] << formatter.call(page) }
54
54
 
55
55
  respond_to do |format|
56
- format.json { render json: json }
56
+ format.json { render json: }
57
57
  end
58
58
  end
59
59
 
60
- def promise
60
+ def promise(&)
61
61
  # Evaluation starts immediately
62
62
  ::Concurrent::Promises.future do
63
63
  # https://github.com/rails/rails/issues/26847
64
- Rails.application.executor.wrap do
65
- yield
66
- end
64
+ Rails.application.executor.wrap(&)
67
65
  end
68
66
  end
69
67
 
@@ -46,7 +46,7 @@ module Kaui
46
46
  elsif true?(fast)
47
47
  redirect_to account_path(account.account_id) and return
48
48
  else
49
- redirect_to accounts_path(q: search_query, fast: fast) and return
49
+ redirect_to accounts_path(q: search_query, fast:) and return
50
50
  end
51
51
  end
52
52
  end
@@ -73,7 +73,7 @@ module Kaui
73
73
  elsif true?(fast)
74
74
  redirect_to account_invoice_path(invoice.account_id, invoice.invoice_id) and return
75
75
  else
76
- redirect_to account_invoices_path(account_id: invoice.account_id, q: search_query, fast: fast) and return
76
+ redirect_to account_invoices_path(account_id: invoice.account_id, q: search_query, fast:) and return
77
77
  end
78
78
  end
79
79
  end
@@ -100,7 +100,7 @@ module Kaui
100
100
  elsif true?(fast)
101
101
  redirect_to account_payment_path(payment.account_id, payment.payment_id) and return
102
102
  else
103
- redirect_to account_payments_path(account_id: payment.account_id, q: search_query, fast: fast) and return
103
+ redirect_to account_payments_path(account_id: payment.account_id, q: search_query, fast:) and return
104
104
  end
105
105
  end
106
106
  end
@@ -167,7 +167,7 @@ module Kaui
167
167
  if custom_field.blank?
168
168
  search_error("No custom field matches \"#{search_query}\"")
169
169
  else
170
- redirect_to custom_fields_path(q: search_query, fast: fast)
170
+ redirect_to custom_fields_path(q: search_query, fast:)
171
171
  end
172
172
  else
173
173
  unsupported_external_key_search('CUSTOM FIELD')
@@ -206,7 +206,7 @@ module Kaui
206
206
  if tag.blank?
207
207
  search_error("No tag matches \"#{search_query}\"")
208
208
  else
209
- redirect_to tags_path(q: search_query, fast: fast)
209
+ redirect_to tags_path(q: search_query, fast:)
210
210
  end
211
211
  else
212
212
  unsupported_external_key_search('TAG')
@@ -217,7 +217,7 @@ module Kaui
217
217
  if search_by == 'ID'
218
218
  begin
219
219
  Kaui::TagDefinition.find_by_id(search_query, 'NONE', options)
220
- redirect_to tag_definitions_path(q: search_query, fast: fast)
220
+ redirect_to tag_definitions_path(q: search_query, fast:)
221
221
  rescue KillBillClient::API::NotFound => _e
222
222
  search_error("No tag definition matches \"#{search_query}\"")
223
223
  end
@@ -228,12 +228,12 @@ module Kaui
228
228
  if tag_definition.blank?
229
229
  begin
230
230
  Kaui::TagDefinition.find_by_id(search_query, 'NONE', options)
231
- redirect_to tag_definitions_path(q: search_query, fast: fast) and return
231
+ redirect_to tag_definitions_path(q: search_query, fast:) and return
232
232
  rescue KillBillClient::API::NotFound => _e
233
233
  search_error("No tag definition matches \"#{search_query}\"")
234
234
  end
235
235
  else
236
- redirect_to tag_definitions_path(q: search_query, fast: fast)
236
+ redirect_to tag_definitions_path(q: search_query, fast:)
237
237
  end
238
238
  end
239
239
  end
@@ -26,7 +26,7 @@ module Kaui
26
26
  end
27
27
 
28
28
  Kaui::Tag.set_for_invoice(invoice_id, tags, current_user.kb_username, params[:reason], params[:comment], options_for_klient)
29
- redirect_to kaui_engine.invoice_path(invoice_id, account_id: account_id), notice: 'Invoice tags successfully set'
29
+ redirect_to kaui_engine.invoice_path(invoice_id, account_id:), notice: 'Invoice tags successfully set'
30
30
  end
31
31
  end
32
32
  end
@@ -17,7 +17,7 @@ module Kaui
17
17
 
18
18
  # If not, convert into account timezone and return the date part only
19
19
  parsed_date = DateTime.parse(date.to_s).in_time_zone(timezone)
20
- parsed_date.to_s(:date_only)
20
+ parsed_date.to_fs(:date_only)
21
21
  end
22
22
 
23
23
  def truncate_millis(date_s)
@@ -21,7 +21,7 @@ module Kaui
21
21
  plugin_key = plugin.plugin_key
22
22
  installed_plugins << {
23
23
  # Unique identifier chosen by the user and used for kpm operations
24
- plugin_key: plugin_key,
24
+ plugin_key:,
25
25
  # Notes:
26
26
  # * plugin.plugin_name comes from kpm and is arbitrary (see Utils.get_plugin_name_from_file_path in the kpm codebase for instance)
27
27
  # * plugin_name here is the plugin name as seen by Kill Bill and is typically defined in the Activator.java (this value is the one that matters for plugin configuration)
@@ -12,10 +12,10 @@ module Kaui
12
12
 
13
13
  def object_id_popover(object_id, placement = 'right', title = nil)
14
14
  content_tag(:span, truncate_uuid(object_id),
15
- id: "#{object_id}-popover", class: 'object-id-popover', title: title,
15
+ id: "#{object_id}-popover", class: 'object-id-popover', title:,
16
16
  data: {
17
17
  id: object_id,
18
- placement: placement
18
+ placement:
19
19
  })
20
20
  end
21
21
  end
@@ -3,17 +3,17 @@
3
3
  module Kaui
4
4
  class AccountEmail < KillBillClient::Model::AccountEmailAttributes
5
5
  def self.find_all_sorted_by_account_id(account_id, audit = 'NONE', options = {})
6
- emails = Kaui::Account.new(account_id: account_id).emails(audit, options)
6
+ emails = Kaui::Account.new(account_id:).emails(audit, options)
7
7
  emails.map { |email| Kaui::AccountEmail.new(email.to_hash) }.sort
8
8
  end
9
9
 
10
10
  def create(user = nil, reason = nil, comment = nil, options = {})
11
- account = Kaui::Account.new(account_id: account_id)
11
+ account = Kaui::Account.new(account_id:)
12
12
  account.add_email(email, user, reason, comment, options)
13
13
  end
14
14
 
15
15
  def destroy(user = nil, reason = nil, comment = nil, options = {})
16
- account = Kaui::Account.new(account_id: account_id)
16
+ account = Kaui::Account.new(account_id:)
17
17
  account.remove_email(email, user, reason, comment, options)
18
18
  end
19
19
 
@@ -27,9 +27,9 @@ module Kaui
27
27
  { transactionStatus: transaction_status }.to_json,
28
28
  {},
29
29
  {
30
- user: user,
31
- reason: reason,
32
- comment: comment
30
+ user:,
31
+ reason:,
32
+ comment:
33
33
  }.merge(options)
34
34
  end
35
35
 
@@ -31,8 +31,8 @@ module Devise
31
31
  # Invoked by the KillbillAuthenticatable strategy to lookup the user
32
32
  # before attempting authentication
33
33
  def find_for_killbill_authentication(kb_username)
34
- find_for_authentication(kb_username: kb_username) ||
35
- new(kb_username: kb_username)
34
+ find_for_authentication(kb_username:) ||
35
+ new(kb_username:)
36
36
  rescue KillBillClient::API::Unauthorized => _e
37
37
  # Multi-Tenancy was enabled, but the tenant_id couldn't be retrieved because of bad credentials
38
38
  nil
@@ -28,7 +28,7 @@ module Devise
28
28
  return false unless valid_password?
29
29
 
30
30
  user = params[:user] || {}
31
- kb_authenticate!(user[:kb_username], { username: user[:kb_username], password: password })
31
+ kb_authenticate!(user[:kb_username], { username: user[:kb_username], password: })
32
32
  end
33
33
  end
34
34
 
@@ -77,7 +77,7 @@ Warden::Manager.after_set_user do |user, auth, opts|
77
77
  unless user.authenticated_with_killbill?
78
78
  scope = opts[:scope]
79
79
  auth.logout(scope)
80
- throw(:warden, scope: scope, reason: 'Kill Bill session expired')
80
+ throw(:warden, scope:, reason: 'Kill Bill session expired')
81
81
  end
82
82
  end
83
83
 
data/lib/kaui/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kaui
4
- VERSION = '2.2.1'
4
+ VERSION = '3.0.1'
5
5
  end
data/lib/kaui.rb CHANGED
@@ -202,3 +202,12 @@ module Kaui
202
202
  }
203
203
  end
204
204
  end
205
+
206
+ # ruby-1.8 compatibility
207
+ module Kernel
208
+ def define_singleton_method(*args, &)
209
+ class << self
210
+ self
211
+ end.send(:define_method, *args, &)
212
+ end
213
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaui
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 3.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: 2023-06-24 00:00:00.000000000 Z
11
+ date: 2023-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -238,16 +238,16 @@ dependencies:
238
238
  name: kenui
239
239
  requirement: !ruby/object:Gem::Requirement
240
240
  requirements:
241
- - - "~>"
241
+ - - ">="
242
242
  - !ruby/object:Gem::Version
243
- version: 2.1.0
243
+ version: '0'
244
244
  type: :runtime
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
- - - "~>"
248
+ - - ">="
249
249
  - !ruby/object:Gem::Version
250
- version: 2.1.0
250
+ version: '0'
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: killbill-client
253
253
  requirement: !ruby/object:Gem::Requirement
@@ -310,14 +310,14 @@ dependencies:
310
310
  requirements:
311
311
  - - "~>"
312
312
  - !ruby/object:Gem::Version
313
- version: '6.1'
313
+ version: '7.0'
314
314
  type: :runtime
315
315
  prerelease: false
316
316
  version_requirements: !ruby/object:Gem::Requirement
317
317
  requirements:
318
318
  - - "~>"
319
319
  - !ruby/object:Gem::Version
320
- version: '6.1'
320
+ version: '7.0'
321
321
  - !ruby/object:Gem::Dependency
322
322
  name: sass
323
323
  requirement: !ruby/object:Gem::Requirement
@@ -695,7 +695,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
695
695
  requirements:
696
696
  - - ">="
697
697
  - !ruby/object:Gem::Version
698
- version: 2.6.0
698
+ version: 2.7.0
699
699
  required_rubygems_version: !ruby/object:Gem::Requirement
700
700
  requirements:
701
701
  - - ">="