Class: EventObject

Inherits:
Object
  • Object
show all
Includes:
DataFactory, DateFactory, Foundry, StringFactory, Workflows
Defined in:
lib/sambal-cle/data_objects/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Workflows

menu_link, #open_my_site_by_name, #reset

Constructor Details

#initialize(browser, opts = {}) ⇒ EventObject

Returns a new instance of EventObject.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/sambal-cle/data_objects/event.rb', line 13

def initialize(browser, opts={})
  @browser = browser

  defaults = {
      :title=>random_alphanums,
      :month=>minutes_from_now(15)[:MON],
      :day=>minutes_from_now(15)[:day_of_month],
      :year=>minutes_from_now(15)[:year],
      :start_hour=>minutes_from_now(15)[:hour],
      :start_minute=>minutes_from_now(15)[:minute_rounded],
      :start_meridian=>minutes_from_now(15)[:meridian],
      :message=>random_multiline(400, 20, :lorem)
  }
  options = defaults.merge(opts)

  set_options(options)
  requires @site
end

Instance Attribute Details

#dayObject

Returns the value of attribute day.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def day
  @day
end

#duration_hoursObject

Returns the value of attribute duration_hours.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def duration_hours
  @duration_hours
end

#duration_minutesObject

Returns the value of attribute duration_minutes.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def duration_minutes
  @duration_minutes
end

#end_hourObject

Returns the value of attribute end_hour.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def end_hour
  @end_hour
end

#end_meridianObject

Returns the value of attribute end_meridian.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def end_meridian
  @end_meridian
end

#end_minuteObject

Returns the value of attribute end_minute.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def end_minute
  @end_minute
end

Returns the value of attribute link.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def link
  @link
end

#messageObject

Returns the value of attribute message.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def message
  @message
end

#message_htmlObject

Returns the value of attribute message_html.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def message_html
  @message_html
end

#monthObject

Returns the value of attribute month.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def month
  @month
end

#siteObject

Returns the value of attribute site.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def site
  @site
end

#start_hourObject

Returns the value of attribute start_hour.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def start_hour
  @start_hour
end

#start_meridianObject

Returns the value of attribute start_meridian.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def start_meridian
  @start_meridian
end

#start_minuteObject

Returns the value of attribute start_minute.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def start_minute
  @start_minute
end

#titleObject

Returns the value of attribute title.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def title
  @title
end

#yearObject

Returns the value of attribute year.



9
10
11
# File 'lib/sambal-cle/data_objects/event.rb', line 9

def year
  @year
end

Instance Method Details

#createObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/sambal-cle/data_objects/event.rb', line 32

def create
  open_my_site_by_name @site
  calendar
  on Calendar do |cal|
    cal.add_event
  end
  on AddEditEvent do |add_event|
    add_event.enter_source_text add_event.editor, @message
    add_event.title.set @title
    add_event.month.select @month
    add_event.day.select @day
    add_event.year.select @year
    add_event.start_hour.select @start_hour
    add_event.start_minute.select @start_minute
    add_event.start_meridian.select @start_meridian
    if @end_hour == nil && @duration_hours == nil
      @duration_hours = add_event.hours.value
      @duration_minutes = add_event.minutes.value
      @end_hour = add_event.end_hour.value
      @end_minute = add_event.end_minute.value
      @end_meridian = add_event.end_meridian.value
    elsif @end_hour == nil
      # Todo: Add this later
    elsif @duration_hours == nil
      # Todo: Add this later
    end
    add_event.save_event
  end
  on Calendar do |cal|
    @link = cal.event_href @title
  end
end

#viewObject



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/sambal-cle/data_objects/event.rb', line 65

def view
  open_my_site_by_name @site
  calendar
  on Calendar do |cal|
    cal.open_event @title
  end
  on EventDetail do |event|
    @message_html = event.message_html
    # TODO: Lots of stuff to add here...
    # ...event.details...
  end
end