Sha256: 82141995407561c1208cf0d63320cd2a78887206d43f1af2c1b5aa39e17dbba8

Contents?: true

Size: 904 Bytes

Versions: 2

Compression:

Stored size: 904 Bytes

Contents

# frozen_string_literal: true

module GraphQL
  module Client
    class Config
      attr_accessor(
        :debug,
        :headers,
        :per_page,
        :password,
        :username,
        :url,
        :open_timeout,
        :read_timeout
      )

      DEFAULTS = {
        debug: false,
        headers: {},
        per_page: 100,
        open_timeout: 5,
        read_timeout: 5
      }

      def initialize(options = {})
        @options = DEFAULTS.merge(options)
        @debug = @options[:debug]
        @headers = @options[:headers]
        @per_page = @options[:per_page]
        @password = @options[:password]
        @username = @options[:username]
        @open_timeout = @options[:open_timeout]
        @read_timeout = @options[:read_timeout]
        @url = URI(@options[:url]) if @options[:url]
      end

      def url=(url)
        @url = URI(url)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphql_client-0.4.1 lib/graphql_client/config.rb
graphql_client-0.3.3 lib/graphql_client/config.rb