Class: Mock::Twilio::Schemas::CustomerProfilesV1

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

Constant Summary collapse

RESOURCES =
{
  customer_profile: Mock::Twilio::Decorators::CustomerProfilesV1::CustomerProfile,
  entity_assigments: Mock::Twilio::Decorators::CustomerProfilesV1::EntityAssignments,
  evaluations: Mock::Twilio::Decorators::CustomerProfilesV1::Evaluations,
  customer_profile_update: Mock::Twilio::Decorators::CustomerProfilesV1::CustomerProfileUpdate,
  channel_endpoint_assignments: Mock::Twilio::Decorators::CustomerProfilesV1::ChannelEndpointAssignments,
}

Class Method Summary collapse

Class Method Details

.for(body, request) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/mock/twilio/schemas/customer_profiles_v1.rb', line 22

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)
  when %r{/v1/CustomerProfiles/[A-Za-z0-9]+/ChannelEndpointAssignments}
    if request.method.downcase == 'get'
      RESOURCES[:channel_endpoint_assignments].decorate(body, request)
    else
      body
    end
  when %r{/v1/CustomerProfiles/[A-Za-z0-0]+}
    RESOURCES[:customer_profile_update].decorate(body, request)
  end
end