Module: Klaviyo::Templates::ApiOperations
- Included in:
- Klaviyo::Templates
- Defined in:
- lib/klaviyo/templates/api_operations.rb
Overview
Instance Method Summary collapse
- #all(client:) ⇒ Object
- #clone(client:, id:, name:) ⇒ Object
- #create(client:, name:, html:) ⇒ Object
- #delete(client:, id:) ⇒ Object
- #render(client:, id:, context:) ⇒ Object
- #render_and_send(client:, id:, context:, service:, from_email:, from_name:, subject:, to:) ⇒ Object
- #update(client:, id:, name:, html:) ⇒ Object
Instance Method Details
#all(client:) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/klaviyo/templates/api_operations.rb', line 7 def all(client:) Klaviyo::Resource.build_collection( client.conn.get('/api/v1/email-templates', api_key: client.api_key ).body ) end |
#clone(client:, id:, name:) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/klaviyo/templates/api_operations.rb', line 40 def clone(client:, id:, name:) client.conn.post( "/api/v1/email-template/#{id}/clone", api_key: client.api_key, name: name ) end |
#create(client:, name:, html:) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/klaviyo/templates/api_operations.rb', line 15 def create(client:, name:, html:) client.conn.post( '/api/v1/email-templates', api_key: client.api_key, name: name, html: html ) end |
#delete(client:, id:) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/klaviyo/templates/api_operations.rb', line 33 def delete(client:, id:) client.conn.delete( "/api/v1/email-template/#{id}", api_key: client.api_key ) end |
#render(client:, id:, context:) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/klaviyo/templates/api_operations.rb', line 48 def render(client:, id:, context:) client.conn.post( "/api/v1/email-template/#{id}/render", api_key: client.api_key, context: context ) end |
#render_and_send(client:, id:, context:, service:, from_email:, from_name:, subject:, to:) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/klaviyo/templates/api_operations.rb', line 56 def render_and_send( client:, id:, context:, service:, from_email:, from_name:, subject:, to: ) client.conn.post( "/api/v1/email-template/#{id}/send", api_key: client.api_key, context: context, service: service, from_email: from_email, from_name: from_name, subject: subject, to: to ) end |
#update(client:, id:, name:, html:) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/klaviyo/templates/api_operations.rb', line 24 def update(client:, id:, name:, html:) client.conn.put( "/api/v1/email-template/#{id}", api_key: client.api_key, name: name, html: html ) end |