bmc 1.5.1 → 1.6.0
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/CHANGELOG.md +5 -0
 - data/app/controllers/bmc/filters_controller.rb +9 -5
 - data/app/controllers/concerns/bmc/api_controller_concern.rb +3 -3
 - data/app/filters/bmc/filter/by_date.rb +1 -1
 - data/app/filters/bmc/filter/by_date_begin.rb +1 -1
 - data/app/filters/bmc/filter/by_date_end.rb +1 -1
 - data/app/filters/bmc/filter/by_date_or_datetime_period.rb +1 -1
 - data/app/filters/bmc/filter/by_key_value.rb +1 -1
 - data/app/filters/bmc/filter/by_key_values.rb +1 -1
 - data/app/filters/bmc/filter.rb +12 -47
 - data/app/helpers/bmc/button_helper.rb +2 -2
 - data/app/helpers/bmc/font_awesome_helper.rb +6 -6
 - data/app/helpers/bmc/form_helper.rb +1 -1
 - data/app/helpers/bmc/link_helper.rb +2 -2
 - data/app/helpers/bmc/text_helper.rb +2 -2
 - data/app/jobs/concerns/bmc/setup_job_concern.rb +2 -2
 - data/app/libs/bmc/mini_model_serializer/serializer.rb +2 -2
 - data/app/libs/bmc/token_generator.rb +2 -2
 - data/app/models/concerns/bmc/model_i18n.rb +2 -2
 - data/app/serializers/bmc/serializers/xlsx.rb +2 -2
 - data/app/sms/bmc/sms/strategies/amazon.rb +0 -2
 - data/lib/bmc/version.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 761e510c5a970c4720e50d7cb25193dbd77f1d0181151fbdb9b60fa1df105826
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0d1564a511deab185e8cfc85816c4dac045ff5420a13ca64a7550fb0fb580688
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b1217842ff462ceee4909c28bea5a5f42db0ccf6addcc13f54e18fc573e1564795f13eef2c5f8043667cf2ec6fffd7f4836f1e4af32537b5e2b3dc4e2e833c50
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 2d5bca38555fe9c116aa783f05943320e78a86cfecd2502adbce9e8cf4b29b682a5ce04de53359c54ae87f41927cf7eaf6bcf2a9cba08f20a7ca6f368f20aac5
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
| 
         @@ -4,14 +4,18 @@ class BMC::FiltersController < BMC::ApplicationController 
     | 
|
| 
       4 
4 
     | 
    
         
             
              skip_after_action  :verify_authorized,         raise: false
         
     | 
| 
       5 
5 
     | 
    
         
             
              skip_after_action  :verify_policy_scoped,      raise: false
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
      
 7 
     | 
    
         
            +
              def self.parse(json)
         
     | 
| 
      
 8 
     | 
    
         
            +
                JSON.parse(json.to_s).with_indifferent_access
         
     | 
| 
      
 9 
     | 
    
         
            +
              rescue JSON::ParserError
         
     | 
| 
      
 10 
     | 
    
         
            +
                {}.with_indifferent_access
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
       7 
13 
     | 
    
         
             
              def create
         
     | 
| 
       8 
     | 
    
         
            -
                filters =  
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                filters.merge new_filters
         
     | 
| 
      
 14 
     | 
    
         
            +
                filters = self.class.parse(cookies[:filters])
         
     | 
| 
      
 15 
     | 
    
         
            +
                filters.merge! params.fetch(:filters, {}).permit!.to_h
         
     | 
| 
       11 
16 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                # Rewrite cookie with 1 year expiry
         
     | 
| 
       13 
17 
     | 
    
         
             
                cookies[:filters] = {
         
     | 
| 
       14 
     | 
    
         
            -
                  :value   =>  
     | 
| 
      
 18 
     | 
    
         
            +
                  :value   => JSON.dump(filters),
         
     | 
| 
       15 
19 
     | 
    
         
             
                  :expires => 1.year.from_now,
         
     | 
| 
       16 
20 
     | 
    
         
             
                  :path    => "/",
         
     | 
| 
       17 
21 
     | 
    
         
             
                }
         
     | 
| 
         @@ -4,12 +4,12 @@ module BMC::ApiControllerConcern 
     | 
|
| 
       4 
4 
     | 
    
         
             
              private
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
              def render_json(json = {}, options = {})
         
     | 
