Looking for some help with the Meetup.com API I'm trying to add to my Rails app. My purpose is just to have a view of local meetups when you open the app.
Here is my code so far:
Routes.rb (at the bottom before the last 'end'):
root 'meetup#get_meetup'
meetup_controller.rb
class MeetupController < ApplicationController
def get_meetup
if params[:city] && params[:name]
@Event = Event.new(params[:city], params[:name])
else
@event = Event.new("90034", "networking")
end
end
end
meetup.rb:
class Event
attr_reader :city, :nam
def initialize(city, name)
url = "http://api.meetup.com/2/events?key#{ENV["meetup_api_key"]}&group_urlname=Girl-Develop-It-Austin&sign=true.json"
response = HTTParty.get(url)
@event = response["event"]
@city = city
@name = name
end
end
I tried to create a new event search using the params for the city and name (aka the event categories) in the rails console.
rails console: Event.new("Austin", "networking")
and it gave me the error NameError: uninitialized constant Event
**I'm still new to using third party API's especially with Rails so I haven't found too much information online about how to correctly get them to work. If someone could please give me some insight into why this isn't correct...or if theres a great article/website to help me with these please let me know!!