Class: GraphqlConnector::Formatters::BaseFormat

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql_connector/formatters/base_format.rb

Overview

Class that returns in query or mutation string format

Direct Known Subclasses

MutationFormat, QueryFormat

Instance Method Summary collapse

Constructor Details

#initialize(model, conditions, selected_fields) ⇒ BaseFormat

Returns a new instance of BaseFormat.



7
8
9
10
11
# File 'lib/graphql_connector/formatters/base_format.rb', line 7

def initialize(model, conditions, selected_fields)
  @model = model
  @conditions = conditions
  @selected_fields = selected_fields
end

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
# File 'lib/graphql_connector/formatters/base_format.rb', line 13

def create
  <<-STRING
  #{query_type} {
    #{@model}#{arguments} {
      #{parse_fields(@selected_fields)}
    }
  }
  STRING
end