Class: Mock::Twilio::Schemas::SupportingDocumentsV1

Inherits:
Object
  • Object
show all
Defined in:
lib/mock/twilio/schemas/supporting_documents_v1.rb

Class Method Summary collapse

Class Method Details

.for(body, request) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/mock/twilio/schemas/supporting_documents_v1.rb', line 8

def for(body, request)
  body["date_updated"] = Time.current.rfc2822 if body["date_updated"]
  body["date_created"] = Time.current.rfc2822 if body["date_created"]
  body["account_sid"] = ::Twilio. if body["account_sid"]

  support_document_sid(body, request) if body["sid"]
  body["friendly_name"] = request.data["FriendlyName"] if body["friendly_name"]
  body["status"] = "approved" if body["status"]
  body["type"] = request.data["Type"] if body["type"]

  body
end

.support_document_sid(body, request) ⇒ Object



21
22
23
24
25
# File 'lib/mock/twilio/schemas/supporting_documents_v1.rb', line 21

def support_document_sid(body, request)
  prefix = "RD"
  sid = prefix + SecureRandom.hex(16)
  body["sid"] = sid
end