Module: Rubeetup::MeetupCatalog

Extended by:
Utilities
Defined in:
lib/rubeetup/requests_lib/meetup_catalog.rb

Overview

Note:

it respects the interface demanded by Rubeetup::RequestCatalog, and as such, it provides a module method .requests, and for each entry in the catalog there exists a Hash which can respond to [:options] and [:path]

Concrete implementation of a catalog

Class Method Summary collapse

Methods included from Utilities

blank?, collection_symbolyzer, present?, stringify

Class Method Details

.requestsHash{Symbol=>Hash{Symbol=>Lambda, Symbol=>Array<Symbol>}}

Note:

Rubeetup automatically passes authentication options with each request, and no request can even be initiated without it. Even though the required options for these requests omit this auth data, it is implied that it is indeed required for all the following requests to have it.

Returns a Hash including all the supported requests. Each entry in the hash corresponds to a request, and it specifies both its path, and its required options.

Returns:

  • (Hash{Symbol=>Hash{Symbol=>Lambda, Symbol=>Array<Symbol>}})


21
22
23
24
25
26
27
28
29
30
# File 'lib/rubeetup/requests_lib/meetup_catalog.rb', line 21

def requests
  # @note I've averaged times for both YAML and JSON, and JSON:
  #    For 200 runs:  YAML => 0.00315      JSON => 0.00027
  #    Well that just about does it...
  #YAML.load(File.read("#{catalog_dir}meetup_catalog.yaml"))
  path = File.expand_path('meetup_catalog.json', File.dirname(__FILE__))
  hash = JSON.parse(File.read(path), symbolize_names: true)
  # Now transform all the required options into symbols
  hash.each {|_, val| val[:options] = collection_symbolyzer(val[:options]) }
end