Sha256: aa353d661863e573dfcd7f8dde4ec312bc98150d41ac9fd57aa223d16fdc6b93

Contents?: true

Size: 897 Bytes

Versions: 2

Compression:

Stored size: 897 Bytes

Contents

# -*- encoding : utf-8 -*-

class AddTwitterCards < Card::Migration
  def up
    ensure_card name: "Twitter template", codename: "twitter_template",
                type_id: Card::CardtypeID
    ensure_card name: "*message", codename: "message"

    [["*consumer key", "consumer_key"],
     ["*consumer secret", "consumer_secret"],
     ["*access token", "access_token"],
     ["*access secret", "access_secret"]].each do |name, key|
      ensure_trait name, codename: key,
                         default: { type_id: Card::PhraseID },
                         read: "Administrator"
    end

    Card::Cache.reset_all

    ensure_card name: [:twitter_template, :type, :structure],
                content: structure
  end

  def structure
    ["*message", "*consumer key", "*consumer secret", "*access token",
     "*access secret"].map do |name|
      "{{+#{name}}}"
    end.join "\n"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
card-1.20.4 mod/twitter/db/migrate_cards/20170305112346_add_twitter_cards.rb
card-1.20.3 mod/twitter/db/migrate_cards/20170305112346_add_twitter_cards.rb