Module: DaVinciPASTestKit::Generator::Naming

Extended by:
PASV201::ResourceList
Defined in:
lib/davinci_pas_test_kit/generator/naming.rb

Constant Summary

Constants included from PASV201::ResourceList

PASV201::ResourceList::RESOURCE_LIST, PASV201::ResourceList::RESOURCE_SUPPORTED_PROFILES

Class Method Summary collapse

Class Method Details

.request_type_for_bundle_or_claimObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/davinci_pas_test_kit/generator/naming.rb', line 22

def request_type_for_bundle_or_claim
  {
    'PAS Request Bundle' => 'submit_request',
    'PAS Response Bundle' => 'submit_response',
    'PAS Inquiry Request Bundle' => 'inquire_request',
    'PAS Inquiry Response Bundle' => 'inquire_response',
    'PAS Claim' => 'submit_request',
    'PAS Claim Response' => 'submit_response',
    'PAS Claim Inquiry' => 'inquire_request',
    'PAS Claim Inquiry Response' => 'inquire_response',
    'PAS Claim Update' => 'update_request'
  }
end

.resource_has_multiple_profiles?(resource) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/davinci_pas_test_kit/generator/naming.rb', line 18

def resource_has_multiple_profiles?(resource)
  resources_with_multiple_profiles.include? resource
end

.resources_with_multiple_profilesObject



10
11
12
13
14
15
16
# File 'lib/davinci_pas_test_kit/generator/naming.rb', line 10

def resources_with_multiple_profiles
  resources = []
  RESOURCE_SUPPORTED_PROFILES.each do |resource, profile_list|
    resources << resource.to_s if profile_list.length > 1
  end
  resources
end

.snake_case_for_profile(group_metadata) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/davinci_pas_test_kit/generator/naming.rb', line 36

def snake_case_for_profile()
  resource = .resource
  return resource.underscore unless resource_has_multiple_profiles?(resource)

  .name
    .delete_prefix('profile_')
    .underscore
end

.upper_camel_case_for_profile(group_metadata) ⇒ Object



45
46
47
# File 'lib/davinci_pas_test_kit/generator/naming.rb', line 45

def upper_camel_case_for_profile()
  snake_case_for_profile().camelize
end