Sha256: 7ca836f56bc439e816f9cdee66100027f8f1e6fc8afb8d49202d787caefa020c

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

module RingCentralSdk::REST
  class Messages
    attr_reader :sms
    attr_reader :fax

    def initialize(client)
      @client = client
      @sms = RingCentralSdk::REST::MessagesSMS.new(client)
      @fax = RingCentralSdk::REST::MessagesFax.new(client)
    end
  end
end

module RingCentralSdk::REST
  class MessagesSMS
    def initialize(client)
      @client = client
    end

    def create(opts)
      response = @client.http.post do |req|
        req.url 'account/~/extension/~/sms'
        req.headers['Content-Type'] = 'application/json'
        req.body = {
          :from =>   { :phoneNumber => opts[:from].to_s },
          :to   => [ { :phoneNumber => opts[:to].to_s } ],
          :text => opts[:text].to_s
        }
      end
      return response
    end
  end
end

module RingCentralSdk::REST
  class MessagesFax
    def initialize(client)
      @client = client
    end

    def create(opts)
      fax = RingCentralSdk::REST::Request::Fax.new(opts)
      return @client.send_request(fax)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ringcentral_sdk-1.0.0 lib/ringcentral_sdk/rest/messages.rb