Class: ShopifyGraphql::CreateUsageSubscription
- Inherits:
-
Object
- Object
- ShopifyGraphql::CreateUsageSubscription
- Includes:
- Mutation
- Defined in:
- app/graphql/shopify_graphql/create_usage_subscription.rb
Constant Summary collapse
- MUTATION =
"\#{AppSubscriptionFields::FRAGMENT}\n\nmutation appSubscriptionCreate(\n $name: String!,\n $returnUrl: URL!,\n $test: Boolean\n $lineItems: [AppSubscriptionLineItemInput!]!,\n) {\n appSubscriptionCreate(\n name: $name,\n returnUrl: $returnUrl,\n test: $test\n lineItems: $lineItems,\n ) {\n appSubscription {\n ... AppSubscriptionFields\n }\n confirmationUrl\n userErrors {\n field\n message\n }\n }\n}\n"
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 |