Sha256: b21c673453fb35165333c193a05a87580aecece8f53dfe3d80f45d41fc0eaa7e

Contents?: true

Size: 699 Bytes

Versions: 2

Compression:

Stored size: 699 Bytes

Contents

module ExpressPigeon
  # Templates
  class Templates
    include HTTParty
    base_uri('https://api.expresspigeon.com/templates')
    debug_output(nil)

    def initialize(auth_key)
      self.class.headers('X-auth-key' => auth_key)
    end

    # Copy template
    #
    # POST https://api.expresspigeon.com/templates/{template_id}/copy
    #
    # NOTE: It is important to use only single quotes in injected HTML
    def copy(template_id, name:, merge_fields: {})
      self.class.post(
        "/#{template_id}/copy",
        body: {
          name: name,
          merge_fields: merge_fields
        }.to_json,
        headers: { 'Content-Type' => 'application/json' }
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
express_pigeon-2.4.1 lib/express_pigeon/templates.rb
express_pigeon-2.4.0 lib/express_pigeon/templates.rb