Sha256: c3b6f2e602b065ac8404de88eb04c70a58cb9c0850429eed7ed8753a48ceba4d

Contents?: true

Size: 814 Bytes

Versions: 4

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true

module Whats
  module Actions
    class SendHsmMessage
      PATH = "/api/rest_send.php"

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

      def call
        client.request PATH, payload
      end

      private

      attr_reader :client, :username, :namespace, :element_name, :params

      def payload
        {
          payload: {
            to: username,
            hsm: {
              namespace:          namespace,
              element_name:       element_name,
              localizable_params: params
            }
          }
        }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
whatsapp-0.1.3 lib/whats/actions/send_hsm_message.rb
whatsapp-0.1.2 lib/whats/actions/send_hsm_message.rb
whatsapp-0.1.1 lib/whats/actions/send_hsm_message.rb
whatsapp-0.1.0 lib/whats/actions/send_hsm_message.rb