Class: Wordsmith::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/wordsmith/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: nil, slug: nil, project: nil, **attributes) ⇒ Template

Returns a new instance of Template.



5
6
7
8
9
10
# File 'lib/wordsmith/template.rb', line 5

def initialize(name: nil, slug: nil, project: nil, **attributes)
  raise 'Missing required keyword arguments' unless [name, slug, project].all?
  @name = name
  @slug = slug
  @project = project
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/wordsmith/template.rb', line 3

def name
  @name
end

#projectObject (readonly)

Returns the value of attribute project.



3
4
5
# File 'lib/wordsmith/template.rb', line 3

def project
  @project
end

#slugObject (readonly)

Returns the value of attribute slug.



3
4
5
# File 'lib/wordsmith/template.rb', line 3

def slug
  @slug
end

Instance Method Details

#generate(data, proofread: false) ⇒ Object



12
13
14
# File 'lib/wordsmith/template.rb', line 12

def generate(data, proofread: false)
  Wordsmith.client.post(path('outputs'), data, proofread: proofread)
end

#test(data, proofread: false) ⇒ Object



16
17
18
# File 'lib/wordsmith/template.rb', line 16

def test(data, proofread: false)
  Wordsmith.client.post(path('test'), data, proofread: proofread)
end