Class: ContentfulMigrations::MigrationContentType

Inherits:
Object
  • Object
show all
Defined in:
lib/contentful_migrations/migration_content_type.rb

Constant Summary collapse

DEFAULT_MIGRATION_CONTENT_TYPE =
'migrations'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:, space:, logger:, migration_content_type_name: DEFAULT_MIGRATION_CONTENT_TYPE) ⇒ MigrationContentType

Returns a new instance of MigrationContentType.



8
9
10
11
12
13
14
15
16
# File 'lib/contentful_migrations/migration_content_type.rb', line 8

def initialize(client:,
               space:,
               logger:,
               migration_content_type_name: DEFAULT_MIGRATION_CONTENT_TYPE)
  @client = client
  @space = space
  @logger = logger
  @migration_content_type_name = migration_content_type_name
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



5
6
7
# File 'lib/contentful_migrations/migration_content_type.rb', line 5

def access_token
  @access_token
end

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/contentful_migrations/migration_content_type.rb', line 5

def client
  @client
end

#loggerObject (readonly)

Returns the value of attribute logger.



5
6
7
# File 'lib/contentful_migrations/migration_content_type.rb', line 5

def logger
  @logger
end

#migration_content_type_nameObject (readonly)

Returns the value of attribute migration_content_type_name.



5
6
7
# File 'lib/contentful_migrations/migration_content_type.rb', line 5

def migration_content_type_name
  @migration_content_type_name
end

#spaceObject (readonly)

Returns the value of attribute space.



5
6
7
# File 'lib/contentful_migrations/migration_content_type.rb', line 5

def space
  @space
end

#space_idObject (readonly)

Returns the value of attribute space_id.



5
6
7
# File 'lib/contentful_migrations/migration_content_type.rb', line 5

def space_id
  @space_id
end

Instance Method Details

#resolveObject



18
19
20
# File 'lib/contentful_migrations/migration_content_type.rb', line 18

def resolve
  @migration_content_type ||= find_or_create_migration_content_type
end