Class: ApiMaker::ModelContentGeneratorService
- Inherits:
-
ApplicationService
- Object
- ServicePattern::Service
- ApplicationService
- ApiMaker::ModelContentGeneratorService
- Defined in:
- app/services/api_maker/model_content_generator_service.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(model:) ⇒ ModelContentGeneratorService
constructor
A new instance of ModelContentGeneratorService.
Methods inherited from ApplicationService
Constructor Details
#initialize(model:) ⇒ ModelContentGeneratorService
Returns a new instance of ModelContentGeneratorService.
4 5 6 |
# File 'app/services/api_maker/model_content_generator_service.rb', line 4 def initialize(model:) @model = model end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
2 3 4 |
# File 'app/services/api_maker/model_content_generator_service.rb', line 2 def model @model end |
Instance Method Details
#execute ⇒ Object
8 9 10 11 12 13 14 |
# File 'app/services/api_maker/model_content_generator_service.rb', line 8 def execute if resource ServicePattern::Response.new(result: model_content) else ServicePattern::Response.new(errors: ["No resource defined for #{model.name}"]) end end |