Module: StrawberryAPI::Client::Templates
- Included in:
- StrawberryAPI::Client
- Defined in:
- lib/strawberry_api/client/templates.rb
Instance Method Summary collapse
-
#template(id:) ⇒ StrawberryAPI::Template
Fetches a template.
-
#templates ⇒ Array<StrawberryAPI::Template>
Fetches all templates.
Instance Method Details
#template(id:) ⇒ StrawberryAPI::Template
Fetches a template
22 23 24 25 |
# File 'lib/strawberry_api/client/templates.rb', line 22 def template(id:) data = get("/templates/#{id}").parse['template'] data.nil? ? nil : Template.new(data) end |
#templates ⇒ Array<StrawberryAPI::Template>
Fetches all templates
10 11 12 13 14 |
# File 'lib/strawberry_api/client/templates.rb', line 10 def templates get("/templates").parse['templates']&.map do |template| Template.new(template) end end |