module StrawberryAPI::Client::Templates

Public Instance Methods

template(id:) click to toggle source

Fetches a template

@param [Integer] id If of the template to retrieve

@return [StrawberryAPI::Template] The fetched template

# 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() click to toggle source

Fetches all templates

@return [Array<StrawberryAPI::Template>] A list of the fetched templates

# File lib/strawberry_api/client/templates.rb, line 10
def templates
  get("/templates").parse['templates']&.map do |template|
    Template.new(template)
  end
end