Class: Nanowrimo::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/nanowrimo/core.rb

Overview

Core load methods

Direct Known Subclasses

Genre, Region, Site, User

Instance Method Summary collapse

Instance Method Details

#loadObject

Returns the values for all attributes for a given WCAPI type



7
8
9
10
11
12
# File 'lib/nanowrimo/core.rb', line 7

def load
  attribs = Nanowrimo.parse(load_field,id,self.class::FIELDS).first
  self.class::FIELDS.each do |attrib|
    self.send(:"#{attrib}=", attribs[attrib.intern])
  end
end

#load_historyObject

Returns the values for all attributes for a given WCAPI type’s history



15
16
17
# File 'lib/nanowrimo/core.rb', line 15

def load_history
  self.history = Nanowrimo.parse(load_history_field,id,self.class::HISTORY_FIELDS)
end