Class: Eco::API::Common::Loaders::UseCase
- Inherits:
-
BaseLoader
- Object
- BaseLoader
- Eco::API::Common::Loaders::UseCase
- Defined in:
- lib/eco/api/common/loaders/use_case.rb
Direct Known Subclasses
Eco::API::Custom::UseCase, UseCases::DefaultCases::AppendUsergroupsCase, UseCases::DefaultCases::ChangeEMailCase, UseCases::DefaultCases::CodesToTagsCase, UseCases::DefaultCases::CreateCase, UseCases::DefaultCases::CreateDetailsCase, UseCases::DefaultCases::CreateDetailsWithSupervisorCase, UseCases::DefaultCases::DeleteTransCase, UseCases::DefaultCases::EmailAsIdCase, UseCases::DefaultCases::HrisCase, UseCases::DefaultCases::NewEmailCase, UseCases::DefaultCases::NewIdCase, UseCases::DefaultCases::OrgDataConvertCase, UseCases::DefaultCases::RefreshAbilitiesCase, UseCases::DefaultCases::RefreshCase, UseCases::DefaultCases::ReinviteTransCase, UseCases::DefaultCases::RemoveAccountTransCase, UseCases::DefaultCases::ResetLandingPageCase, UseCases::DefaultCases::RestoreDBCase, UseCases::DefaultCases::SetDefaultTagCase, UseCases::DefaultCases::SetSupervisorCase, UseCases::DefaultCases::SwitchSupervisorCase, UseCases::DefaultCases::ToCsvCase, UseCases::DefaultCases::ToCsvDetailedCase, UseCases::DefaultCases::TransferAccountCase, UseCases::DefaultCases::UpdateCase, UseCases::DefaultCases::UpdateDetailsCase, UseCases::DefaultCases::UpsertCase
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 BaseLoader
<=>, created_at, #name, name_only_once!, set_created_at!
Methods included from ClassHelpers
#class_resolver, #descendants, #descendants?, #new_class, #resolve_class, #to_constant
Constructor Details
#initialize(usecases) ⇒ UseCase
Returns a new instance of UseCase.
17 18 19 20 |
# File 'lib/eco/api/common/loaders/use_case.rb', line 17 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.class}") 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.
28 29 30 |
# File 'lib/eco/api/common/loaders/use_case.rb', line 28 def main(entries, people, session, , usecase) raise "You should implement this method" end |
#type ⇒ Object
32 33 34 |
# File 'lib/eco/api/common/loaders/use_case.rb', line 32 def type self.class.type end |