Class: Meetups::Event
- Inherits:
-
Object
- Object
- Meetups::Event
- Defined in:
- lib/meetups/event.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#date ⇒ Object
Returns the value of attribute date.
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#time ⇒ Object
Returns the value of attribute time.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
2 3 4 |
# File 'lib/meetups/event.rb', line 2 def address @address end |
#date ⇒ Object
Returns the value of attribute date.
2 3 4 |
# File 'lib/meetups/event.rb', line 2 def date @date end |
#location ⇒ Object
Returns the value of attribute location.
2 3 4 |
# File 'lib/meetups/event.rb', line 2 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/meetups/event.rb', line 2 def name @name end |
#time ⇒ Object
Returns the value of attribute time.
2 3 4 |
# File 'lib/meetups/event.rb', line 2 def time @time end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/meetups/event.rb', line 2 def url @url end |
Class Method Details
.scrape_meetups ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/meetups/event.rb', line 4 def self.scrape_meetups # Scrape WWCNYC meetups page and add events and their details to @events array doc = Nokogiri::HTML(open("https://www.meetup.com/WomenWhoCodeNYC/")) events = [] doc.css("div#events-list-module ul.event-list li.event-item").to_a.each.with_index do |event, i| event = Meetups::Event.new # events still = [] at this point in first loop unless doc.css("h3.flush--bottom span")[i].text.include?("Holiday") event.name = doc.css("h3.flush--bottom span")[i].text event.date = doc.css("li.dateTime span.date")[i].text event.time = doc.css("li.dateTime span.time")[i].text event.location = doc.css("div.event-content dt.event-venuename a.no-color")[i].text event.address = doc.css("div.event-content dd.text--secondary")[i].text.split.join(" ").gsub(" (map)", "") event.url = doc.css("h3.flush--bottom a")[i].attr('href') events << event # events = [event] at this point in first loop end end # events = [all_events] events end |