meetups-wwcnyc 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/meetups-wwcnyc +2 -2
- data/lib/meetups-wwcnyc.rb +4 -3
- data/lib/meetups/cli.rb +8 -8
- data/lib/meetups/event-scraper.rb +28 -0
- data/lib/meetups/event.rb +14 -22
- data/lib/meetups/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fdf052b19aa997bf3de01788242cf0b63c0ea7a
|
4
|
+
data.tar.gz: fd6cbce6b7ba0d90a6807ef5856b7963a966334b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16171e63c574a014dde9f2e9a0d98852c43819ce5631a0683f52bf2e73b08af7d9539d227a6b2a197f095e415963709954864b581534ea10709d11031055a564
|
7
|
+
data.tar.gz: 0f4f497080fd8efeefe88b1c6a48c8b16817682cb61822628470b9dbf2e35b48d2c17e2de474559506adab27f8cc7722e1ea978a4124dfbcbda0f1b07f594e25
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Meetups
|
2
2
|
|
3
|
-
This Ruby Gem provides a CLI to view the list of upcoming [Meetup events](https://www.meetup.com/WomenWhoCodeNYC/) for the [New York City chapter](https://www.womenwhocode.com/nyc) of [WomenWhoCode](https://www.womenwhocode.com/).
|
3
|
+
This [Ruby Gem](https://rubygems.org/gems/meetups-wwcnyc/versions/0.1.2) provides a CLI to view the list of upcoming [Meetup events](https://www.meetup.com/WomenWhoCodeNYC/) for the [New York City chapter](https://www.womenwhocode.com/nyc) of [WomenWhoCode](https://www.womenwhocode.com/).
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
data/bin/meetups-wwcnyc
CHANGED
data/lib/meetups-wwcnyc.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require_relative './meetups/version'
|
2
|
+
require_relative './meetups/cli'
|
3
|
+
require_relative './meetups/event'
|
4
|
+
require_relative './meetups/event-scraper'
|
4
5
|
|
5
6
|
require 'open-uri'
|
6
7
|
require 'nokogiri'
|
data/lib/meetups/cli.rb
CHANGED
@@ -3,15 +3,15 @@ class Meetups::CLI
|
|
3
3
|
def call
|
4
4
|
list_meetups
|
5
5
|
menu
|
6
|
-
goodbye
|
7
6
|
end
|
8
7
|
|
9
8
|
def list_meetups
|
10
9
|
puts ""
|
11
10
|
puts "---------- WomenWhoCodeNYC's Upcoming Meetups: ----------"
|
12
11
|
puts ""
|
13
|
-
|
14
|
-
|
12
|
+
Meetups::Event.destroy
|
13
|
+
Meetups::EventScraper.scrape_meetups
|
14
|
+
Meetups::Event.all.each.with_index(1) do |event, i|
|
15
15
|
puts "#{i}. #{event.name} - #{event.date}"
|
16
16
|
end
|
17
17
|
puts ""
|
@@ -25,8 +25,8 @@ class Meetups::CLI
|
|
25
25
|
puts ""
|
26
26
|
input = gets.strip.downcase.gsub("'", "")
|
27
27
|
|
28
|
-
if input.to_i > 0 &&
|
29
|
-
event_details =
|
28
|
+
if input.to_i > 0 && Meetups::Event.all[input.to_i - 1]
|
29
|
+
event_details = Meetups::Event.all[input.to_i - 1]
|
30
30
|
puts ""
|
31
31
|
puts "********** #{event_details.name} **********"
|
32
32
|
puts ""
|
@@ -39,10 +39,10 @@ class Meetups::CLI
|
|
39
39
|
elsif input == "list"
|
40
40
|
list_meetups
|
41
41
|
elsif input == "exit"
|
42
|
-
|
42
|
+
goodbye
|
43
43
|
else
|
44
44
|
puts ""
|
45
|
-
puts "Make sure you're typing a number between #{
|
45
|
+
puts "Make sure you're typing a number between #{Meetups::Event.all.index(Meetups::Event.all.first) + 1} - #{Meetups::Event.all.index(Meetups::Event.all.last) + 1} or the word 'list' or 'exit'."
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -53,4 +53,4 @@ class Meetups::CLI
|
|
53
53
|
puts ""
|
54
54
|
end
|
55
55
|
|
56
|
-
end
|
56
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class Meetups::EventScraper
|
2
|
+
|
3
|
+
def self.scrape_meetups
|
4
|
+
# Scrape WWCNYC meetups page and add events and their details to @events array
|
5
|
+
doc = Nokogiri::HTML(open("https://www.meetup.com/WomenWhoCodeNYC/"))
|
6
|
+
first_level = doc.css("div#events-list-module ul.event-list li.event-item").to_a
|
7
|
+
unless first_level.include?("past")
|
8
|
+
first_level.each.with_index do |event, i|
|
9
|
+
unless doc.css("div.event-content div.event-desc")[i].text.include?("Place holder")
|
10
|
+
event = Meetups::Event.new
|
11
|
+
event.name = doc.css("h3.flush--bottom span")[i].text
|
12
|
+
event.date = doc.css("li.dateTime span.date")[i].text
|
13
|
+
event.time = doc.css("li.dateTime span.time")[i].text
|
14
|
+
if doc.css("div.event-content dt.event-venuename")[i].inspect.include?("no-color")
|
15
|
+
event.location = doc.css("div.event-content dt.event-venuename a.no-color")[i].text
|
16
|
+
event.address = doc.css("div.event-content dd.text--secondary")[i].text.split.join(" ").gsub(" (map)", "")
|
17
|
+
else
|
18
|
+
event.location = doc.css("div.event-content dt.event-venuename")[i].text.gsub("\t", "").gsub("\n", "")
|
19
|
+
event.address = doc.css("div.event-content dl.event-where dd")[i].text.gsub("\t", "").gsub("\n", "")
|
20
|
+
end
|
21
|
+
event.url = doc.css("h3.flush--bottom a")[i].attr('href')
|
22
|
+
event.save
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/lib/meetups/event.rb
CHANGED
@@ -1,26 +1,18 @@
|
|
1
1
|
class Meetups::Event
|
2
2
|
attr_accessor :name, :date, :time, :location, :address, :url
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
events
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
event.name = doc.css("h3.flush--bottom span")[i].text
|
13
|
-
event.date = doc.css("li.dateTime span.date")[i].text
|
14
|
-
event.time = doc.css("li.dateTime span.time")[i].text
|
15
|
-
event.location = doc.css("div.event-content dt.event-venuename a.no-color")[i].text
|
16
|
-
event.address = doc.css("div.event-content dd.text--secondary")[i].text.split.join(" ").gsub(" (map)", "")
|
17
|
-
event.url = doc.css("h3.flush--bottom a")[i].attr('href')
|
18
|
-
events << event
|
19
|
-
# events = [event] at this point in first loop
|
20
|
-
end
|
21
|
-
end
|
22
|
-
# events = [all_events]
|
23
|
-
events
|
4
|
+
@@events = []
|
5
|
+
|
6
|
+
def save
|
7
|
+
@@events << self
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.all
|
11
|
+
@@events
|
24
12
|
end
|
25
|
-
|
26
|
-
|
13
|
+
|
14
|
+
def self.destroy
|
15
|
+
@@events = []
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/lib/meetups/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meetups-wwcnyc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kerry Dougherty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- bin/setup
|
104
104
|
- lib/meetups-wwcnyc.rb
|
105
105
|
- lib/meetups/cli.rb
|
106
|
+
- lib/meetups/event-scraper.rb
|
106
107
|
- lib/meetups/event.rb
|
107
108
|
- lib/meetups/version.rb
|
108
109
|
- meetups-wwcnyc.gemspec
|
@@ -127,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
128
|
version: '0'
|
128
129
|
requirements: []
|
129
130
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
131
|
+
rubygems_version: 2.6.6
|
131
132
|
signing_key:
|
132
133
|
specification_version: 4
|
133
134
|
summary: CLI to find upcoming WWC-NYC Meetup events
|