Sha256: 32b6f58e18375206f9b9e3e32750e09624540180519bdc00d4fbe3ae4345a974

Contents?: true

Size: 955 Bytes

Versions: 8

Compression:

Stored size: 955 Bytes

Contents

require File.expand_path('../common_request', __FILE__)
module Gateway
  module Requests
    #
    # Request to send message via gateway
    #
    class SendMessageRequest < Gateway::Requests::CommonRequest

      TRANSPORT_WA    = 'whatsapp' # transport whatsapp
      TRANSPORT_VIBER = 'viber' # transport viber
      TRANSPORT_TG    = 'telegram' # transport telegram
      TRANSPORT_SMS   = 'modem' # transport modem

      attr_accessor :phone, :devicePhone, :body, :image, :transport

      #
      # Possible transports
      #
      def self.possible_transports
        [TRANSPORT_WA, TRANSPORT_VIBER, TRANSPORT_TG, TRANSPORT_SMS]
      end

      def transport=(transport)
        unless self.class.possible_transports.include? transport
          raise Gateway::ArgumentError.new("transport #{transport} is not supported, use: #{self.class.possible_transports.join(', ')}")
        end
        @transport = transport
      end

    end
  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
gateway-sdk-1.0.1 lib/gateway/requests/send_message_request.rb
gateway-sdk-1.0.0 lib/gateway/requests/send_message_request.rb
gateway-sdk-0.2.4 lib/gateway/requests/send_message_request.rb
gateway-sdk-0.2.3 lib/gateway/requests/send_message_request.rb
gateway-sdk-0.2.2 lib/gateway/requests/send_message_request.rb
gateway-sdk-0.2.1 lib/gateway/requests/send_message_request.rb
gateway-sdk-0.2.0 lib/gateway/requests/send_message_request.rb
gateway_sdk-0.2.0 lib/gateway/requests/send_message_request.rb