lib/pilha/stack_overflow/base.rb in pilha-0.1.6 vs lib/pilha/stack_overflow/base.rb in pilha-0.1.7

- old
+ new

@@ -1,10 +1,14 @@ module StackExchange module StackOverflow class Base class << self + def client + @client ||= StackExchange::StackOverflow::Client.config + end + def parse_with_class(hash, key, klass) case hash[key] when Hash hash[key] = klass.new(hash[key]) when Array @@ -14,14 +18,13 @@ def request(path_pattern, id, options) options.merge! :id => id if id parse client.request(path_pattern, options) end + end - def client - StackExchange::StackOverflow::Client.config unless @client - @client - end + def initialize(hash) + @struct = OpenStruct.new hash end end end end