Class: RingCentralSdk::REST::MessagesSMS

Inherits:
Object
  • Object
show all
Defined in:
lib/ringcentral_sdk/rest/messages.rb

Overview

MessagesSMS provides a helper for SMS and MMS messages

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ MessagesSMS

Returns a new instance of MessagesSMS.



21
22
23
# File 'lib/ringcentral_sdk/rest/messages.rb', line 21

def initialize(client)
  @client = client
end

Instance Method Details

#create(opts) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ringcentral_sdk/rest/messages.rb', line 25

def create(opts)
  req = RingCentralSdk::REST::Request::SMS.new
  req.({
    to:   opts[:to],
    from: opts[:from],
    text: opts[:text]
  })
  if opts.key? :media
    if opts[:media].is_a? String
      req.add_file opts[:media]
    elsif opts[:media].is_a? Array
      req.add_files opts[:media]
    end
  end
  @client.send_request req
end