-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.rb
More file actions
30 lines (24 loc) · 954 Bytes
/
app.rb
File metadata and controls
30 lines (24 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true
require 'sinatra'
require 'econfig'
require 'meetupevents'
require_relative './config/environment.rb'
# Main class
class EventsLocatorAPI < Sinatra::Base
extend Econfig::Shortcut
Econfig.env = settings.environment.to_s
Econfig.root = settings.root
# this is not working! will get 'invalid api key' error in the WebAPI routes responses...
# the code bellow somehow doesn't define MEETUP_API_KEY environment variable for our meetupevents gem to use
Meetup::MeetupApi
.config
.update(access_key: EventsLocatorAPI.config.MEETUP_API_KEY)
# this is the fix for problem stated above
# manually define MEETUP_API_KEY environment variable from credentials stored at config/app.yml
ENV['MEETUP_API_KEY'] = EventsLocatorAPI.config.MEETUP_API_KEY
API_VER = 'api/v0.1'
# root route to test if Web API is up
get '/?' do
"EventsLocatorAPI latest version endpoints are at: /#{API_VER}/!"
end
end