Module: Crowdin::Web::GraphqlExtensions
- Included in:
- Client
- Defined in:
- lib/crowdin-api/core/graphql_extensions.rb
Instance Method Summary collapse
Instance Method Details
#graphql(query = nil, **request_options) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/crowdin-api/core/graphql_extensions.rb', line 6 def graphql(query = nil, **) url = .delete(:url) graphql_query = query || response = ::RestClient::Request.execute( { method: :post, url: url || "#{config.base_url}/api/graphql", payload: graphql_query.to_json }.merge() ) { |res, _, _| res } response.body.empty? ? response.code : JSON.parse(response.body) end |