Created
January 7, 2018 21:26
-
-
Save leenyburger/f2d499babc3156fbe6798d929b77b3be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Meetup | |
| include HTTParty | |
| base_uri 'api.meetup.com' | |
| attr_reader :options | |
| def initialize | |
| api_key = YOUR_API_KEY | |
| @options = { | |
| query: { | |
| key: api_key, | |
| sign: "true", | |
| desc: "true", | |
| page: 20 | |
| } | |
| } | |
| end | |
| def get_data | |
| self.class.get('/operation-code-hampton-roads/events', @options) | |
| end | |
| def events | |
| if get_data.code.to_i == 200 | |
| get_data.parsed_response | |
| else | |
| raise "Error fetching data from Meetup API" | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment