Class: CreateButton

Inherits:
Scrivener
  • Object
show all
Defined in:
lib/shareprogress/filters/create_button.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#advanced_optionsObject

Returns the value of attribute advanced_options.



3
4
5
# File 'lib/shareprogress/filters/create_button.rb', line 3

def advanced_options
  @advanced_options
end

#auto_fillObject

Returns the value of attribute auto_fill.



3
4
5
# File 'lib/shareprogress/filters/create_button.rb', line 3

def auto_fill
  @auto_fill
end

#button_templateObject

Returns the value of attribute button_template.



2
3
4
# File 'lib/shareprogress/filters/create_button.rb', line 2

def button_template
  @button_template
end

#keyObject

Returns the value of attribute key.



2
3
4
# File 'lib/shareprogress/filters/create_button.rb', line 2

def key
  @key
end

#page_titleObject

Returns the value of attribute page_title.



2
3
4
# File 'lib/shareprogress/filters/create_button.rb', line 2

def page_title
  @page_title
end

#page_urlObject

Returns the value of attribute page_url.



2
3
4
# File 'lib/shareprogress/filters/create_button.rb', line 2

def page_url
  @page_url
end

#variantsObject

Returns the value of attribute variants.



3
4
5
# File 'lib/shareprogress/filters/create_button.rb', line 3

def variants
  @variants
end

Instance Method Details

#validateObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/shareprogress/filters/create_button.rb', line 5

def validate
  assert_present :key
  assert_url :page_url
  assert_present :page_title

  assert_member :button_template, %w{sp_em_small sp_em_large sp_tw_small
    sp_tw_large sp_fb_small sp_fb_large}

  assert_present :variants

  if auto_fill
    assert auto_fill == false || auto_fill == true, [:auto_fill, :not_boolean]
  end

  if advanced_options
    if advanced_options["automatic_traffic_routing"]
      assert advanced_options["automatic_traffic_routing"] == false ||
        advanced_options["automatic_traffic_routing"] == true, [:automatic_traffic_routing, :not_boolean]
    end

    if advanced_options["buttons_optimize_actions"]
      assert advanced_options["buttons_optimize_actions"] == false ||
        advanced_options["buttons_optimize_actions"] == true, [:buttons_optimize_actions, :not_boolean]
    end

    if advanced_options["customize_params"]
      cp = advanced_options["customize_params"]

      assert !cp["param"].nil?, [:param, :not_present]
      assert !cp["e"].nil?, [:e, :not_present]
      assert !cp["f"].nil?, [:f, :not_present]
      assert !cp["t"].nil?, [:t, :not_present]
      assert !cp["o"].nil?, [:o, :not_present]
    end

    if advanced_options["id_pass"]
      ip = advanced_options["id_pass"]

      assert !ip["id"].nil?, [:id, :not_present]
      assert !ip["passed"].nil?, [:passed, :not_present]
    end
  end
end