module Ecoportal module API # @attr_reader client [Common::Client] a `Common::Client` object that holds the configuration of the api connection. # @attr_reader logger [Logger] the logger. class V1 extend Common::BaseClass include Common::Logging VERSION = "v1".freeze class_resolver :people_class, "Ecoportal::API::V1::People" class_resolver :person_schemas_class, "Ecoportal::API::V1::PersonSchemas" attr_reader :client, :logger # Creates an `V1` object to scope version specific api requests. # @note # - The const `VERSION` determineds the api version that client will query against. # - This means that each sublcass of `V1` should define their own `VERSION` constant. # @param api_key [String] the key version to stablish the api connection. # @param host [String] api server domain. # @param logger [Logger] an object with `Logger` interface to generate logs. # @return [V1] an object with the api version suit. def initialize(api_key, host: "live.ecoportal.com", logger: default_logger) @logger = logger @client = Common::Client.new( api_key: api_key, host: host, version: self.class::VERSION, logger: @logger ) end # Obtain specific object for people api requests. # @return [People] an instance object ready to make people api requests. def people people_class.new(client) end # Obtain specific object for schema api requests. # @return [PersonSchemas] an instance object ready to make schema api requests. def person_schemas person_schemas_class.new(client) end end end end require 'ecoportal/api/v1/person_schemas' require 'ecoportal/api/v1/people'