class ActiveGraphql::Client::Adapters::GraphlientAdapter
Client
which makes raw API requests to GraphQL server
Attributes
config[R]
url[R]
Public Class Methods
new(config)
click to toggle source
# File lib/active_graphql/client/adapters/graphlient_adapter.rb, line 11 def initialize(config) @url = config[:url] @config = config end
Public Instance Methods
adapter_config()
click to toggle source
# File lib/active_graphql/client/adapters/graphlient_adapter.rb, line 23 def adapter_config @adapter_config ||= config.except(:url, :multipart).tap do |new_config| new_config[:http] = GraphlientMultipartAdapter if multipart? end end
post(action)
click to toggle source
# File lib/active_graphql/client/adapters/graphlient_adapter.rb, line 16 def post(action) raw_response = graphql_client.query(action.to_graphql, action.graphql_variables) Response.new(raw_response.data) rescue Graphlient::Errors::GraphQLError => e Response.new(nil, e) end
Private Instance Methods
graphql_client()
click to toggle source
# File lib/active_graphql/client/adapters/graphlient_adapter.rb, line 33 def graphql_client @graphql_client ||= Graphlient::Client.new(url, **adapter_config) end
multipart?()
click to toggle source
# File lib/active_graphql/client/adapters/graphlient_adapter.rb, line 37 def multipart? config[:multipart].present? end