Sha256: 0e4774bc883b9b29235f181114dddb8d402f0bb58d42b00565a091348521e2d6

Contents?: true

Size: 890 Bytes

Versions: 1

Compression:

Stored size: 890 Bytes

Contents

# -*- coding: utf-8 -*-

class Courier::Service::GritterNotice < Courier::Service::Base
  def initialize
    raise "No GritterNotices. Add gem 'gritter_notices' to Gemfile." unless defined? GritterNotices
    super
  end

  #
  # В локале создается хеш всех параметров принимаемых GritterNotice
  #
  # template_key:
  #   title: Внимание!
  #   text: Ва прошли на новый уровень
  #   level: warning
  #   image: /images/warning.png
  #
  #

  def message(owner, template, options)
    scope = [:courier, :services, :gritter_notice]
    opt = I18n::translate(template.name, :scope=>scope)
    opt.merge!(options)
    opt[:text]||=I18n::translate([template.name,:text], opt.merge(:scope=>scope) )
    owner.gritter_notice template.name, opt
  end

  def deliver!
    # Nothng to do, it's realtime delivered
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
courier-0.2.0 lib/courier/service/gritter_notice.rb