Class: EPlat::Shopify::GraphQL::V202501::Input::Product

Inherits:
EPlat::Shopify::GraphQL::V202501::Input
  • Object
show all
Defined in:
lib/e_plat/resource/platform_specific/shopify/graph_q_l/v_2025_01/input/product.rb

Constant Summary collapse

SUPPORTED_FIELDS =
%w[
  category
  claimOwnership
  title
  descriptionHtml
  productType
  vendor
  tags
  collectionsToJoin
  collectionsToLeave
  combinedListingRole
  metafields
  productOptions
  templateSuffix
  requiresSellingPlan
  giftCard
  giftCardTemplateSuffix
  seo
  status
  id
  handle
  redirectNewHandle
].freeze

Class Method Summary collapse

Class Method Details

.mutation_input(resource, action) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/e_plat/resource/platform_specific/shopify/graph_q_l/v_2025_01/input/product.rb', line 27

def self.mutation_input(resource, action)
  case action.to_sym
  when :delete
    new(input: {id: resource.formatted_id})
  else
    rootless_json = resource.class.remove_root_from(resource.as_json)
    new(resource.class.mapping.via_native_attributes_where_possible rootless_json)
  end.query_input
end