api_consumer_json 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/api_consumer.rb +3 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9ccd807bb4dc859a1f418fe4746a5099d11f2de
4
- data.tar.gz: c3f91d7e030c201cbe1c588939318f4fdd7b5272
3
+ metadata.gz: 414746936effb63a01959d48a1a4be735bf6889c
4
+ data.tar.gz: 7769ef59d9c4ee3d08d143a1bd7f07d8110a7f06
5
5
  SHA512:
6
- metadata.gz: 432a2664f7f09ed45f0d6918d25a1f8e60cf79b9a5778e4bae0e5b5d689571f8f155324814bf5511820a5c5b5feb3e4b1c1642aa1de4a6b4b1dc477101e578e2
7
- data.tar.gz: 218b66f80fdac7a4313b94ad8dc363651753b3769528ee714177d391b0a46a4de27d8b037c1b13dd375881844deae55e0167c0c4a8ac54b57ef9619f91846afb
6
+ metadata.gz: 0bb08094ba875878a7521c68d6c8ff4e806af6b02192e6145ffd12563c77ad7c45177e0e9444f4fe84cf2ba88831c31febbef071923435287fe98857bb8213e1
7
+ data.tar.gz: 2d958ef432a2ec904de296c8d597e9b78a93368211c744aae6aae9fbfb0a7c66adc36027b88afb9e26a6073ab493855928e74c257a0099f9b74be838908abafd
@@ -5,12 +5,14 @@ class APIConsumer
5
5
  require 'json'
6
6
  require 'uber_cache'
7
7
  require 'logger'
8
+ require 'erb'
8
9
 
9
10
  class << self
10
11
  @settings = {}
11
12
  def inherited(subclass)
12
13
  if File.exist?("config/#{snake_case(subclass)}.yml")
13
- configs = YAML.load_file("config/#{snake_case(subclass)}.yml")
14
+ yml_template = ERB.new File.new("config/#{snake_case(subclass)}.yml").read
15
+ configs = YAML.load yml_template.result(binding)
14
16
  configs[snake_case(subclass)].each{ |k,v| subclass.set(k.to_sym, v) }
15
17
  subclass.set_logger(Logger.new(subclass.settings[:log_file] || "./log/#{snake_case(subclass)}_api.log"), subclass.settings[:log_level])
16
18
  super
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_consumer_json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Reister