Sha256: 799e2c76ecc7b0822307da76faea145d2aa7132b7d108c1730f1cd004ed5617e

Contents?: true

Size: 1.57 KB

Versions: 45

Compression:

Stored size: 1.57 KB

Contents

module Eco
  module API
    # faker object
    @@faker = nil
    class EcoFaker
      @@api = nil
      @org = nil
      # attr_accessor
      attr_reader :org
      def initialize(init = {})
        set_settings(init)
      end
      # allows to change certain configuration settings on an existing Faker instance object
      def set_settings (init = {})
        @today = (aux = init['today'])? aux : Time.now
        api = init.fetch('api', nil)
        @@api = api.instance_of?(Ecoportal::API::Internal) && api
        # this will initialize org basics (i.e. people_schemas, policy_groups, login_providers)
        @org = Organization.new(init)
      end
      def newPerson ()

      end
      def modifyPerson(person)

      end
      private
    end

    def self.new(init = {})
      @@faker = EcoFaker.new(init)
    end

    class FakePerson < Ecoportal::API::Internal::Person
      @@faker
      def initialize(faker, *args)
        raise "You must initialize the faker first" unless faker && faker.instance_of(Faker)
        @@faker = faker
        super(*args)
        @@faker.set_details
      end
    end

    class FakeField
      @@types = ["boolean", "number", "text", "select", "date", "phone_number"]
      @@multiple = false
      attr_accessor :type, :multiple
      #attr_reader
      def initialize (init = {})
        init_values_generator(init)
      end
      private
      def init_values_faker (init = {})
        include
        @fake_values = API::Data::Random::ValuesGenerator.new(init)
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
eco-helpers-1.1.5 lib/eco/api/eco_faker.rb
eco-helpers-1.1.4 lib/eco/api/eco_faker.rb
eco-helpers-1.1.3 lib/eco/api/eco_faker.rb
eco-helpers-1.1.2 lib/eco/api/eco_faker.rb
eco-helpers-1.1.1 lib/eco/api/eco_faker.rb
eco-helpers-1.0.14 lib/eco/api/eco_faker.rb
eco-helpers-1.0.13 lib/eco/api/eco_faker.rb
eco-helpers-1.0.12 lib/eco/api/eco_faker.rb
eco-helpers-1.0.11 lib/eco/api/eco_faker.rb
eco-helpers-1.0.10 lib/eco/api/eco_faker.rb
eco-helpers-1.0.9 lib/eco/api/eco_faker.rb
eco-helpers-1.0.8 lib/eco/api/eco_faker.rb
eco-helpers-1.0.7 lib/eco/api/eco_faker.rb
eco-helpers-1.0.6 lib/eco/api/eco_faker.rb
eco-helpers-1.0.5 lib/eco/api/eco_faker.rb
eco-helpers-1.0.4 lib/eco/api/eco_faker.rb
eco-helpers-1.0.3 lib/eco/api/eco_faker.rb
eco-helpers-0.9.5 lib/eco/api/eco_faker.rb
eco-helpers-1.0.2 lib/eco/api/eco_faker.rb
eco-helpers-0.9.4 lib/eco/api/eco_faker.rb