Sha256: 6aa931ad9a857e23e38c6d76db232e81c716d6e75aada3b73158e1ca0de64bd1

Contents?: true

Size: 1020 Bytes

Versions: 3

Compression:

Stored size: 1020 Bytes

Contents

# typed: false
# frozen_string_literal: true

module BodyParameter
  module YettoParameters
    extend T::Sig

    sig { returns(T::Boolean) }
    def has_update_plug_installation_params?
      return false if update_plug_installation_params.blank?

      true
    end

    sig { returns(T::Hash[Symbol, String]) }
    def update_plug_installation_params
      return {} if params.blank?

      return {} if (plug_installation_id = params.fetch(:plug_installation, {}).fetch(:id, "")).blank?
      return {} if (organization_id = params.fetch(:organization, {}).fetch(:id, "")).blank?
      return {} if (plug_id = params.fetch(:plug, {}).fetch(:id, "")).blank?
      return {} if (inbox_id = params.fetch(:inbox, {}).fetch(:id, "")).blank?

      {
        plug_installation: {
          id: plug_installation_id,
        },
        organization: {
          id: organization_id,
        },
        plug: {
          id: plug_id,
        },
        inbox: {
          id: inbox_id,
        },
      }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hephaestus-0.3.1 templates/app/lib/body_parameter/yetto_parameters.rb
hephaestus-0.2.3 templates/app/lib/body_parameter/yetto_parameters.rb
hephaestus-0.2.2 templates/app/lib/body_parameter/yetto_parameters.rb