Class: CampfireExport::Room
- Inherits:
-
Object
- Object
- CampfireExport::Room
- Includes:
- IO
- Defined in:
- lib/campfire_export.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_update ⇒ Object
Returns the value of attribute last_update.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #export(start_date = nil, end_date = nil) ⇒ Object
-
#initialize(room_xml) ⇒ Room
constructor
A new instance of Room.
Methods included from IO
#api_url, #export_dir, #export_file, #get, #log, #verify_export, #zero_pad
Constructor Details
#initialize(room_xml) ⇒ Room
Returns a new instance of Room.
161 162 163 164 165 166 |
# File 'lib/campfire_export.rb', line 161 def initialize(room_xml) @id = room_xml.xpath('id').text @name = room_xml.xpath('name').text created_utc = DateTime.parse(room_xml.xpath('created-at').text) @created_at = Account.timezone.utc_to_local(created_utc) end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
159 160 161 |
# File 'lib/campfire_export.rb', line 159 def created_at @created_at end |
#id ⇒ Object
Returns the value of attribute id.
159 160 161 |
# File 'lib/campfire_export.rb', line 159 def id @id end |
#last_update ⇒ Object
Returns the value of attribute last_update.
159 160 161 |
# File 'lib/campfire_export.rb', line 159 def last_update @last_update end |
#name ⇒ Object
Returns the value of attribute name.
159 160 161 |
# File 'lib/campfire_export.rb', line 159 def name @name end |
Instance Method Details
#export(start_date = nil, end_date = nil) ⇒ Object
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/campfire_export.rb', line 168 def export(start_date=nil, end_date=nil) # Figure out how to do the least amount of work while still conforming # to the requester's boundary dates. find_last_update start_date.nil? ? date = created_at : date = [start_date, created_at].max end_date.nil? ? end_date = last_update : end_date = [end_date, last_update].min while date <= end_date transcript = Transcript.new(self, date) transcript.export # Ensure that we stay well below the 37signals API limits. sleep(1.0/10.0) date = date.next end end |