Sha256: 7fff13593bda8d99704b66006e300777ba1c06072196f678bd9a22968600f4c8

Contents?: true

Size: 836 Bytes

Versions: 14

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true

module Mock
  module Twilio
    module Schemas
      class EndUsersV1
        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"]
            body["type"] = request.data["Type"] if body["type"]
            end_user_sid(body, request) if body["sid"]
            body["friendly_name"] = request.data["FriendlyName"] if body["friendly_name"]

            body
          end

          def end_user_sid(body, request)
            prefix = "IT"
            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/end_users_v1.rb
mock-twilio-1.3.2 lib/mock/twilio/schemas/end_users_v1.rb
mock-twilio-1.3.1 lib/mock/twilio/schemas/end_users_v1.rb
mock-twilio-1.3.0 lib/mock/twilio/schemas/end_users_v1.rb
mock-twilio-1.2.0 lib/mock/twilio/schemas/end_users_v1.rb
mock-twilio-1.1.0 lib/mock/twilio/schemas/end_users_v1.rb
mock-twilio-1.0.0 lib/mock/twilio/schemas/end_users_v1.rb
mock-twilio-0.8.0 lib/mock/twilio/schemas/end_users_v1.rb
mock-twilio-0.7.2 lib/mock/twilio/schemas/end_users_v1.rb
mock-twilio-0.7.1 lib/mock/twilio/schemas/end_users_v1.rb
mock-twilio-0.7.0 lib/mock/twilio/schemas/end_users_v1.rb
mock-twilio-0.6.0 lib/mock/twilio/schemas/end_users_v1.rb
mock-twilio-0.5.0 lib/mock/twilio/schemas/end_users_v1.rb
mock-twilio-0.4.0 lib/mock/twilio/schemas/end_users_v1.rb