| 
       7 
     | 
    
         
            -
                json.reverse_merge!(current_user: 
     | 
| 
       8 
     | 
    
         
            -
                options.reverse_merge!(current_user: 
     | 
| 
      
 7 
     | 
    
         
            +
                json.reverse_merge!(current_user:)
         
     | 
| 
      
 8 
     | 
    
         
            +
                options.reverse_merge!(current_user:)
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                json = BMC::MiniModelSerializer::Serialize.call(json, options)
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                render options.merge(json: 
     | 
| 
      
 12 
     | 
    
         
            +
                render options.merge(json:)
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
              def render_json_error(any_object, options = {})
         
     | 
    
        data/app/filters/bmc/filter.rb
    CHANGED
    
    | 
         @@ -3,10 +3,10 @@ class BMC::Filter 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
              STRATEGIES = {}
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
              attr_reader : 
     | 
| 
      
 6 
     | 
    
         
            +
              attr_reader :values, :options
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
              def initialize( 
     | 
| 
       9 
     | 
    
         
            -
                @ 
     | 
| 
      
 8 
     | 
    
         
            +
              def initialize(values, options = {})
         
     | 
| 
      
 9 
     | 
    
         
            +
                @values = values.with_indifferent_access
         
     | 
| 
       10 
10 
     | 
    
         
             
                @options = options
         
     | 
| 
       11 
11 
     | 
    
         
             
              end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
         @@ -14,57 +14,32 @@ class BMC::Filter 
     | 
|
| 
       14 
14 
     | 
    
         
             
                self.class::STRATEGIES.with_indifferent_access
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
              def  
     | 
| 
      
 17 
     | 
    
         
            +
              def call(query)
         
     | 
| 
       18 
18 
     | 
    
         
             
                strategies.each do |key, strategy|
         
     | 
| 
       19 
     | 
    
         
            -
                  value =  
     | 
| 
      
 19 
     | 
    
         
            +
                  value = values[key]
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                  next if value.blank?
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
                  query = strategy. 
     | 
| 
      
 23 
     | 
    
         
            +
                  query = strategy.call(query, value)
         
     | 
| 
       24 
24 
     | 
    
         
             
                end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
                 
     | 
| 
      
 26 
     | 
    
         
            +
                query
         
     | 
| 
       27 
27 
     | 
    
         
             
              end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
              def method_missing(method,  
     | 
| 
       30 
     | 
    
         
            -
                if  
     | 
| 
       31 
     | 
    
         
            -
                   
     | 
| 
       32 
     | 
    
         
            -
                  value  = args.first
         
     | 
| 
       33 
     | 
    
         
            -
                  action = :write
         
     | 
| 
       34 
     | 
    
         
            -
                else
         
     | 
| 
       35 
     | 
    
         
            -
                  key    = method.to_s
         
     | 
| 
       36 
     | 
    
         
            -
                  action = :read
         
     | 
| 
       37 
     | 
    
         
            -
                end
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                if strategies.key?(key) && action == :read
         
     | 
| 
       40 
     | 
    
         
            -
                  get(key)
         
     | 
| 
       41 
     | 
    
         
            -
                elsif strategies.key?(key) && action == :write
         
     | 
| 
       42 
     | 
    
         
            -
                  set(key, value)
         
     | 
| 
      
 29 
     | 
    
         
            +
              def method_missing(method, ...)
         
     | 
| 
      
 30 
     | 
    
         
            +
                if strategies.key?(method)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  values[method]
         
     | 
| 
       43 
32 
     | 
    
         
             
                else
         
     | 
| 
       44 
33 
     | 
    
         
             
                  super
         
     | 
| 
       45 
34 
     | 
    
         
             
                end
         
     | 
| 
       46 
35 
     | 
    
         
             
              end
         
     | 
| 
       47 
36 
     | 
    
         | 
| 
       48 
37 
     | 
    
         
             
              def respond_to_missing?(method, include_private = false)
         
     | 
| 
       49 
     | 
    
         
            -
                 
     | 
| 
       50 
     | 
    
         
            -
              end
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
              def read
         
     | 
| 
       53 
     | 
    
         
            -
                JSON.parse jar["filters"].to_s
         
     | 
| 
       54 
     | 
    
         
            -
              rescue JSON::ParserError
         
     | 
| 
       55 
     | 
    
         
            -
                {}
         
     | 
| 
       56 
     | 
    
         
            -
              end
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
              def write(filters)
         
     | 
| 
       59 
     | 
    
         
            -
                jar["filters"] = filters.to_json
         
     | 
| 
       60 
     | 
    
         
            -
              end
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
              def merge(new_filters)
         
     | 
| 
       63 
     | 
    
         
            -
                write read.merge(new_filters)
         
     | 
| 
      
 38 
     | 
    
         
            +
                strategies.key?(method) || super
         
     | 
| 
       64 
39 
     | 
    
         
             
              end
         
     | 
| 
       65 
40 
     | 
    
         | 
| 
       66 
41 
     | 
    
         
             
              def actives_count
         
     | 
| 
       67 
     | 
    
         
            -
                 
     | 
| 
      
 42 
     | 
    
         
            +
                values.count { |k, v| strategies.key?(k) && v.present? }
         
     | 
| 
       68 
43 
     | 
    
         
             
              end
         
     | 
| 
       69 
44 
     | 
    
         | 
| 
       70 
45 
     | 
    
         
             
              def any?
         
     | 
| 
         @@ -74,14 +49,4 @@ class BMC::Filter 
     | 
|
| 
       74 
49 
     | 
    
         
             
              def empty?
         
     | 
| 
       75 
50 
     | 
    
         
             
                !any?
         
     | 
| 
       76 
51 
     | 
    
         
             
              end
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
              private
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
              def get(key)
         
     | 
| 
       81 
     | 
    
         
            -
                read[key.to_s]
         
     | 
| 
       82 
     | 
    
         
            -
              end
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
              def set(key, value)
         
     | 
| 
       85 
     | 
    
         
            -
                merge(key.to_s => value)
         
     | 
| 
       86 
     | 
    
         
            -
              end
         
     | 
| 
       87 
52 
     | 
    
         
             
            end
         
     | 
| 
         @@ -67,8 +67,8 @@ module BMC::ButtonHelper 
     | 
|
| 
       67 
67 
     | 
    
         
             
                public_send(helper, content, url, options.sort.to_h)
         
     | 
| 
       68 
68 
     | 
    
         
             
              end
         
     | 
| 
       69 
69 
     | 
    
         | 
| 
       70 
     | 
    
         
            -
              def bs_button_to(url, ** 
     | 
| 
       71 
     | 
    
         
            -
                bs_button(url, helper: :button_to, ** 
     | 
| 
      
 70 
     | 
    
         
            +
              def bs_button_to(url, **)
         
     | 
| 
      
 71 
     | 
    
         
            +
                bs_button(url, helper: :button_to, **)
         
     | 
| 
       72 
72 
     | 
    
         
             
              end
         
     | 
| 
       73 
73 
     | 
    
         | 
| 
       74 
74 
     | 
    
         
             
              def new_button(url = url_for(action: :new), **options)
         
     | 
| 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module BMC::FontAwesomeHelper
         
     | 
| 
       2 
     | 
    
         
            -
              def fa_s(id, ** 
     | 
| 
       3 
     | 
    
         
            -
                _bmc_fa_icon(id, fa_style: "fas", ** 
     | 
| 
      
 2 
     | 
    
         
            +
              def fa_s(id, **)
         
     | 
| 
      
 3 
     | 
    
         
            +
                _bmc_fa_icon(id, fa_style: "fas", **)
         
     | 
| 
       4 
4 
     | 
    
         
             
              end
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
              def fa_r(id, ** 
     | 
| 
       7 
     | 
    
         
            -
                _bmc_fa_icon(id, fa_style: "far", ** 
     | 
| 
      
 6 
     | 
    
         
            +
              def fa_r(id, **)
         
     | 
| 
      
 7 
     | 
    
         
            +
                _bmc_fa_icon(id, fa_style: "far", **)
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
              def fa_b(id, ** 
     | 
| 
       11 
     | 
    
         
            -
                _bmc_fa_icon(id, fa_style: "fab", ** 
     | 
| 
      
 10 
     | 
    
         
            +
              def fa_b(id, **)
         
     | 
| 
      
 11 
     | 
    
         
            +
                _bmc_fa_icon(id, fa_style: "fab", **)
         
     | 
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              def _bmc_fa_icon(id, fa_style: nil, size: nil, spin: false, **options)
         
     | 
| 
         @@ -9,7 +9,7 @@ module BMC::FormHelper 
     | 
|
| 
       9 
9 
     | 
    
         
             
              end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
              def search_form(action: request.fullpath, placeholder: ta(:search))
         
     | 
| 
       12 
     | 
    
         
            -
                render "bmc/search/form", action 
     | 
| 
      
 12 
     | 
    
         
            +
                render "bmc/search/form", action:, placeholder:
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
              def hidden_inputs_for_get_form(url, except: nil, only: nil)
         
     | 
| 
         @@ -9,9 +9,9 @@ module BMC::LinkHelper 
     | 
|
| 
       9 
9 
     | 
    
         
             
                end
         
     | 
| 
       10 
10 
     | 
    
         
             
              end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
              def icon_link_to(icon, name, options = nil, html_options = nil, & 
     | 
| 
      
 12 
     | 
    
         
            +
              def icon_link_to(icon, name, options = nil, html_options = nil, &)
         
     | 
| 
       13 
13 
     | 
    
         
             
                name = fa_s(icon).concat(" ").concat(name)
         
     | 
| 
       14 
     | 
    
         
            -
                link_to(name, options, html_options, & 
     | 
| 
      
 14 
     | 
    
         
            +
                link_to(name, options, html_options, &)
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
              def web_link(text, opts = {})
         
     | 
| 
         @@ -84,11 +84,11 @@ module BMC::TextHelper 
     | 
|
| 
       84 
84 
     | 
    
         
             
                label: object.t(attribute)
         
     | 
| 
       85 
85 
     | 
    
         
             
              )
         
     | 
| 
       86 
86 
     | 
    
         
             
                if default == :hide
         
     | 
| 
       87 
     | 
    
         
            -
                  value = fma(object, attribute, value 
     | 
| 
      
 87 
     | 
    
         
            +
                  value = fma(object, attribute, value:, helper:)
         
     | 
| 
       88 
88 
     | 
    
         
             
                  return if value.nil?
         
     | 
| 
       89 
89 
     | 
    
         
             
                end
         
     | 
| 
       90 
90 
     | 
    
         | 
| 
       91 
     | 
    
         
            -
                value = fma(object, attribute, value 
     | 
| 
      
 91 
     | 
    
         
            +
                value = fma(object, attribute, value:, default:, helper:)
         
     | 
| 
       92 
92 
     | 
    
         | 
| 
       93 
93 
     | 
    
         
             
                separator   = " :<br/>".html_safe if separator == :br
         
     | 
| 
       94 
94 
     | 
    
         
             
                klass       = object.is_a?(Module) ? object : object.class
         
     | 
| 
         @@ -1,13 +1,11 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            class BMC::SMS::Strategies::Amazon
         
     | 
| 
       2 
2 
     | 
    
         
             
              attr_reader :region, :access_key_id, :secret_access_key
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
              # rubocop:disable Layout/LineLength
         
     | 
| 
       5 
4 
     | 
    
         
             
              def initialize(region: nil, access_key_id: nil, secret_access_key: nil)
         
     | 
| 
       6 
5 
     | 
    
         
             
                @region            = region            || ENV["SNS_REGION"]            || ENV["AWS_REGION"]
         
     | 
| 
       7 
6 
     | 
    
         
             
                @access_key_id     = access_key_id     || ENV["SNS_ACCESS_KEY_ID"]     || ENV["AWS_ACCESS_KEY_ID"]
         
     | 
| 
       8 
7 
     | 
    
         
             
                @secret_access_key = secret_access_key || ENV["SNS_SECRET_ACCESS_KEY"] || ENV["AWS_SECRET_ACCESS_KEY"]
         
     | 
| 
       9 
8 
     | 
    
         
             
              end
         
     | 
| 
       10 
     | 
    
         
            -
              # rubocop:enable Layout/LineLength
         
     | 
| 
       11 
9 
     | 
    
         | 
| 
       12 
10 
     | 
    
         
             
              def client
         
     | 
| 
       13 
11 
     | 
    
         
             
                @client ||= Aws::SNS::Client.new(
         
     | 
    
        data/lib/bmc/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: bmc
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.6.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Benoit MARTIN-CHAVE
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2024- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-07-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rails-i18n
         
     | 
| 
         @@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       230 
230 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       231 
231 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       232 
232 
     | 
    
         
             
            requirements: []
         
     | 
| 
       233 
     | 
    
         
            -
            rubygems_version: 3.5. 
     | 
| 
      
 233 
     | 
    
         
            +
            rubygems_version: 3.5.11
         
     | 
| 
       234 
234 
     | 
    
         
             
            signing_key:
         
     | 
| 
       235 
235 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       236 
236 
     | 
    
         
             
            summary: BMC
         
     |