meetupevents 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.rake_tasks~ +3 -0
- data/.rubocop.yml +5 -0
- data/.travis.yml +10 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +64 -0
- data/LICENSE +21 -0
- data/README.md +34 -0
- data/Rakefile +36 -0
- data/bin/meetup_api +14 -0
- data/bin/meetupevents +14 -0
- data/config/credentials.yml.example +2 -0
- data/lib/meetupevents/city.rb +42 -0
- data/lib/meetupevents/event.rb +35 -0
- data/lib/meetupevents/group.rb +44 -0
- data/lib/meetupevents/location.rb +13 -0
- data/lib/meetupevents/meetup_api.rb +97 -0
- data/lib/meetupevents/version.rb +3 -0
- data/lib/meetupevents.rb +4 -0
- data/meetupevents.gemspec +31 -0
- data/spec/meetupevents_spec.rb +58 -0
- data/spec/spec_helper.rb +28 -0
- metadata +209 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 921eb0b4a948eaaec1684d45303caa2cdec0379c
|
4
|
+
data.tar.gz: 1c872e41d29eb833add1ac29968fd44000cc97f6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 26c6487ca779f0421d062331344abc42d956a1859b2e7b087eef503bd54225a58373bc05af1562f83ad9f894ceb068a242a73a8999e9819c0a99f5a8c263cd78
|
7
|
+
data.tar.gz: 1f00163067da7e94f293b0ac26ebeb8d73174e2057feb88befd65942c698c2a2757322faefcb1558b1d49e1620df0a02e2c571f77982d29394d2bd8c4b472121
|
data/.gitignore
ADDED
data/.rake_tasks~
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.4.0)
|
5
|
+
crack (0.4.3)
|
6
|
+
safe_yaml (~> 1.0.0)
|
7
|
+
docile (1.1.5)
|
8
|
+
domain_name (0.5.20161021)
|
9
|
+
unf (>= 0.0.5, < 1.0.0)
|
10
|
+
erubis (2.7.0)
|
11
|
+
flay (2.8.1)
|
12
|
+
erubis (~> 2.7.0)
|
13
|
+
path_expander (~> 1.0)
|
14
|
+
ruby_parser (~> 3.0)
|
15
|
+
sexp_processor (~> 4.0)
|
16
|
+
hashdiff (0.3.0)
|
17
|
+
http (2.0.3)
|
18
|
+
addressable (~> 2.3)
|
19
|
+
http-cookie (~> 1.0)
|
20
|
+
http-form_data (~> 1.0.1)
|
21
|
+
http_parser.rb (~> 0.6.0)
|
22
|
+
http-cookie (1.0.3)
|
23
|
+
domain_name (~> 0.5)
|
24
|
+
http-form_data (1.0.1)
|
25
|
+
http_parser.rb (0.6.0)
|
26
|
+
json (2.0.2)
|
27
|
+
minitest (5.9.1)
|
28
|
+
minitest-rg (5.2.0)
|
29
|
+
minitest (~> 5.0)
|
30
|
+
path_expander (1.0.0)
|
31
|
+
rake (11.3.0)
|
32
|
+
ruby_parser (3.8.3)
|
33
|
+
sexp_processor (~> 4.1)
|
34
|
+
safe_yaml (1.0.4)
|
35
|
+
sexp_processor (4.7.0)
|
36
|
+
simplecov (0.12.0)
|
37
|
+
docile (~> 1.1.0)
|
38
|
+
json (>= 1.8, < 3)
|
39
|
+
simplecov-html (~> 0.10.0)
|
40
|
+
simplecov-html (0.10.0)
|
41
|
+
unf (0.1.4)
|
42
|
+
unf_ext
|
43
|
+
unf_ext (0.0.7.2)
|
44
|
+
vcr (3.0.3)
|
45
|
+
webmock (2.1.0)
|
46
|
+
addressable (>= 2.3.6)
|
47
|
+
crack (>= 0.3.2)
|
48
|
+
hashdiff
|
49
|
+
|
50
|
+
PLATFORMS
|
51
|
+
ruby
|
52
|
+
|
53
|
+
DEPENDENCIES
|
54
|
+
flay
|
55
|
+
http
|
56
|
+
minitest
|
57
|
+
minitest-rg
|
58
|
+
rake
|
59
|
+
simplecov
|
60
|
+
vcr
|
61
|
+
webmock
|
62
|
+
|
63
|
+
BUNDLED WITH
|
64
|
+
1.13.5
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT LICENSE
|
2
|
+
|
3
|
+
Copyright (c) Team Seis, SOA <soumya.ray@gmail.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# MeetUp
|
2
|
+
[![Build Status](https://travis-ci.org/soa2016t6/MeetUp.svg?branch=master)](https://travis-ci.org/soa2016t6/MeetUp)
|
3
|
+
|
4
|
+
meetup_api is a gem that specializes in getting data from Meetup Groups, cities and events.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
If you are working on a project, add this to your Gemfile: `gem 'meetup_api'`
|
9
|
+
|
10
|
+
For ad hoc installation from command line:
|
11
|
+
|
12
|
+
```$ gem install meetup_api``` (SOON)
|
13
|
+
|
14
|
+
## Setup Credentials
|
15
|
+
|
16
|
+
Please setup your Meetup developer account, and get an API key from https://secure.meetup.com/meetup_api/key/
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
Require meetup_api gem in your code: `require 'meetup_api'`
|
21
|
+
|
22
|
+
Supply your Meetup credentials to our library in one of two ways:
|
23
|
+
- Setup environment variables: `ENV['MEETUP_API_KEY']`
|
24
|
+
- or, provide them directly to meetup_api:
|
25
|
+
|
26
|
+
```
|
27
|
+
Meetup::MeetupApi.config = { access_key: ENV['MEETUP_API_KEY'] }
|
28
|
+
```
|
29
|
+
|
30
|
+
See the following example code for more usage details:
|
31
|
+
|
32
|
+
```
|
33
|
+
WIP
|
34
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# for now, you must be in the MeetUp/spec directory
|
2
|
+
# otherwise the commands 'rake tests:spec' and 'rake tests:wipe' will fail
|
3
|
+
namespace :tests do
|
4
|
+
desc 'run tests'
|
5
|
+
task :spec do
|
6
|
+
sh 'ruby spec/meetupevents_spec.rb'
|
7
|
+
end
|
8
|
+
|
9
|
+
desc 'delete cassette fixtures'
|
10
|
+
task :wipe do
|
11
|
+
sh 'rm spec/fixtures/cassettes/*.yml' do |ok, _|
|
12
|
+
puts(ok ? 'Cassettes deleted' : 'No casseettes found')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
namespace :quality do
|
18
|
+
desc 'run all quality checks'
|
19
|
+
task all: [:flog, :flay, :rubocop]
|
20
|
+
|
21
|
+
task :flog do
|
22
|
+
sh 'flog lib/'
|
23
|
+
end
|
24
|
+
|
25
|
+
task :flay do
|
26
|
+
sh 'flay lib/'
|
27
|
+
end
|
28
|
+
|
29
|
+
task :rubocop do
|
30
|
+
sh 'rubocop'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
namespace :api do
|
35
|
+
# nothing for now
|
36
|
+
end
|
data/bin/meetup_api
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w(.. lib))
|
4
|
+
require 'meetup_api'
|
5
|
+
|
6
|
+
group_id = ARGV[0] || ENV['MEETUP_GROUP_ID']
|
7
|
+
unless group_id
|
8
|
+
puts 'USAGE: meetupevents [group_id]'
|
9
|
+
exit(1)
|
10
|
+
end
|
11
|
+
|
12
|
+
group = Meetup::Group.find(urlname: group_id)
|
13
|
+
|
14
|
+
puts group
|
data/bin/meetupevents
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w(.. lib))
|
4
|
+
require 'meetup_api'
|
5
|
+
|
6
|
+
group_id = ARGV[0] || ENV['MEETUP_GROUP_ID']
|
7
|
+
unless group_id
|
8
|
+
puts 'USAGE: meetup_api [group_id]'
|
9
|
+
exit(1)
|
10
|
+
end
|
11
|
+
|
12
|
+
group = Meetup::Group.find(urlname: group_id)
|
13
|
+
|
14
|
+
puts group
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'meetup_api'
|
3
|
+
require_relative 'location'
|
4
|
+
require_relative 'group'
|
5
|
+
|
6
|
+
module Meetup
|
7
|
+
# Class to set up a Meetup Group
|
8
|
+
class City
|
9
|
+
attr_reader :name
|
10
|
+
attr_reader :location
|
11
|
+
attr_reader :country
|
12
|
+
attr_reader :events
|
13
|
+
attr_reader :groups
|
14
|
+
|
15
|
+
def initialize(name:, location:, country:)
|
16
|
+
@name = name
|
17
|
+
@location = location
|
18
|
+
@country = country
|
19
|
+
end
|
20
|
+
|
21
|
+
def groups
|
22
|
+
return @groups if @groups
|
23
|
+
located_groups = Meetup::LocatedGroups.new(country: @country,
|
24
|
+
location_raw_text: @name)
|
25
|
+
@groups = located_groups.groups
|
26
|
+
end
|
27
|
+
|
28
|
+
def events
|
29
|
+
return @events if @events
|
30
|
+
located_events = Meetup::LocatedEvents.new(location: @location)
|
31
|
+
@events = located_events.events
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.find(id:)
|
35
|
+
city_data = MeetupApi.cities_info(id)[0]
|
36
|
+
new(name: city_data['city'],
|
37
|
+
location: Meetup::Location.new(city_data['lat'],
|
38
|
+
city_data['lon']),
|
39
|
+
country: city_data['country'])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'meetup_api'
|
3
|
+
require_relative 'location'
|
4
|
+
|
5
|
+
module Meetup
|
6
|
+
# Class to set up a Meetup Event
|
7
|
+
class Event
|
8
|
+
attr_reader :name, :status, :city, :venue, :time, :location
|
9
|
+
|
10
|
+
def initialize(name:, status:, city:, venue:, time:, location:)
|
11
|
+
@name = name
|
12
|
+
@status = status
|
13
|
+
@city = city
|
14
|
+
@time = time
|
15
|
+
@venue = venue
|
16
|
+
@location = location
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Class to extract the located events from meetup
|
21
|
+
class LocatedEvents
|
22
|
+
attr_reader :events
|
23
|
+
|
24
|
+
def initialize(location:)
|
25
|
+
raw_events = MeetupApi.get_events(location.lat,
|
26
|
+
location.lon)
|
27
|
+
@events = raw_events.map do |g|
|
28
|
+
Meetup::Event.new(name: g['name'], status: g['status'],
|
29
|
+
city: g['venue'] ? g['venue']['city'] : '', # may nil
|
30
|
+
venue: g['venue'] ? g['venue']['name'] : '', # may nil
|
31
|
+
time: g['time'], location: location)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'meetup_api'
|
3
|
+
require_relative 'location'
|
4
|
+
|
5
|
+
module Meetup
|
6
|
+
# Class to set up a Meetup Group
|
7
|
+
class Group
|
8
|
+
attr_reader :name
|
9
|
+
attr_reader :urlname
|
10
|
+
attr_reader :city
|
11
|
+
attr_reader :location
|
12
|
+
|
13
|
+
def initialize(name:, urlname:, city:, location:)
|
14
|
+
@name = name
|
15
|
+
@urlname = urlname
|
16
|
+
@city = city
|
17
|
+
@location = location
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.find(urlname:)
|
21
|
+
group = MeetupApi.find_group_by_url(urlname)
|
22
|
+
new(name: group['name'],
|
23
|
+
city: group ['city'],
|
24
|
+
urlname: group['urlname'],
|
25
|
+
location: Meetup::Location.new(group['lat'],
|
26
|
+
group['lon']))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Class to extract the located groups from meetup
|
31
|
+
class LocatedGroups
|
32
|
+
attr_reader :groups
|
33
|
+
|
34
|
+
def initialize(country:, location_raw_text:)
|
35
|
+
raw_groups = MeetupApi.get_groups(country, location_raw_text)
|
36
|
+
@groups = raw_groups.map do |g|
|
37
|
+
Meetup::Group.new(
|
38
|
+
name: g['name'], urlname: g['urlname'], city: g['city'],
|
39
|
+
location: Meetup::Location.new(g['lat'], g['lon'])
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'http'
|
3
|
+
module Meetup
|
4
|
+
# Meetup api
|
5
|
+
class MeetupApi
|
6
|
+
API_URL = 'https://api.meetup.com'
|
7
|
+
API_VERSION = '2'
|
8
|
+
LOG_LOCATION = 'spec/fixtures/'
|
9
|
+
VERSIONED_API_URL = URI.join(API_URL, API_VERSION.to_s)
|
10
|
+
# Grabs the api ket from config file inside the config directory
|
11
|
+
|
12
|
+
def self.access_key
|
13
|
+
return @access_key if @access_key
|
14
|
+
if ENV['MEETUP_API_KEY'].nil?
|
15
|
+
puts 'MEETUP_API_KEY environment variable not found! Please define it.'
|
16
|
+
else
|
17
|
+
@access_key = ENV['MEETUP_API_KEY']
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.config=(credentials)
|
22
|
+
@config ? @config.update(credentials) : @config = credentials
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.config
|
26
|
+
return @config if @config
|
27
|
+
@config = { access_key: ENV['MEETUP_API_KEY'] }
|
28
|
+
end
|
29
|
+
|
30
|
+
# Gets cities based on country code (ex. tw)
|
31
|
+
def self.get_cities(country_code)
|
32
|
+
api_url = URI.join(VERSIONED_API_URL, '/cities/')
|
33
|
+
cities_response = HTTP.get(api_url,
|
34
|
+
params: { country: country_code,
|
35
|
+
signed: true,
|
36
|
+
key: access_key })
|
37
|
+
response = JSON.parse(cities_response.to_s)
|
38
|
+
# add_log(response, "cities_#{country_code}")
|
39
|
+
response['results']
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.cities_info(id)
|
43
|
+
api_url = URI.join(API_URL, "/#{API_VERSION}/", 'cities')
|
44
|
+
escaped_id = "id+=+#{id}"
|
45
|
+
cities2_response = HTTP.get(api_url,
|
46
|
+
params: { query: URI.encode(escaped_id),
|
47
|
+
signed: true,
|
48
|
+
key: access_key })
|
49
|
+
response = JSON.parse(cities2_response.to_s)
|
50
|
+
# add_log(response, "city_id_#{id}")
|
51
|
+
response['results']
|
52
|
+
end
|
53
|
+
|
54
|
+
# Gets events based on the location. Place var just for fixtures
|
55
|
+
def self.get_events(lat, lon)
|
56
|
+
api_url = URI.join(API_URL, '/find/events/')
|
57
|
+
events_response = HTTP.get(api_url,
|
58
|
+
params: { lon: lon,
|
59
|
+
lat: lat,
|
60
|
+
signed: true,
|
61
|
+
key: access_key })
|
62
|
+
response = JSON.parse(events_response.to_s)
|
63
|
+
# add_log(response, "events_at_#{place}")
|
64
|
+
response
|
65
|
+
end
|
66
|
+
|
67
|
+
# Finds groups based on a location text query
|
68
|
+
def self.get_groups(country_code, location_raw_text)
|
69
|
+
api_url = URI.join(API_URL, '/find/groups')
|
70
|
+
groups_response = HTTP.get(api_url,
|
71
|
+
params: { country: country_code,
|
72
|
+
fallback_suggestions: 'true',
|
73
|
+
location: location_raw_text,
|
74
|
+
key: access_key })
|
75
|
+
response = JSON.parse(groups_response.to_s)
|
76
|
+
# add_log(response, "groups_at_#{location_raw_text}")
|
77
|
+
response
|
78
|
+
end
|
79
|
+
|
80
|
+
# Finds groups based on a location text query
|
81
|
+
def self.find_group_by_url(urlname)
|
82
|
+
api_url = URI.join(API_URL, "/#{urlname}")
|
83
|
+
groups_response = HTTP.get(api_url,
|
84
|
+
params: { signed: true,
|
85
|
+
key: access_key })
|
86
|
+
response = JSON.parse(groups_response.to_s)
|
87
|
+
# add_log(response, "group_with_url_#{urlname}")
|
88
|
+
response
|
89
|
+
end
|
90
|
+
private_class_method
|
91
|
+
|
92
|
+
# def self.add_log(response, filename)
|
93
|
+
# filepath = "#{LOG_LOCATION}#{filename}.yml"
|
94
|
+
# File.open(filepath, 'w') { |file| file.write(response.to_yaml) }
|
95
|
+
# end
|
96
|
+
end
|
97
|
+
end
|
data/lib/meetupevents.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'meetupevents/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'meetupevents'
|
7
|
+
s.version = Meetup::VERSION
|
8
|
+
|
9
|
+
s.summary = 'Gets events and groups content from Meetup'
|
10
|
+
s.description = 'Extracts events, groups, and cities from Meetup'
|
11
|
+
s.authors = ['Isaac Martinez, Fabio Daio, Roberto Yebra']
|
12
|
+
s.email = ['imtz90b@gmail.com']
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
16
|
+
s.executables = ['meetupevents']
|
17
|
+
|
18
|
+
s.add_runtime_dependency 'http', '~> 2.0'
|
19
|
+
|
20
|
+
s.add_development_dependency 'minitest', '~> 5.9'
|
21
|
+
s.add_development_dependency 'minitest-rg', '~> 5.2'
|
22
|
+
s.add_development_dependency 'rake', '~> 11.3'
|
23
|
+
s.add_development_dependency 'vcr', '~> 3.0'
|
24
|
+
s.add_development_dependency 'webmock', '~> 2.1'
|
25
|
+
s.add_development_dependency 'simplecov', '~> 0.12'
|
26
|
+
s.add_development_dependency 'flog', '~> 4.4'
|
27
|
+
s.add_development_dependency 'flay', '~> 2.8'
|
28
|
+
s.add_development_dependency 'rubocop', '~> 0.42'
|
29
|
+
s.homepage = 'https://github.com/soa2016t6/MeetUp'
|
30
|
+
s.license = 'MIT'
|
31
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'spec_helper'
|
3
|
+
|
4
|
+
describe 'MeetUp Api tests' do
|
5
|
+
VCR.configure do |c|
|
6
|
+
c.cassette_library_dir = CASSETTES_FOLDER
|
7
|
+
c.hook_into :webmock
|
8
|
+
|
9
|
+
c.filter_sensitive_data('<API_KEY>') do
|
10
|
+
ENV['MEETUP_API_KEY']
|
11
|
+
end
|
12
|
+
c.filter_sensitive_data('<API_KEY>') do
|
13
|
+
URI.escape(ENV['MEETUP_API_KEY'])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
before do
|
18
|
+
VCR.insert_cassette CASSETTE_FILE, record: :new_episodes
|
19
|
+
cities = Meetup::MeetupApi.get_cities('tw')
|
20
|
+
c = cities[0]
|
21
|
+
@city = c
|
22
|
+
@cities = cities
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
VCR.eject_cassette
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should get cities data from api"' do
|
30
|
+
@cities.length.must_be :>, 0
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should load the events from a city' do
|
34
|
+
c_location = Meetup::Location.new(@city['lat'], @city['lon'])
|
35
|
+
city_object = Meetup::City.new(name: @city['city'],
|
36
|
+
location: c_location,
|
37
|
+
country: @city['country'])
|
38
|
+
city_object.events.length.must_be :>, 0
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should load the groups from a city' do
|
42
|
+
c_location = Meetup::Location.new(@city['lat'], @city['lon'])
|
43
|
+
city_object = Meetup::City.new(name: @city['city'],
|
44
|
+
location: c_location,
|
45
|
+
country: @city['country'])
|
46
|
+
city_object.groups.length.must_be :>, 0
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should find a single city by id' do
|
50
|
+
info = Meetup::City.find(id: '94101')
|
51
|
+
info.name.must_equal('San Francisco')
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should find a single group by id' do
|
55
|
+
info = Meetup::Group.find(urlname: 'Hiking-and-Riding-in-Taipei')
|
56
|
+
info.name.must_equal('Hiking and Riding in Taipei')
|
57
|
+
end
|
58
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'simplecov'
|
3
|
+
# Fi
|
4
|
+
|
5
|
+
SimpleCov.configure do
|
6
|
+
@filters = []
|
7
|
+
end
|
8
|
+
SimpleCov.start
|
9
|
+
require 'minitest/autorun'
|
10
|
+
require 'minitest/rg'
|
11
|
+
require 'yaml'
|
12
|
+
require 'vcr'
|
13
|
+
require 'webmock'
|
14
|
+
require 'http'
|
15
|
+
|
16
|
+
require_relative '../lib/meetupevents'
|
17
|
+
|
18
|
+
if File.file?('config/credentials.yml')
|
19
|
+
credentials = YAML.load(File.read('config/credentials.yml'))
|
20
|
+
ENV['MEETUP_API_KEY'] = credentials.first['api_key']
|
21
|
+
end
|
22
|
+
|
23
|
+
# CREDENTIALS = YAML.load(File.read('config/credentials.yml'))
|
24
|
+
CASSETTES_FOLDER = 'spec/fixtures/cassettes/'
|
25
|
+
CASSETTE_FILE = 'meetup_api_cassette'
|
26
|
+
|
27
|
+
# set MEETUP_API_KEY environment variable
|
28
|
+
# ENV['MEETUP_API_KEY'] = CREDENTIALS.first['api_key']
|
metadata
ADDED
@@ -0,0 +1,209 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: meetupevents
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Isaac Martinez, Fabio Daio, Roberto Yebra
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: http
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.9'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.9'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest-rg
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '11.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '11.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: vcr
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.1'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.1'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.12'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.12'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: flog
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '4.4'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '4.4'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: flay
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.8'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.8'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.42'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.42'
|
153
|
+
description: Extracts events, groups, and cities from Meetup
|
154
|
+
email:
|
155
|
+
- imtz90b@gmail.com
|
156
|
+
executables:
|
157
|
+
- meetupevents
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files: []
|
160
|
+
files:
|
161
|
+
- ".gitignore"
|
162
|
+
- ".rake_tasks~"
|
163
|
+
- ".rubocop.yml"
|
164
|
+
- ".travis.yml"
|
165
|
+
- Gemfile
|
166
|
+
- Gemfile.lock
|
167
|
+
- LICENSE
|
168
|
+
- README.md
|
169
|
+
- Rakefile
|
170
|
+
- bin/meetup_api
|
171
|
+
- bin/meetupevents
|
172
|
+
- config/credentials.yml.example
|
173
|
+
- lib/meetupevents.rb
|
174
|
+
- lib/meetupevents/city.rb
|
175
|
+
- lib/meetupevents/event.rb
|
176
|
+
- lib/meetupevents/group.rb
|
177
|
+
- lib/meetupevents/location.rb
|
178
|
+
- lib/meetupevents/meetup_api.rb
|
179
|
+
- lib/meetupevents/version.rb
|
180
|
+
- meetupevents.gemspec
|
181
|
+
- spec/meetupevents_spec.rb
|
182
|
+
- spec/spec_helper.rb
|
183
|
+
homepage: https://github.com/soa2016t6/MeetUp
|
184
|
+
licenses:
|
185
|
+
- MIT
|
186
|
+
metadata: {}
|
187
|
+
post_install_message:
|
188
|
+
rdoc_options: []
|
189
|
+
require_paths:
|
190
|
+
- lib
|
191
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - ">="
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '0'
|
196
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
requirements: []
|
202
|
+
rubyforge_project:
|
203
|
+
rubygems_version: 2.6.8
|
204
|
+
signing_key:
|
205
|
+
specification_version: 4
|
206
|
+
summary: Gets events and groups content from Meetup
|
207
|
+
test_files:
|
208
|
+
- spec/meetupevents_spec.rb
|
209
|
+
- spec/spec_helper.rb
|