Sha256: 7cc747d5bd63276a4e5fd6d84a15ba8e1b4dea6b8546d59a3664bfca64ae07cf

Contents?: true

Size: 890 Bytes

Versions: 1

Compression:

Stored size: 890 Bytes

Contents

# frozen_string_literal: true

module Whats
  module Actions
    class SendHsmMessage
      PATH = "/v1/messages"

      def initialize(client, wa_id, namespace, element_name, params)
        @client       = client
        @wa_id        = wa_id
        @namespace    = namespace
        @element_name = element_name
        @params       = params
      end

      def call
        client.request PATH, payload
      end

      private

      attr_reader :client, :wa_id, :namespace, :element_name, :params

      def payload
        {
          type: "hsm",
          recipient_type: "individual",
          to: wa_id,
          hsm: {
            namespace:          namespace,
            element_name:       element_name,
            fallback_lg:        "pt",
            fallback_lc:        "BR",
            localizable_params: params
          }
        }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whatsapp-0.1.4 lib/whats/actions/send_hsm_message.rb