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