This document summarizes a presentation by Natalie Arellano and Vanessa Dean titled "FOMO No Mo'" about using Meetup API data. It includes code samples to make API requests and store Meetup event and member data in a Ruby on Rails application using ActiveRecord. The presentation demonstrates initializing the data model, adding sample members and events, and lessons learned around demystifying APIs and the value of objects and collaboration. Potential next steps discussed are allowing the user to choose seed groups from their Meetup account and adding filters to search results.
10. API Requests
Request URL for members from Flatiron Presents
meetup.com/2/members?group_id=14306982&key=1afad67
Request URL for events that the memberâs groups
are hosting in the next week
https://api.meetup.com/2/events?&sign=true&
photo-host=public&member_id=9053050&
time=1404858600000,%201405463400000
&page=20&key=1afad6758asdfb3q4f
15. Initialization
Member.all.sample(3).each do |member|
my_hash["results"].each do |result|
# create the event if not exists
event = Event.find_or_create_by(:name => result["name"],
:date => result["time"],
:url => result["event_url"])
# create the group if not exists, and assign it to the event
event.group = Group.find_or_create_by(:name => result["group"]["name"],
:urlname => result["group"]["urlname"])
# assign the group color -- assign color is defined on Group
event.group.assign_color
# add the current member to the group if not already a member
event.group.members << member unless event.group.members.include?(member)
# add the event date based on the time in milliseconds given by Meetup
event.assign_date(Time.at(event.date.to_i/1000).to_date)
end
end
def assign_date(new_date)
my_date = EventDate.find_or_create_by(event_date: new_date)
self.event_date = my_date
end
17. Lessons Learned
âą APIs can be demystified
âą Objects make things easier
âą Value of collaboration
18. Next Steps We Could Take
âą Add ability to choose the seed group (instead of
always sampling from Flatiron Presents members)
âą Let user sign in with their Meetup account and
choose groups they are a part of
âą Add filters, e.g. narrow search results by location,
pizza == true
We created an app that addresses this by using the Meetup API to creep on all of you in the Flatiron Presents group and create a list of other events that you might be attending in the next week.
Then it samples a few members at at time to create a list of events being hosted by the other other groups in the upcoming week.
Meetup API lets you pull tons of information - including GET requests for events
Meetup API is great for newbies because there is a ton of documentation
I love the console. Allows you to search for events and build an API request using tons of different search criteria - including member id. The console will spit out a request URL for you.
Request URLs look big and scary but is really just a list of search criteria tacked onto a basic get request.
Not actually my API key - donât try to use it. Donât even need to because everyone on Meetup automatically gets one.
Use Net::HTPP from ruby library to make the request and it returns JSON data.
JSON parser in the ruby library and it returns a hash of details that we want - including the date/time of the event and event URL - as info on the group hosting. Natalie is going to talk more about how we used this data in our app.
Using APIs is all about reading the documentation and testing things out - donât be intimidated!
Adding models and join tables can make it much easier to work with the data than relying on lower level structures like arrays and hashes
Pizza == true is Brandonâs idea to scan for events serving pizza.