Sha256: 3e383ff3a7d7c746b43140ab558d9403af2f4c2cbdbd4488ac114e233b7bcb1c
Contents?: true
Size: 1.02 KB
Versions: 8
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module Mock module Twilio module Decorators module TrustProductsV1 class EntityAssignments class << self def decorate(body, request) body["date_created"] = Time.current.rfc2822 if body["date_created"] entity_sid(body, request) if body["sid"] body["account_sid"] = ::Twilio.account_sid body["object_sid"] = request.data["ObjectSid"] parse_trust_product_sid(body, request) if body["trust_product_sid"] body end def entity_sid(body, request) prefix = "BV" sid = prefix + SecureRandom.hex(16) body["sid"] = sid end def parse_trust_product_sid(body, request) uri = URI(request.url) trust_product_sid = uri.path.split('/')[3].split('.').first body["trust_product_sid"] = trust_product_sid end end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems