Class: NeetoCommonsBackend::SampleData::Common::Base

Inherits:
Object
  • Object
show all
Defined in:
app/services/neeto_commons_backend/sample_data/common/base.rb

Instance Method Summary collapse

Instance Method Details

#adminObject



13
14
15
# File 'app/services/neeto_commons_backend/sample_data/common/base.rb', line 13

def admin
  organization.users.find_by(email: "[email protected]")
end

#app_secretsObject



37
38
39
# File 'app/services/neeto_commons_backend/sample_data/common/base.rb', line 37

def app_secrets
  @_app_secrets ||= Rails.application.secrets
end

#descriptionObject



29
30
31
# File 'app/services/neeto_commons_backend/sample_data/common/base.rb', line 29

def description
  self.class.name
end

#heroku_or_development_env?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'app/services/neeto_commons_backend/sample_data/common/base.rb', line 33

def heroku_or_development_env?
  Rails.env.heroku? || Rails.env.development?
end

#load!Object



41
42
43
44
45
# File 'app/services/neeto_commons_backend/sample_data/common/base.rb', line 41

def load!
  print_description
  process!
  print_success
end

#organizationObject



9
10
11
# File 'app/services/neeto_commons_backend/sample_data/common/base.rb', line 9

def organization
  @_organization ||= Organization.find_by(subdomain: "spinkart")
end


21
22
23
# File 'app/services/neeto_commons_backend/sample_data/common/base.rb', line 21

def print_description
  Rails.logger.debug format("%-80s", description)
end


25
26
27
# File 'app/services/neeto_commons_backend/sample_data/common/base.rb', line 25

def print_success
  Rails.logger.debug "[DONE]\n"
end

#skip?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/services/neeto_commons_backend/sample_data/common/base.rb', line 17

def skip?
  !heroku_or_development_env?
end