Sha256: f74803dceb4f7b5ae61232962fe515021d1052e0d3abf9beae231f332bcbea29
Contents?: true
Size: 1.63 KB
Versions: 5
Compression:
Stored size: 1.63 KB
Contents
$LOAD_PATH << File.expand_path('..', __FILE__) require 'support/presence' require 'support/symbolize_keys' module Hungry class << self attr_accessor :api_url, :credentials, :json_parser, :logger end def self.credentials=(new_credentials = {}) @credentials = new_credentials.symbolize_keys Resource.basic_auth credentials[:username], credentials[:password] Collection.basic_auth credentials[:username], credentials[:password] end ### LIBRARY: # Utility: autoload :Collection, 'hungry/collection' autoload :Resource, 'hungry/resource' autoload :Util, 'hungry/util' # Helpers: autoload :Geolocation, 'hungry/geolocation' autoload :Location, 'hungry/location' # Models: autoload :City, 'hungry/city' autoload :Country, 'hungry/country' autoload :Menu, 'hungry/menu' autoload :Region, 'hungry/region' autoload :Review, 'hungry/review' autoload :Response, 'hungry/response' autoload :Site, 'hungry/site' autoload :Tag, 'hungry/tag' autoload :User, 'hungry/user' autoload :Venue, 'hungry/venue' ### EXCEPTIONS: # Exception raised when a geolocation is required, but it is not given: class GeolocationNotGiven < StandardError; end # Exception raised when an endpoint is not specified for a resource: class EndpointNotSpecified < StandardError; end ### CONFIGURATION: self.credentials = { username: nil, password: nil } self.api_url = 'https://api.eet.nu/' self.json_parser = lambda do |json| require 'json' JSON.parse(json) end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
hungry-0.2.0 | lib/hungry.rb |
hungry-0.1.5 | lib/hungry.rb |
hungry-0.1.4 | lib/hungry.rb |
hungry-0.1.3 | lib/hungry.rb |
hungry-0.1.2 | lib/hungry.rb |