class Wupee::NotificationTypeGenerator

Public Instance Methods

add_notification_subject() click to toggle source
# File lib/generators/wupee/notification_type/notification_type_generator.rb, line 2
  def add_notification_subject
    inject_into_file "config/locales/#{I18n.locale.to_s}.yml", after: /email_subjects:\n/ do
<<-CODE
      #{file_name}: "#{file_name}"
CODE
    end
  end
create_notification_html_template_file() click to toggle source
# File lib/generators/wupee/notification_type/notification_type_generator.rb, line 18
  def create_notification_html_template_file
    create_file "app/views/wupee/notifications/_#{file_name}.html.erb", <<-FILE
    FILE
  end
create_notification_json_template_file() click to toggle source
# File lib/generators/wupee/notification_type/notification_type_generator.rb, line 10
  def create_notification_json_template_file
    create_file "app/views/wupee/api/notifications/_#{file_name}.json.jbuilder", <<-FILE
json.subject "subject"
json.body "body"
json.url "url"
    FILE
  end
create_notification_type_object() click to toggle source
# File lib/generators/wupee/notification_type/notification_type_generator.rb, line 23
def create_notification_type_object
  Wupee::NotificationType.create!(name: file_name)
end