Skip to content

Commit

Permalink
Parse owner information from form
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsawicki committed May 19, 2013
1 parent 1dd3ea9 commit 6942ca9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/form-four-spec.coffee
Expand Up @@ -55,3 +55,16 @@ describe 'Form 4 parsing', ->
waitsFor -> openedReport?
runs ->
expect(openedReport.getProfit()).toBe 3741450

describe 'getOwner()', ->
it 'returns the name, title, and cik of the owner', ->
reportPath = path.join(__dirname, 'fixtures', 'orcl-form4-hurd.xml')
openedReport = null
FormFour.open reportPath, (error, report) ->
openedReport = report
waitsFor -> openedReport?
runs ->
{name, title, cik} = openedReport.getOwner()
expect(name).toBe 'HURD MARK V'
expect(title).toBe 'President'
expect(cik).toBe '0001223778'
6 changes: 6 additions & 0 deletions src/form-four.coffee
Expand Up @@ -65,6 +65,12 @@ class FormFour

disposals

getOwner: ->
cik = xpath.select('//reportingOwner/reportingOwnerId/rptOwnerCik/text()', @document).toString()
name = xpath.select('//reportingOwner/reportingOwnerId/rptOwnerName/text()', @document).toString()
title = xpath.select('//reportingOwner/reportingOwnerRelationship/officerTitle/text()', @document).toString()
{cik, name, title}

getProfit: ->
acquiredShares = 0
acquiredCost = 0
Expand Down

0 comments on commit 6942ca9

Please sign in to comment.