Sha256: 0f5a3f9c8d5367b19908070c0f53623e8213666c08224f3ed9c2d2056a83bacc

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

module PortaText
  module Command
    module Api
      # The sms endpoint.
      # https://github.com/PortaText/docs/wiki/REST-API#api_sms
      #
      # Author::    Marcelo Gornstein (mailto:marcelog@portatext.com)
      # Copyright:: Copyright (c) 2015 PortaText
      # License::   Apache-2.0
      class Sms < Base
        def id(id)
          set :id, id
        end

        def to(to)
          set :to, to
        end

        def from(from)
          set :from, from
        end

        def from_service(service_id)
          set :service_id, service_id
        end

        def use_template(id, variables = {})
          set :template_id, id
          set :variables, variables
        end

        def text(text)
          set :text, text
        end

        def client_ref(client_ref)
          set :client_ref, client_ref
        end

        def to_contact_lists(contact_lists)
          set :contact_list_ids, contact_lists
        end

        def endpoint(_method)
          return 'sms' if @args[:id].nil?
          id = @args[:id]
          @args.delete :id
          "sms/#{id}"
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
portatext-1.4.2 lib/portatext/command/api/sms.rb
portatext-1.4.1 lib/portatext/command/api/sms.rb
portatext-1.4.0 lib/portatext/command/api/sms.rb