Sha256: 37f18e40cc2d8cbdaa3240556f35e1d5dbcc630ca643bfc39850b070e3e2903e

Contents?: true

Size: 1.16 KB

Versions: 8

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

module Mock
  module Twilio
    module Decorators
      module CustomerProfilesV1
        class CustomerProfile
          class << self
            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.account_sid 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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mock-twilio-1.4 lib/mock/twilio/decorators/customer_profiles_v1/customer_profile.rb
mock-twilio-1.3.2 lib/mock/twilio/decorators/customer_profiles_v1/customer_profile.rb
mock-twilio-1.3.1 lib/mock/twilio/decorators/customer_profiles_v1/customer_profile.rb
mock-twilio-1.3.0 lib/mock/twilio/decorators/customer_profiles_v1/customer_profile.rb
mock-twilio-1.2.0 lib/mock/twilio/decorators/customer_profiles_v1/customer_profile.rb
mock-twilio-1.1.0 lib/mock/twilio/decorators/customer_profiles_v1/customer_profile.rb
mock-twilio-1.0.0 lib/mock/twilio/decorators/customer_profiles_v1/customer_profile.rb
mock-twilio-0.8.0 lib/mock/twilio/decorators/customer_profiles_v1/customer_profile.rb