Class: USCoreTestKit::Client::Generator::ReadEndpointGenerator
- Inherits:
-
Object
- Object
- USCoreTestKit::Client::Generator::ReadEndpointGenerator
- Defined in:
- lib/us_core_test_kit/client/generator/read_endpoint_generator.rb
Instance Attribute Summary collapse
-
#base_output_dir ⇒ Object
Returns the value of attribute base_output_dir.
-
#ig_metadata ⇒ Object
Returns the value of attribute ig_metadata.
Class Method Summary collapse
Instance Method Summary collapse
- #base_output_file_name ⇒ Object
- #generate ⇒ Object
- #groups ⇒ Object
-
#initialize(ig_metadata, base_output_dir) ⇒ ReadEndpointGenerator
constructor
A new instance of ReadEndpointGenerator.
- #module_name ⇒ Object
- #output ⇒ Object
- #output_file_name ⇒ Object
- #resources ⇒ Object
- #template ⇒ Object
Constructor Details
#initialize(ig_metadata, base_output_dir) ⇒ ReadEndpointGenerator
Returns a new instance of ReadEndpointGenerator.
15 16 17 18 |
# File 'lib/us_core_test_kit/client/generator/read_endpoint_generator.rb', line 15 def initialize(, base_output_dir) self. = self.base_output_dir = base_output_dir end |
Instance Attribute Details
#base_output_dir ⇒ Object
Returns the value of attribute base_output_dir.
13 14 15 |
# File 'lib/us_core_test_kit/client/generator/read_endpoint_generator.rb', line 13 def base_output_dir @base_output_dir end |
#ig_metadata ⇒ Object
Returns the value of attribute ig_metadata.
13 14 15 |
# File 'lib/us_core_test_kit/client/generator/read_endpoint_generator.rb', line 13 def @ig_metadata end |
Class Method Details
.generate(ig_metadata, base_output_dir) ⇒ Object
8 9 10 |
# File 'lib/us_core_test_kit/client/generator/read_endpoint_generator.rb', line 8 def generate(, base_output_dir) new(, base_output_dir).generate end |
Instance Method Details
#base_output_file_name ⇒ Object
28 29 30 |
# File 'lib/us_core_test_kit/client/generator/read_endpoint_generator.rb', line 28 def base_output_file_name 'read_endpoint.rb' end |
#generate ⇒ Object
49 50 51 |
# File 'lib/us_core_test_kit/client/generator/read_endpoint_generator.rb', line 49 def generate File.write(output_file_name, output) end |
#groups ⇒ Object
40 41 42 43 |
# File 'lib/us_core_test_kit/client/generator/read_endpoint_generator.rb', line 40 def groups .ordered_groups .reject { |group| USCoreTestKit::Generator::SpecialCases.exclude_group? group } end |
#module_name ⇒ Object
32 33 34 |
# File 'lib/us_core_test_kit/client/generator/read_endpoint_generator.rb', line 32 def module_name "USCoreClient#{.reformatted_version.upcase}" end |
#output ⇒ Object
24 25 26 |
# File 'lib/us_core_test_kit/client/generator/read_endpoint_generator.rb', line 24 def output @output ||= ERB.new(template, trim_mode: '-').result(binding) end |
#output_file_name ⇒ Object
36 37 38 |
# File 'lib/us_core_test_kit/client/generator/read_endpoint_generator.rb', line 36 def output_file_name File.join(base_output_dir, base_output_file_name) end |
#resources ⇒ Object
45 46 47 |
# File 'lib/us_core_test_kit/client/generator/read_endpoint_generator.rb', line 45 def resources groups.map { |group| group.resource }.uniq end |
#template ⇒ Object
20 21 22 |
# File 'lib/us_core_test_kit/client/generator/read_endpoint_generator.rb', line 20 def template @template ||= File.read(File.join(__dir__, 'templates', 'read_endpoint.rb.erb')) end |