Class: DevSuite::RequestBuilder::Formatter::Graphql
- Defined in:
- lib/dev_suite/request_builder/formatter/graphql.rb
Instance Method Summary collapse
Instance Method Details
#format_body(body) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/dev_suite/request_builder/formatter/graphql.rb', line 7 def format_body(body) if body.is_a?(Hash) && body[:query] && body[:variables] { query: body[:query], variables: body[:variables] }.to_json elsif body.is_a?(String) { query: body, variables: {} }.to_json else raise ArgumentError, "Invalid GraphQL body format" end end |