Class: SolidusContent::Providers::Prismic

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

Class Method Summary collapse

Class Method Details

.call(input) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/solidus_content/providers/prismic.rb', line 7

def call(input)
  require 'prismic' unless defined?(::Prismic)

  type_options = input.dig(:type_options)

  client = ::Prismic.api(
    type_options[:api_entry_point],
    type_options.dig(:api_token)
  )

  entry = client.getByID(input.dig(:options, :id))

  input.merge(
    data: entry.fields,
    provider_client: client,
    provider_entry: entry,
  )
end

.entry_fieldsObject



30
31
32
# File 'lib/solidus_content/providers/prismic.rb', line 30

def entry_fields
  %i[id]
end

.entry_type_fieldsObject



26
27
28
# File 'lib/solidus_content/providers/prismic.rb', line 26

def entry_type_fields
  %i[api_entry_point api_token]
end