Created
July 19, 2011 00:16
-
-
Save danielmoore/1091011 to your computer and use it in GitHub Desktop.
Gets a list of meetup RSVPs using the meetup API.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-MeetupRsvps([string]$eventId, [string]$apiKey) { | |
$nameWord = "[\w-']{2,}" | |
$regex = "^(?'first'$nameWord) ((\w\.?|($nameWord )+) )?(?'last'$nameWord)|(?'last'$nameWord), ?(?'first'$nameWord)( \w\.|( $nameWord)+)?$" | |
function Get-AttendeeInfo { | |
process { | |
$matches = $null | |
$answer = $_.answers.answers_item | |
if(-not ($_.name -match $regex)) { $answer -match $regex | Out-Null } | |
return New-Object PSObject -Property @{ | |
'FirstName' = $matches.first | |
'LastName' = $matches.last | |
'RSVPName' = $_.name | |
'RSVPAnswer' = $answer | |
'RSVPGuests' = $_.guests | |
} | |
} | |
} | |
$xml = [Xml](New-Object Net.WebClient).DownloadString("https://api.meetup.com/rsvps.xml?event_id=$eventId`&key=$apiKey") | |
$xml.SelectNodes('/results/items/item[response="yes"]') | Get-AttendeeInfo | select FirstName, LastName, RSVPName, RSVPAnswer, RSVPGuests | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment