Sha256: ec56e3f9df45641540e3db27b977f67fe1f28cb93e2af22ec3bdc86d6c7027a4

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

# :nocov:
module Sail
  # Graphql
  #
  # Module to include type definitions
  # for GraphQL APIs.
  module Graphql
    autoload :Mutations, "sail/mutations"

    module Types # :nodoc:
      extend ActiveSupport::Concern

      included do
        field :sail_get, ::GraphQL::Types::JSON, null: true do
          description "Returns the value for a given setting."
          argument :name, String, required: true, description: "The setting's name."
        end

        field :sail_switcher, ::GraphQL::Types::JSON, null: true do
          description "Switches between the positive or negative setting based on the throttle."
          argument :positive, String, required: true, description: "The setting's name if the throttle is bigger than the desired amount."
          argument :negative, String, required: true, description: "The setting's name if the throttle is smaller than the desired amount."
          argument :throttled_by, String, required: true, description: "The throttle setting's name."
        end

        def sail_get(name:)
          Sail.get(name)
        end

        def sail_switcher(positive:, negative:, throttled_by:)
          Sail.switcher(
            positive: positive,
            negative: negative,
            throttled_by: throttled_by
          )
        end
      end
    end
  end
end
# :nocov:

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sail-3.6.1 lib/sail/graphql.rb
sail-3.6.0 lib/sail/graphql.rb
sail-3.5.1 lib/sail/graphql.rb
sail-3.5.0 lib/sail/graphql.rb
sail-3.4.0 lib/sail/graphql.rb
sail-3.3.0 lib/sail/graphql.rb