Class: SimpleGraphqlClient::Client
- Inherits:
-
Object
- Object
- SimpleGraphqlClient::Client
- Defined in:
- lib/simple_graphql_client/client.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(url:, &block) ⇒ Client
constructor
A new instance of Client.
- #query(gql:, variables: {}) ⇒ Object
Constructor Details
#initialize(url:, &block) ⇒ Client
Returns a new instance of Client.
10 11 12 13 |
# File 'lib/simple_graphql_client/client.rb', line 10 def initialize(url:, &block) @url = url = block end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/simple_graphql_client/client.rb', line 8 def end |
Instance Method Details
#query(gql:, variables: {}) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/simple_graphql_client/client.rb', line 15 def query(gql:, variables: {}) response = RestClient.post(@url, { query: gql, variables: variables }.to_json, ) Response.new(response) end |