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.
- checksums.yaml +4 -4
- data/lib/api_consumer.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 414746936effb63a01959d48a1a4be735bf6889c
|
4
|
+
data.tar.gz: 7769ef59d9c4ee3d08d143a1bd7f07d8110a7f06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bb08094ba875878a7521c68d6c8ff4e806af6b02192e6145ffd12563c77ad7c45177e0e9444f4fe84cf2ba88831c31febbef071923435287fe98857bb8213e1
|
7
|
+
data.tar.gz: 2d958ef432a2ec904de296c8d597e9b78a93368211c744aae6aae9fbfb0a7c66adc36027b88afb9e26a6073ab493855928e74c257a0099f9b74be838908abafd
|
data/lib/api_consumer.rb
CHANGED
@@ -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
|
-
|
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
|