Class: Printavo::Resources::EmailTemplates

Inherits:
Base
  • Object
show all
Defined in:
lib/printavo/resources/email_templates.rb

Constant Summary collapse

ALL_QUERY =
File.read(File.join(__dir__, '../graphql/email_templates/all.graphql')).freeze
FIND_QUERY =
File.read(File.join(__dir__, '../graphql/email_templates/find.graphql')).freeze

Instance Method Summary collapse

Methods inherited from Base

#all_pages, #each_page, #initialize

Constructor Details

This class inherits a constructor from Printavo::Resources::Base

Instance Method Details

#all(first: 25, after: nil) ⇒ Object



10
11
12
# File 'lib/printavo/resources/email_templates.rb', line 10

def all(first: 25, after: nil)
  fetch_page(first: first, after: after).records
end

#find(id) ⇒ Object



14
15
16
17
# File 'lib/printavo/resources/email_templates.rb', line 14

def find(id)
  data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
  Printavo::EmailTemplate.new(data['emailTemplate'])
end