Class: Basecamp::Services::SchedulesExtensions::ScheduleEntryFields

Inherits:
Object
  • Object
show all
Defined in:
lib/basecamp/services/schedules_extensions.rb

Overview

A schedule entry's writable state, yielded to the #edit_entry block.

The full-state members are plain accessors: they are resent whether or not the block touches them, so nothing has to be recorded. The carve-outs are readable — seeded from the read-back so a block can inspect the current join link, highlight and participants before deciding — but each writer records the address, and only an addressed carve-out reaches the wire.

Dirty tracking is by setter invocation, deliberately, and not by comparing the block's result against the read-back: assigning a carve-out the value the GET just returned is an address like any other. A diff would drop it, and the server would then hold whatever a concurrent writer left there instead of the value the caller stated.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(summary:, starts_at:, ends_at:, description:, all_day:, participant_ids:, url:, highlighted:) ⇒ ScheduleEntryFields

Returns a new instance of ScheduleEntryFields.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/basecamp/services/schedules_extensions.rb', line 116

def initialize(summary:, starts_at:, ends_at:, description:, all_day:,
               participant_ids:, url:, highlighted:)
  @summary = summary
  @starts_at = starts_at
  @ends_at = ends_at
  @description = description
  @all_day = all_day
  @participant_ids = participant_ids
  @url = url
  @highlighted = highlighted
  # Nothing in the response seeds a directive.
  @notify = nil
  @addressed = {}
end

Instance Attribute Details

#all_dayObject

Returns the value of attribute all_day.



113
114
115
# File 'lib/basecamp/services/schedules_extensions.rb', line 113

def all_day
  @all_day
end

#descriptionObject

Returns the value of attribute description.



113
114
115
# File 'lib/basecamp/services/schedules_extensions.rb', line 113

def description
  @description
end

#ends_atObject

Returns the value of attribute ends_at.



113
114
115
# File 'lib/basecamp/services/schedules_extensions.rb', line 113

def ends_at
  @ends_at
end

#highlightedObject

Returns the value of attribute highlighted.



114
115
116
# File 'lib/basecamp/services/schedules_extensions.rb', line 114

def highlighted
  @highlighted
end

#notifyObject

Returns the value of attribute notify.



114
115
116
# File 'lib/basecamp/services/schedules_extensions.rb', line 114

def notify
  @notify
end

#participant_idsObject

Returns the value of attribute participant_ids.



114
115
116
# File 'lib/basecamp/services/schedules_extensions.rb', line 114

def participant_ids
  @participant_ids
end

#starts_atObject

Returns the value of attribute starts_at.



113
114
115
# File 'lib/basecamp/services/schedules_extensions.rb', line 113

def starts_at
  @starts_at
end

#summaryObject

Returns the value of attribute summary.



113
114
115
# File 'lib/basecamp/services/schedules_extensions.rb', line 113

def summary
  @summary
end

#urlObject

Returns the value of attribute url.



114
115
116
# File 'lib/basecamp/services/schedules_extensions.rb', line 114

def url
  @url
end

Instance Method Details

#addressed?(name) ⇒ Boolean

Whether the caller addressed this carve-out, by assignment.

Returns:

  • (Boolean)


152
153
154
# File 'lib/basecamp/services/schedules_extensions.rb', line 152

def addressed?(name)
  @addressed.key?(name)
end