Module: SystemFixtures::Products
- Included in:
- Product
- Defined in:
- lib/generators/permissify/product/template/products.rb
Constant Summary collapse
- SEED_SPECIFICATIONS =
[ [1, 'Basic Service'], [2, 'Online Ordering'], [3, 'Loyalty'], [4, 'Webpage Builder'], [5, 'eGift'], [6, 'Guest Management'], [7, 'Marketing Engine'], [8, 'Social Media 1'], [9, 'Social Media 2'], [10, 'Social Media 3'], [11, 'Social Marketing Engine'], ]
Instance Method Summary collapse
- #basic_service_permissions ⇒ Object
- #create_basic_service ⇒ Object
- #create_egift ⇒ Object
- #create_guest_management ⇒ Object
- #create_loyalty ⇒ Object
- #create_marketing_engine ⇒ Object
- #create_online_ordering ⇒ Object
- #create_social_marketing_engine ⇒ Object
- #create_social_media_1 ⇒ Object
- #create_social_media_2 ⇒ Object
- #create_social_media_3 ⇒ Object
- #create_webpage_builder ⇒ Object
- #create_with(id) ⇒ Object
- #egift_permissions ⇒ Object
- #guest_management_permissions ⇒ Object
- #loyalty_permissions ⇒ Object
- #marketing_engine_permissions ⇒ Object
- #online_ordering_permissions ⇒ Object
- #ph(permissions) ⇒ Object
- #seed ⇒ Object
- #seeded?(product) ⇒ Boolean
- #social_marketing_engine_permissions ⇒ Object
- #social_media_1_permissions ⇒ Object
- #social_media_2_permissions ⇒ Object
- #social_media_3_permissions ⇒ Object
- #webpage_builder_permissions ⇒ Object
Instance Method Details
#basic_service_permissions ⇒ Object
32 33 34 |
# File 'lib/generators/permissify/product/template/products.rb', line 32 def ph :basic_service_on end |
#create_basic_service ⇒ Object
19 |
# File 'lib/generators/permissify/product/template/products.rb', line 19 def create_basic_service; create_with 1; end |
#create_egift ⇒ Object
23 |
# File 'lib/generators/permissify/product/template/products.rb', line 23 def create_egift; create_with 5; end |
#create_guest_management ⇒ Object
24 |
# File 'lib/generators/permissify/product/template/products.rb', line 24 def create_guest_management; create_with 6; end |
#create_loyalty ⇒ Object
21 |
# File 'lib/generators/permissify/product/template/products.rb', line 21 def create_loyalty; create_with 3; end |
#create_marketing_engine ⇒ Object
25 |
# File 'lib/generators/permissify/product/template/products.rb', line 25 def create_marketing_engine; create_with 7; end |
#create_online_ordering ⇒ Object
20 |
# File 'lib/generators/permissify/product/template/products.rb', line 20 def create_online_ordering; create_with 2; end |
#create_social_marketing_engine ⇒ Object
29 |
# File 'lib/generators/permissify/product/template/products.rb', line 29 def ; create_with 11; end |
#create_social_media_1 ⇒ Object
26 |
# File 'lib/generators/permissify/product/template/products.rb', line 26 def ; create_with 8; end |
#create_social_media_2 ⇒ Object
27 |
# File 'lib/generators/permissify/product/template/products.rb', line 27 def ; create_with 9; end |
#create_social_media_3 ⇒ Object
28 |
# File 'lib/generators/permissify/product/template/products.rb', line 28 def ; create_with 10; end |
#create_webpage_builder ⇒ Object
22 |
# File 'lib/generators/permissify/product/template/products.rb', line 22 def create_webpage_builder; create_with 4; end |
#create_with(id) ⇒ Object
30 |
# File 'lib/generators/permissify/product/template/products.rb', line 30 def create_with(id); create_with_id(:product, id, SEED_SPECIFICATIONS.assoc(id)[1]); end |
#egift_permissions ⇒ Object
38 |
# File 'lib/generators/permissify/product/template/products.rb', line 38 def ; ph :egift_on; end |
#guest_management_permissions ⇒ Object
39 |
# File 'lib/generators/permissify/product/template/products.rb', line 39 def ; ph :guest_management_on; end |
#loyalty_permissions ⇒ Object
36 |
# File 'lib/generators/permissify/product/template/products.rb', line 36 def ; ph :loyalty_on; end |
#marketing_engine_permissions ⇒ Object
40 |
# File 'lib/generators/permissify/product/template/products.rb', line 40 def ; ph :marketing_engine_on; end |
#online_ordering_permissions ⇒ Object
35 |
# File 'lib/generators/permissify/product/template/products.rb', line 35 def ; ph :online_ordering_on; end |
#ph(permissions) ⇒ Object
65 66 67 68 69 70 |
# File 'lib/generators/permissify/product/template/products.rb', line 65 def ph() = {} = [] unless .kind_of?(Array) .each{|p| [p.to_s] = {"0"=>"1"}} end |
#seed ⇒ Object
17 |
# File 'lib/generators/permissify/product/template/products.rb', line 17 def seed; create_seeds SEED_SPECIFICATIONS; end |
#seeded?(product) ⇒ Boolean
16 |
# File 'lib/generators/permissify/product/template/products.rb', line 16 def seeded?(product); product.id <= SEED_SPECIFICATIONS.count; end |
#social_marketing_engine_permissions ⇒ Object
58 59 60 61 62 63 |
# File 'lib/generators/permissify/product/template/products.rb', line 58 def = ['marketing_engine_on'] = {'0' => '1'} ['social_media_repeat'] = {'0' => '1'} end |
#social_media_1_permissions ⇒ Object
42 43 44 45 46 47 |
# File 'lib/generators/permissify/product/template/products.rb', line 42 def = Ability.([], %w(social_media facebook twitter), %w(Product Role)) ['social_media_setup'] = {'0' => '1'} ['social_media_view'] = {'0' => '1'} end |
#social_media_2_permissions ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/generators/permissify/product/template/products.rb', line 48 def = ['social_media_create'] = {'0' => '1'} ['facebook_post'] = {'0' => '1'} ['twitter_tweet'] = {'0' => '1'} end |
#social_media_3_permissions ⇒ Object
55 56 57 |
# File 'lib/generators/permissify/product/template/products.rb', line 55 def Ability.([], %w(social_media_repeat), %w(Product Role)) end |
#webpage_builder_permissions ⇒ Object
37 |
# File 'lib/generators/permissify/product/template/products.rb', line 37 def ; ph :webpage_builder_on; end |