Class: ShopifyGraphql::DeletePrivateMetafield

Inherits:
Object
  • Object
show all
Includes:
Mutation
Defined in:
app/graphql/shopify_graphql/delete_private_metafield.rb

Constant Summary collapse

MUTATION =
<<~GRAPHQL
  mutation privateMetafieldDelete($input: PrivateMetafieldDeleteInput!) {
    privateMetafieldDelete(input: $input) {
      deletedPrivateMetafieldId
      userErrors {
        field
        message
      }
    }
  }
GRAPHQL

Instance Method Summary collapse

Methods included from Mutation

#client

Instance Method Details

#call(namespace:, key:, owner: nil) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'app/graphql/shopify_graphql/delete_private_metafield.rb', line 17

def call(namespace:, key:, owner: nil)
  input = {namespace: namespace, key: key}
  input[:owner] = owner if owner

  response = execute(MUTATION, input: input)
  handle_user_errors(response.data.privateMetafieldDelete)
  response.data = parse_data(response.data)
  response
end