Class: SolidusContent::Providers::JSON

Inherits:
Object
  • Object
show all
Defined in:
lib/solidus_content/providers/json.rb

Class Method Summary collapse

Class Method Details

.call(input) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/solidus_content/providers/json.rb', line 9

def call(input)
  dir = Rails.root.join(input.dig(:type_options, :path))
  file = dir.join(input[:slug] + '.json')
  data = ::JSON.parse(file.read, symbolize_names: true)

  input.merge(data: data)
end

.entry_fieldsObject



21
22
23
# File 'lib/solidus_content/providers/json.rb', line 21

def entry_fields
  []
end

.entry_type_fieldsObject



17
18
19
# File 'lib/solidus_content/providers/json.rb', line 17

def entry_type_fields
  %i[path]
end