Class: Contentful::Exporter::Drupal::ContentType

Inherits:
Object
  • Object
show all
Defined in:
lib/drupal/content_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exporter, config, type, schema) ⇒ ContentType



8
9
10
11
12
13
# File 'lib/drupal/content_type.rb', line 8

def initialize(exporter, config, type, schema)
  @exporter = exporter
  @config = config
  @type = type
  @schema = schema
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/drupal/content_type.rb', line 6

def config
  @config
end

#exporterObject (readonly)

Returns the value of attribute exporter.



6
7
8
# File 'lib/drupal/content_type.rb', line 6

def exporter
  @exporter
end

#schemaObject (readonly)

Returns the value of attribute schema.



6
7
8
# File 'lib/drupal/content_type.rb', line 6

def schema
  @schema
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/drupal/content_type.rb', line 6

def type
  @type
end

Instance Method Details

#save_content_types_as_jsonObject



15
16
17
18
19
20
# File 'lib/drupal/content_type.rb', line 15

def save_content_types_as_json
  exporter.create_directory("#{config.entries_dir}/#{type}")
  config.db[:node].where(type: type).each do |content_row|
    extract_data(content_row)
  end
end