Class: Eco::API::Common::Loaders::UseCase
- Defined in:
- lib/eco/api/common/loaders/use_case.rb
Direct Known Subclasses
Eco::API::Custom::UseCase, UseCases::DefaultCases::AbstractPolicyGroupAbilities, UseCases::DefaultCases::AnalysePeople, UseCases::DefaultCases::AppendUsergroupsCase, UseCases::DefaultCases::ChangeEMailCase, UseCases::DefaultCases::CleanUnknownTags, UseCases::DefaultCases::CodesToTagsCase, UseCases::DefaultCases::CreateCase, UseCases::DefaultCases::CreateDetailsCase, UseCases::DefaultCases::CreateDetailsWithSupervisorCase, UseCases::DefaultCases::DeleteTransCase, UseCases::DefaultCases::EmailAsIdCase, UseCases::DefaultCases::EntriesToCsv, UseCases::DefaultCases::HrisCase, UseCases::DefaultCases::NewEmailCase, UseCases::DefaultCases::NewIdCase, UseCases::DefaultCases::OrgDataConvertCase, UseCases::DefaultCases::RefreshCase, UseCases::DefaultCases::ReinviteTransCase, UseCases::DefaultCases::RemoveAccountTransCase, UseCases::DefaultCases::ResetLandingPageCase, UseCases::DefaultCases::RestoreDBCase, UseCases::DefaultCases::Samples::Sftp, UseCases::DefaultCases::SetDefaultTagCase, UseCases::DefaultCases::SetSupervisorCase, UseCases::DefaultCases::SupersCyclicIdentify, UseCases::DefaultCases::SupersHierarchy, UseCases::DefaultCases::SwitchSupervisorCase, UseCases::DefaultCases::TagPaths, UseCases::DefaultCases::ToCsvCase, UseCases::DefaultCases::TransferAccountCase, UseCases::DefaultCases::UpdateCase, UseCases::DefaultCases::UpdateDetailsCase, UseCases::DefaultCases::UpsertCase, UseCases::OozeSamples::OozeBaseCase, UseCases::OozeSamples::RegisterExportCase
Class Method Summary collapse
-
.type(value = nil) ⇒ Symbol
The
type
of usecase (i.e.:sync
,:transform
,:import
,:other
).
Instance Method Summary collapse
-
#initialize(usecases) ⇒ UseCase
constructor
A new instance of UseCase.
-
#main(entries, people, session, options, usecase) ⇒ Object
The parameters of this method will depend on the
type
of usecase. - #type ⇒ Object
Methods inherited from CaseBase
Methods inherited from Base
<=>, created_at, #name, set_created_at!
Methods included from ClassHelpers
#class_resolver, #descendants, #descendants?, #inheritable_attrs, #inheritable_class_vars, #inherited, #instance_variable_name, #new_class, #resolve_class, #to_constant
Constructor Details
#initialize(usecases) ⇒ UseCase
Returns a new instance of UseCase.
19 20 21 22 |
# File 'lib/eco/api/common/loaders/use_case.rb', line 19 def initialize(usecases) raise "Expected Eco::API::UseCases. Given #{usecases.class}" unless usecases.is_a?(Eco::API::UseCases) usecases.define(self.name, type: self.type, &self.method(:main)) end |
Class Method Details
.type(value = nil) ⇒ Symbol
Returns the type
of usecase (i.e. :sync
, :transform
, :import
, :other
).
9 10 11 12 13 14 |
# File 'lib/eco/api/common/loaders/use_case.rb', line 9 def type(value = nil) unless value return @type || raise("You should specify a type of case [:sync, :transform, :import, :other] for #{self}") end @type = value end |
Instance Method Details
#main(entries, people, session, options, usecase) ⇒ Object
The parameters of this method will depend on the type
of usecase.
30 31 32 |
# File 'lib/eco/api/common/loaders/use_case.rb', line 30 def main(entries, people, session, , usecase) raise "You should implement this method" end |
#type ⇒ Object
34 35 36 |
# File 'lib/eco/api/common/loaders/use_case.rb', line 34 def type self.class.type end |