Class: ShopifyGraphql::CreateUsageSubscription
- Inherits:
-
Object
- Object
- ShopifyGraphql::CreateUsageSubscription
- Includes:
- Mutation
- Defined in:
- app/graphql/shopify_graphql/create_usage_subscription.rb
Constant Summary collapse
- MUTATION =
<<~GRAPHQL #{AppSubscriptionFields::FRAGMENT} mutation appSubscriptionCreate( $name: String!, $returnUrl: URL!, $test: Boolean $lineItems: [AppSubscriptionLineItemInput!]!, ) { appSubscriptionCreate( name: $name, returnUrl: $returnUrl, test: $test lineItems: $lineItems, ) { appSubscription { ... AppSubscriptionFields } confirmationUrl userErrors { field message } } } GRAPHQL
Instance Method Summary collapse
Methods included from Mutation
Instance Method Details
#call(name:, return_url:, terms:, capped_amount:, test: false) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/graphql/shopify_graphql/create_usage_subscription.rb', line 32 def call(name:, return_url:, terms:, capped_amount:, test: false) response = execute( MUTATION, name: name, returnUrl: return_url, test: test, lineItems: [{ plan: { appUsagePricingDetails: { terms: terms, cappedAmount: {amount: capped_amount, currencyCode: "USD"} } } }] ) response.data = response.data.appSubscriptionCreate handle_user_errors(response.data) response.data = parse_data(response.data) response end |