class Iterable::PushTemplates

Interact with /templates/push API endpoints

@example Creating push templates endpoint object

# With default config
templates = Iterable::PushTemplates.new
templates.get

# With custom config
conf = Iterable::Config.new(token: 'new-token')
templates = Iterable::PushTemplates.new(config)

Public Instance Methods

get(template_id, params = {}) click to toggle source

Get a push template

@param template_id [String|Integer] A push template ID @param params [Hash] Additional params to use such as locale

@return [Iterable::Response] A response object

# File lib/iterable/push_templates.rb, line 23
def get(template_id, params = {})
  params['templateId'] = template_id
  Iterable.request(conf, '/templates/push/get', params).get
end
update(template_id, attrs = {}) click to toggle source

Update a push template

@param template_id [String|Integer] A push template ID @param attrs [Hash] Update attributes

@return [Iterable::Response] A response object

# File lib/iterable/push_templates.rb, line 36
def update(template_id, attrs = {})
  attrs['templateId'] = template_id
  Iterable.request(conf, '/templates/push/update').post(attrs)
end
upsert(client_template_id, attrs = {}) click to toggle source

Upsert a push template by client template ID

@param client_template_id [String] A client template id to use or create @param attrs [Hash] Update attributes

@return [Iterable::Response] A response object

# File lib/iterable/push_templates.rb, line 49
def upsert(client_template_id, attrs = {})
  attrs['clientTemplateId'] = client_template_id
  Iterable.request(conf, '/templates/push/upsert').post(attrs)
end