Sha256: da74447dedde5bb5add24a090568c034842016a46f650f7c10b5fe81a1b9d324
Contents?: true
Size: 1.68 KB
Versions: 7
Compression:
Stored size: 1.68 KB
Contents
module BunnyApp class Subscription @subscription_create_mutation = <<-'GRAPHQL' mutation subscriptionCreate ($attributes: SubscriptionAttributes!) { subscriptionCreate (attributes: $attributes) { subscription { id account { id name contacts { id firstName lastName } } trialStartDate trialEndDate startDate endDate state plan { code name } priceList { code name } tenant { id code name } } errors } } GRAPHQL # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity def self.create(price_list_code:, options: {}) variables = { attributes: { priceListCode: price_list_code, trial: options[:trial] || false } } if options[:account_id] variables[:attributes][:accountId] = options[:account_id] else variables[:attributes][:account] = { name: options[:account_name]&.to_s, billingContact: { firstName: options[:first_name]&.to_s, lastName: options[:last_name]&.to_s, email: options[:email]&.to_s } } end if options[:tenant_code] variables[:attributes][:tenant] = { code: options[:tenant_code]&.to_s, name: options[:tenant_name]&.to_s } end Client.new.query(@subscription_create_mutation, variables) end end end
Version data entries
7 entries across 7 versions & 1 rubygems