Class: RMeetup::Client
- Inherits:
-
Object
- Object
- RMeetup::Client
- Defined in:
- lib/rmeetup.rb
Overview
RMeetup::Client
Essentially a simple wrapper to delegate requests to different fetcher classes who are responsible for fetching and parsing their own responses.
Constant Summary collapse
- FETCH_TYPES =
[:topics, :cities, :members, :rsvps, :events, :groups, :comments, :photos]
- POST_TYPES =
[:event_comment]
- @@api_key =
Meetup API Key Get one at www.meetup.com/meetup_api/key/ Needs to be the group organizers API Key to be able to RSVP for other people
nil
Class Method Summary collapse
- .api_key ⇒ Object
- .api_key=(key) ⇒ Object
- .fetch(type, options = {}) ⇒ Object
- .post(type, options = {}) ⇒ Object
Class Method Details
.api_key ⇒ Object
39 |
# File 'lib/rmeetup.rb', line 39 def self.api_key; @@api_key; end |
.api_key=(key) ⇒ Object
40 |
# File 'lib/rmeetup.rb', line 40 def self.api_key=(key); @@api_key = key; end |
.fetch(type, options = {}) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rmeetup.rb', line 42 def self.fetch(type, = {}) check_configuration! # Merge in all the standard options # Keeping whatever was passed in = .merge() if FETCH_TYPES.include?(type.to_sym) # Get the custom fetcher used to manage options, api call to get a type of response fetcher = RMeetup::Fetcher.for(type) return fetcher.fetch() else raise InvalidRequestTypeError.new(type) end end |
.post(type, options = {}) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/rmeetup.rb', line 58 def self.post(type, = {}) check_configuration! = .merge() if POST_TYPES.include?(type.to_sym) poster = RMeetup::Poster.for(type) return poster.post() else raise InvalidRequestTypeError.new(type) end end |