Sha256: 81203361fe4d1638e1878436a47d7bc5687c142d2329a388c1f67701d794f344

Contents?: true

Size: 606 Bytes

Versions: 5

Compression:

Stored size: 606 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,
        callback_option: callback_option
      }.delete_if { |k,v| v.nil? }
    end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
zenvia-0.0.8 lib/zenvia/sms.rb
zenvia-0.0.7 lib/zenvia/sms.rb
zenvia-0.0.6 lib/zenvia/sms.rb
zenvia-0.0.5 lib/zenvia/sms.rb
zenvia-0.0.4 lib/zenvia/sms.rb