'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _capitalizeFirstLetter = require('../../utils/capitalizeFirstLetter');

var _capitalizeFirstLetter2 = _interopRequireDefault(_capitalizeFirstLetter);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.default = {
  language: 'Ruby',
  name: 'graphql-client',
  prismLanguage: 'ruby',
  options: [],
  generate: function generate(_ref) {
    var serverUrl = _ref.serverUrl,
        variableName = _ref.variableName,
        operationType = _ref.operationType,
        operationName = _ref.operationName,
        operation = _ref.operation,
        options = _ref.options;

    var queryName = (0, _capitalizeFirstLetter2.default)(operationName) + (0, _capitalizeFirstLetter2.default)(operationType);

    return '\nrequire "graphql/client"\nrequire "graphql/client/http"\n\nServerUrl = "' + serverUrl + '"\nHTTP = GraphQL::Client::HTTP.new(ServerUrl)\nSchema = GraphQL::Client.load_schema(HTTP)\nClient = GraphQL::Client.new(schema: Schema, execute: HTTP)\n\n' + queryName + ' = Client.parse <<-\'GRAPHQL\'\n' + operation + '\nGRAPHQL\n\n\nresult = Client.query(' + queryName + ')\nputs(result)';
  }
};