Sha256: 18fa11323913384ea6b2ee367c2e4ae24748c4379ba1434695a770d493c26e97

Contents?: true

Size: 922 Bytes

Versions: 14

Compression:

Stored size: 922 Bytes

Contents

# frozen_string_literal: true

module Mock
  module Twilio
    module Schemas
      class SupportingDocumentsV1
        class << self
          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.account_sid 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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mock-twilio-1.4 lib/mock/twilio/schemas/supporting_documents_v1.rb
mock-twilio-1.3.2 lib/mock/twilio/schemas/supporting_documents_v1.rb
mock-twilio-1.3.1 lib/mock/twilio/schemas/supporting_documents_v1.rb
mock-twilio-1.3.0 lib/mock/twilio/schemas/supporting_documents_v1.rb
mock-twilio-1.2.0 lib/mock/twilio/schemas/supporting_documents_v1.rb
mock-twilio-1.1.0 lib/mock/twilio/schemas/supporting_documents_v1.rb
mock-twilio-1.0.0 lib/mock/twilio/schemas/supporting_documents_v1.rb
mock-twilio-0.8.0 lib/mock/twilio/schemas/supporting_documents_v1.rb
mock-twilio-0.7.2 lib/mock/twilio/schemas/supporting_documents_v1.rb
mock-twilio-0.7.1 lib/mock/twilio/schemas/supporting_documents_v1.rb
mock-twilio-0.7.0 lib/mock/twilio/schemas/supporting_documents_v1.rb
mock-twilio-0.6.0 lib/mock/twilio/schemas/supporting_documents_v1.rb
mock-twilio-0.5.0 lib/mock/twilio/schemas/supporting_documents_v1.rb
mock-twilio-0.4.0 lib/mock/twilio/schemas/supporting_documents_v1.rb