Sha256: 6fc7d23dc431cc57794efaea755b009354f29bfae3baebbc7e7ec6689e4726de
Contents?: true
Size: 742 Bytes
Versions: 2
Compression:
Stored size: 742 Bytes
Contents
module Devrant class Api HTTP_OPTIONS = { query: { app: 3 # This is a temporary validation param that will likely be removed soon }, base_uri: 'https://www.devrant.io/api' } def initialize subclasses = { rants: Devrant::Rants, users: Devrant::Users } initialize_subclasses(subclasses) end private def initialize_subclasses(classes) classes.each do |variable, classname| self.instance_variable_set("@#{variable}", classname.new) self.instance_variable_get("@#{variable}").class.default_options = HTTP_OPTIONS self.singleton_class.class_eval do attr_reader variable.to_sym end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
devrant-0.9.0 | lib/devrant/api.rb |
devrant-0.0.3 | lib/devrant/api.rb |