meetup_cli 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8eba8284b81f53cad0866589808a22504fe875a4250e8ba3501a0ad8b2257f4e
4
+ data.tar.gz: 5b00b5b71ce11db2ee121f9019a90dad43d77b21d66357dbe49d87a1f4175d31
5
+ SHA512:
6
+ metadata.gz: 264851eeeaf7fc01405fdfe5b609458c1ff042c02ad7caa504c18ba482fcfe2befacf7efc88588004bfc62c9031c5b63cb7d2e074be9c6115abf9eb1fe031fb1
7
+ data.tar.gz: 02ae78630df33c6b215ea93ff46f69df00fba0e3e5d1d791eedde10bdecec1b317eb3dbde12d7b68884e0cd6c6fdc7f07a963e6cb816bd50e7a3ba81f30c70bd
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in meetup_cli.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,57 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ meetup_cli (0.1.0)
5
+ nokogiri (~> 1.6)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.5.2)
11
+ public_suffix (>= 2.0.2, < 4.0)
12
+ capybara (3.4.2)
13
+ addressable
14
+ mini_mime (>= 0.1.3)
15
+ nokogiri (~> 1.8)
16
+ rack (>= 1.6.0)
17
+ rack-test (>= 0.6.3)
18
+ xpath (~> 3.1)
19
+ cliver (0.3.2)
20
+ coderay (1.1.2)
21
+ method_source (0.9.0)
22
+ mini_mime (1.0.0)
23
+ mini_portile2 (2.3.0)
24
+ nokogiri (1.8.4)
25
+ mini_portile2 (~> 2.3.0)
26
+ poltergeist (1.18.1)
27
+ capybara (>= 2.1, < 4)
28
+ cliver (~> 0.3.1)
29
+ websocket-driver (>= 0.2.0)
30
+ pry (0.9.12.6)
31
+ coderay (~> 1.0)
32
+ method_source (~> 0.8)
33
+ slop (~> 3.4)
34
+ public_suffix (3.0.2)
35
+ rack (2.0.5)
36
+ rack-test (1.1.0)
37
+ rack (>= 1.0, < 3)
38
+ rake (10.4.2)
39
+ slop (3.6.0)
40
+ websocket-driver (0.7.0)
41
+ websocket-extensions (>= 0.1.0)
42
+ websocket-extensions (0.1.3)
43
+ xpath (3.1.0)
44
+ nokogiri (~> 1.8)
45
+
46
+ PLATFORMS
47
+ ruby
48
+
49
+ DEPENDENCIES
50
+ bundler (~> 1.16)
51
+ meetup_cli!
52
+ poltergeist
53
+ pry (~> 0.9.12.2)
54
+ rake (~> 10.0)
55
+
56
+ BUNDLED WITH
57
+ 1.16.3
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # MeetupCli
2
+
3
+ Welcome to your new gem! This gem allows user to scan through multiple events around the neighbourhood. Simply select the category and activity and find the latest meetups in the upcoming weeks.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'meetup_cli'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install meetup_cli
20
+
21
+ ## Usage
22
+
23
+
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/'tahseen447'/meetup_cli.
34
+
35
+ # meetup-cli-app
36
+ An app that will help users find a meetup in the neighborhood based on their interests.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "meetup_cli"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/meetup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "meetup_cli"
5
+
6
+ #require './lib/meetup_cli'
7
+
8
+ MeetupCli::CLI.new.call
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,30 @@
1
+ class MeetupCli::Activity
2
+ attr_accessor :name, :tag_line, :location, :organiser, :total_members, :type_of_group, :about, :meetup, :url
3
+
4
+ def initialize(name, url, tag_line)
5
+ @name = name
6
+ @url = url
7
+ @tag_line = tag_line
8
+ end
9
+
10
+ def list_meetup
11
+ # scrape url/events gives no upcoming meetups set up the method upcoming? = false
12
+ #create the meetup
13
+ MeetupCli::Scraper.list_meetup(self)
14
+ end
15
+
16
+ def display_meetups
17
+ list_meetup
18
+ puts "#{@name}"
19
+ puts "#{@location}"
20
+ puts "#{@type_of_group}"
21
+ puts "#{@organiser}"
22
+ puts "#{@total_members}"
23
+ puts "#{@about}"
24
+ if @meetup.upcoming
25
+ @meetup.display
26
+ else
27
+ "Sorry no upcoming meetups!!"
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,17 @@
1
+ class MeetupCli::Category
2
+ attr_accessor :name, :url
3
+
4
+ def initialize(name, url)
5
+ @name = name
6
+ @url = url
7
+ end
8
+
9
+
10
+ def activities
11
+ #array of all activities in the area based on the category
12
+ #scrape the url to get all the activities
13
+ #create Activiy objects and fill in the array
14
+ activities_array =MeetupCli::Scraper.activities(self)
15
+ activities_array
16
+ end
17
+ end
@@ -0,0 +1,49 @@
1
+ class MeetupCli::CLI
2
+ def call
3
+ list_categories
4
+ menu
5
+ list_activities
6
+ exit_message
7
+ end
8
+
9
+ def list_categories
10
+ puts "Welcome to Meetup!!"
11
+ puts "Enter the category you are interested in or exit:"
12
+ @categories = MeetupCli::Scraper.categories
13
+ @categories.each_with_index {|val, index| puts "#{index+1}. #{val.name} - #{val.url}"}
14
+ end
15
+
16
+ def menu
17
+ input = nil
18
+ #puts "Enter the category you are interested in or exit:"
19
+ input = gets.strip.downcase
20
+ if input.to_i > 0 && input.to_i <= @categories.size
21
+ # get the list of activities for that Category
22
+ #scraper should get the url and scrape the details
23
+ @activities = @categories[input.to_i-1].activities
24
+ @activities.each_with_index {|val, index| puts "#{index+1}. #{val.name} | #{val.tag_line} | #{val.url}"}
25
+ elsif input == "list"
26
+ list_categories
27
+ else
28
+ puts "Not sure what you want, type list or exit"
29
+ end
30
+ end
31
+
32
+ def list_activities
33
+ #from the activities array thats now displayed
34
+ puts "Enter the activities you are interested in or exit:"
35
+ input = gets.strip.downcase
36
+ if input.to_i > 0 && input.to_i <= @activities.size
37
+ # get details of that activities-meetup requested
38
+ @activities[input.to_i-1].display_meetups
39
+ elsif input == "list"
40
+ list_activities
41
+ else
42
+ puts "Not sure what you want, type list or exit"
43
+ end
44
+ end
45
+
46
+ def exit_message
47
+ puts "Enjoy your day!"
48
+ end
49
+ end
@@ -0,0 +1,14 @@
1
+ class MeetupCli::Meetup
2
+ attr_accessor :name, :url, :time_object, :venue, :host, :upcoming, :about, :attendees
3
+
4
+
5
+ def display
6
+ puts "Upcoming Meetup in the Neighborhood"
7
+ puts "#{@name}"
8
+ puts "#{@host}"
9
+ puts "#{@time_object}"
10
+ puts "#{@venue}"
11
+ puts "#{@attendees}"
12
+ puts "#{@about}"
13
+ end
14
+ end
@@ -0,0 +1,88 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+ require 'capybara/poltergeist'
5
+
6
+ Capybara.register_driver :poltergeist do |app|
7
+ Capybara::Poltergeist::Driver.new(app, {js_errors: false})
8
+ end
9
+
10
+ class MeetupCli::Scraper
11
+
12
+ def self.categories
13
+ #scrape the site and list activities
14
+ category_list = []
15
+ doc = Nokogiri::HTML(open("https://www.meetup.com/"))
16
+ category_elements = doc.css(".exploreHome-categories-card")
17
+ category_elements.each do |element|
18
+ url = element.css("a")[0]['href']
19
+ name = element.css("h4").text
20
+ category = MeetupCli::Category.new(name, url)
21
+ category_list << category
22
+ end
23
+ category_list
24
+ end
25
+
26
+ def self.activities(category)
27
+ url = category.url
28
+ activity_list = []
29
+ doc = Nokogiri::HTML(open(url))
30
+ activity_elements = doc.css("a.groupCard--photo.loading.nametag-photo")
31
+ activity_elements.each do |element|
32
+ name = element.css("h3.padding-none.inline-block.loading").text.strip
33
+ url = element['href']
34
+ tag_line = element.css("p.small.ellipsize").text.strip
35
+ activity = MeetupCli::Activity.new(name, url, tag_line)
36
+ activity_list << activity
37
+ end
38
+ activity_list
39
+ end
40
+
41
+ def self.list_meetup(activity)
42
+ url = activity.url
43
+ doc = Nokogiri::HTML(open(url))
44
+ activity.about = doc.css("div.group-description.runningText").css("p").text
45
+ activity.organiser = doc.css("span.text--bold.text--small")[0].text
46
+ #others = doc.css("p.orgInfo-otherLeadership.display--inline.text--small")[0].text
47
+ #[activity.organiser, others].join(' ')
48
+ activity.location = doc.css("ul.inlineblockList.inlineblockList--separated").css("span")[0].text
49
+ activity.total_members = doc.css("ul.inlineblockList.inlineblockList--separated").css("span")[1].text
50
+ activity.type_of_group = doc.css("ul.inlineblockList.inlineblockList--separated").css("span")[2].text
51
+
52
+ meetup = MeetupCli::Meetup.new
53
+ #use poltergiest to extract java script data from website
54
+ new_url = [url, "events"].join
55
+ session = Capybara::Session.new(:poltergeist)
56
+ session.visit(new_url)
57
+ #check if it has upcoming meetups
58
+ upcoming = true
59
+ begin
60
+ session.first(".emptyEventCard").text
61
+ rescue
62
+ Capybara::ExpectationNotMet
63
+ upcoming = false
64
+ binding.pry
65
+ end
66
+ if upcoming == false
67
+ begin
68
+ meetup.name = session.first(".eventCardHead--title")['innerHTML']
69
+ meetup.time_object = session.first(".eventTimeDisplay-startDate span")['innerHTML']
70
+ binding.pry
71
+ meetup.venue = session.first(".venueDisplay").text
72
+ meetup.host = session.first(".text--secondary.text--tiny").text
73
+ meetup.about =session.first(".eventCard--MainContent div").text
74
+ meetup.attendees =session.first(".avatarRow--attendingCount").text
75
+ meetup.upcoming = true
76
+ rescue
77
+ Capybara::ExpectationNotMet
78
+ binding.pry
79
+ upcoming = false
80
+ end
81
+ else
82
+ binding.pry
83
+ meetup.upcoming = upcoming
84
+ end
85
+ binding.pry
86
+ activity.meetup = meetup
87
+ end
88
+ end
@@ -0,0 +1,3 @@
1
+ module MeetupCli
2
+ VERSION = "0.1.0"
3
+ end
data/lib/meetup_cli.rb ADDED
@@ -0,0 +1,8 @@
1
+ require_relative "meetup_cli/version"
2
+ require_relative "meetup_cli/cli"
3
+ require_relative "meetup_cli/scraper"
4
+ require_relative "meetup_cli/category"
5
+ require_relative "meetup_cli/activity"
6
+ require_relative "meetup_cli/meetup"
7
+
8
+ require 'pry'
@@ -0,0 +1,39 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "meetup_cli/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "meetup_cli"
8
+ spec.version = MeetupCli::VERSION
9
+ spec.authors = ["'tahseen447 Siddiqui'"]
10
+ spec.email = ["'tahseenfatima1986@gmail.com'"]
11
+
12
+ spec.summary = %q{Meet up Cli app helps users find latest upcoming meetups in the Neighborhood based on their interests.}
13
+ spec.description = %q{Enter the category and select activities based on interests, the app gives out upcoming meetups around the neighborhood }
14
+ spec.homepage = "https://www.github.com/tahseen447"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata["allowed_push_host"] = 'https://rubygems.org/'
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against " \
22
+ "public gem pushes."
23
+ end
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_development_dependency "bundler", "~> 1.16"
35
+ spec.add_development_dependency "rake", "~> 10.0"
36
+ spec.add_development_dependency 'pry', '~> 0.9.12.2'
37
+ spec.add_dependency 'nokogiri','~>1.6'
38
+ spec.add_development_dependency 'poltergeist'
39
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: meetup_cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - "'tahseen447 Siddiqui'"
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-08-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.9.12.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.9.12.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.6'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: poltergeist
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: 'Enter the category and select activities based on interests, the app
84
+ gives out upcoming meetups around the neighborhood '
85
+ email:
86
+ - "'tahseenfatima1986@gmail.com'"
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - Gemfile
93
+ - Gemfile.lock
94
+ - README.md
95
+ - Rakefile
96
+ - bin/console
97
+ - bin/meetup
98
+ - bin/setup
99
+ - lib/meetup_cli.rb
100
+ - lib/meetup_cli/activity.rb
101
+ - lib/meetup_cli/category.rb
102
+ - lib/meetup_cli/cli.rb
103
+ - lib/meetup_cli/meetup.rb
104
+ - lib/meetup_cli/scraper.rb
105
+ - lib/meetup_cli/version.rb
106
+ - meetup_cli.gemspec
107
+ homepage: https://www.github.com/tahseen447
108
+ licenses: []
109
+ metadata:
110
+ allowed_push_host: https://rubygems.org/
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.7.7
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Meet up Cli app helps users find latest upcoming meetups in the Neighborhood
131
+ based on their interests.
132
+ test_files: []