lib/syncano/api.rb in syncano-4.0.0.alpha1 vs lib/syncano/api.rb in syncano-4.0.0.alpha2

- old
+ new

@@ -1,13 +1,31 @@ module Syncano class API + def initialize(connection) self.connection = connection - schema = ::Syncano::Schema.new(connection) - schema.process! + + self.class.initialize(connection) unless self.class.initialized? end + class << self + def initialize(connection) + endpoints = Schema::EndpointsWhitelist.new(Schema.new(connection)) + + resources_definitions = Resources.build_definitions(endpoints) + + include Syncano::API::Endpoints.definition(resources_definitions) + + self.initialized = true + end + + def initialized? + initialized + end + end + private attr_accessor :connection + cattr_accessor :initialized end end