Sha256: ef32713ac90f79b03ca070131a5a083d8fd860928d2713d4dc915c75275f1e3e

Contents?: true

Size: 522 Bytes

Versions: 2

Compression:

Stored size: 522 Bytes

Contents

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

    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
      }.delete_if { |k,v| v.nil? }
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zenvia-0.0.2 lib/zenvia/sms.rb
zenvia-0.0.1 lib/zenvia/sms.rb