Method: Pathfinder::CharacterSheet#initialize

Defined in:
lib/pathfinder_dnd/character_sheet.rb

#initialize(session, key) ⇒ CharacterSheet

session: a google_drive session key: the Drive identifier for the character sheet document

(it's the key= query param when you load the char sheet in the browser)


84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/pathfinder_dnd/character_sheet.rb', line 84

def initialize(session, key)

    # This is where failure will occur if Oauth is fucked
    @doc = session.spreadsheet_by_key(key)


    # all we need for now
    @stats = @doc.worksheet_by_title(STATS_SHEET)
    @sheets = [@stats]

    if @stats.nil?
        raise "Couldn't load the Stats charsheet"
    end

    # set starting HP
    @hp = self.max_hp

    # write in skill values
    inject_instance_properties(get_raw_skills())
end