Class: Wordsmith::Template
- Inherits:
-
Object
- Object
- Wordsmith::Template
- Defined in:
- lib/wordsmith/template.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
Instance Method Summary collapse
- #generate(data, proofread: false) ⇒ Object
-
#initialize(name: nil, slug: nil, project: nil, **attributes) ⇒ Template
constructor
A new instance of Template.
- #test(data, proofread: false) ⇒ Object
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
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/wordsmith/template.rb', line 3 def name @name end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
3 4 5 |
# File 'lib/wordsmith/template.rb', line 3 def project @project end |
#slug ⇒ Object (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 |