Sha256: 55e709b00dee0f88ddc93a291171ee2e94ed1e73e8e626e05dccad5090f4db12

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

module Zenvia
  class Sms
    attr_accessor :to, :message, :dispatch, :message_id, :callback_option

    def initialize(to, message)
      @to, @message = to, message
    end

    def send
      request.post post_params
    end

    def dispatch
      @dispatch || :send
    end

    private

    def post_params
      {
        to:             to,
        message:        message,
        dispatch:       dispatch,
        id:             message_id,
        callbackOption: callback_option
      }.delete_if { |k,v| v.nil? }
    end

    def request
      @request ||= Request.new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zenvia-0.0.3 lib/zenvia/sms.rb