Class: RingCentralSdk::REST::MessagesFax

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

Overview

MessagesFax provides a helper for fax requests

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ MessagesFax

Returns a new instance of MessagesFax.



49
50
51
# File 'lib/ringcentral_sdk/rest/messages.rb', line 49

def initialize(client)
  @client = client
end

Instance Method Details

#create(opts) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/ringcentral_sdk/rest/messages.rb', line 53

def create(opts)
  req  = RingCentralSdk::REST::Request::Fax.new
  meta = {}

  skip = {text: 1, files: 1}

  opts.each do |k,v|
    meta[k] = v unless skip.key? k
  end

  req. meta

  if opts.key? :text
    req.add_text opts[:text]
  end

  if opts.key? :files
    if opts[:files].is_a? String
      req.add_file opts[:files]
    elsif opts[:files].is_a? Array
      req.add_files opts[:files]
    end
  end
  @client.send_request req
end