Sha256: 482c89b0bf129c277b92c8ce5c988ab00d9ec16e5f08e0b566702f86863e42b1

Contents?: true

Size: 937 Bytes

Versions: 3

Compression:

Stored size: 937 Bytes

Contents

# frozen_string_literal: true

require 'freshchat_whatsapp/actions/send_hsm_message'
require 'freshchat_whatsapp/actions/check_message_status'

module FreshchatWhatsapp
  class Api
    def initialize(base_path=nil,token=nil)
      fresh_chat_base_path = base_path || FreshchatWhatsapp.configuration.base_path
      @base_path = fresh_chat_base_path
      @token = token
    end

    def send_hsm_message(from_number, to_number, namespace, template_name, language, params)
      Actions::SendHsmMessage.new(
        client,
        from_number,
        to_number,
        namespace,
        template_name,
        language,
        params
      ).call
    end

    def check_message_status(request_id)
      Actions::CheckMessageStatus.new(
        client,
        request_id
      ).call
    end

    private

    attr_reader :base_path

    def client
      @client = FreshchatWhatsapp::Client.new(@base_path, @token)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
freshchat_whatsapp-0.1.5 lib/freshchat_whatsapp/api.rb
freshchat_whatsapp-0.1.4 lib/freshchat_whatsapp/api.rb
freshchat_whatsapp-0.1.3 lib/freshchat_whatsapp/api.rb