Sha256: 05b78be940991db3fb6d618bbd7cbffca10e2da804841583e1ab0cea5db466c8

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require_relative "../decorators/customer_profiles_v1/customer_profile"
require_relative "../decorators/customer_profiles_v1/entity_assignments"
require_relative "../decorators/customer_profiles_v1/evaluations"

module Mock
  module Twilio
    module Schemas
      class CustomerProfilesV1
        class << self
          RESOURCES = {
            customer_profile: Mock::Twilio::Decorators::CustomerProfilesV1::CustomerProfile,
            entity_assigments: Mock::Twilio::Decorators::CustomerProfilesV1::EntityAssignments,
            evaluations: Mock::Twilio::Decorators::CustomerProfilesV1::Evaluations
          }

          def for(body, request)
            url = request.url.split(request.host).last

            case url
            when %r{\/v1/CustomerProfiles$}
              RESOURCES[:customer_profile].decorate(body, request)
            when %r{\/v1/CustomerProfiles/[A-Za-z0-9]+/EntityAssignments}
              RESOURCES[:entity_assigments].decorate(body, request)
            when %r{\/v1/CustomerProfiles/[A-Za-z0-9]+/Evaluations}
              RESOURCES[:evaluations].decorate(body, request)
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mock-twilio-0.7.2 lib/mock/twilio/schemas/customer_profiles_v1.rb
mock-twilio-0.7.1 lib/mock/twilio/schemas/customer_profiles_v1.rb
mock-twilio-0.7.0 lib/mock/twilio/schemas/customer_profiles_v1.rb
mock-twilio-0.6.0 lib/mock/twilio/schemas/customer_profiles_v1.rb
mock-twilio-0.5.0 lib/mock/twilio/schemas/customer_profiles_v1.rb
mock-twilio-0.4.0 lib/mock/twilio/schemas/customer_profiles_v1.rb