Class: Mock::Twilio::Decorators::CustomerProfilesV1::CustomerProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/mock/twilio/decorators/customer_profiles_v1/customer_profile.rb

Class Method Summary collapse

Class Method Details

.customer_profile_sid(body, request) ⇒ Object



23
24
25
26
27
# File 'lib/mock/twilio/decorators/customer_profiles_v1/customer_profile.rb', line 23

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

.decorate(body, request) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mock/twilio/decorators/customer_profiles_v1/customer_profile.rb', line 9

def decorate(body, request)
  body["date_updated"] = Time.current.rfc2822 if body["date_updated"]
  body["date_created"] = Time.current.rfc2822 if body["date_created"]
  customer_profile_sid(body, request) if body["sid"]
  body["account_sid"] = ::Twilio. if body["account_sid"]
  body["friendly_name"] = request.data["FriendlyName"] if body["friendly_name"]
  body["email"] = request.data["Email"] if body["email"]
  body["policy_sid"] = request.data["PolicySid"] if body["policy_sid"]
  body["status_callback"] = request.data["StatusCallback"] if body["status_callback"]
  body["status"] = "draft" if body["status"]

  body
end