Class: ActiveShopifyGraphQL::Query::Node::NestedConnection
- Inherits:
-
ActiveShopifyGraphQL::Query::Node
- Object
- ActiveShopifyGraphQL::Query::Node
- ActiveShopifyGraphQL::Query::Node::NestedConnection
- Defined in:
- lib/active_shopify_graphql/query/node/nested_connection.rb
Overview
Renders a nested connection query (loaded from a parent record). Example:
query($id: ID!) {
customer(id: $id) {
orders(first: 10) {
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
nodes {
...OrderFragment
}
}
}
}
Constant Summary
Constants inherited from ActiveShopifyGraphQL::Query::Node
PAGE_INFO_FIELDS, STRING_KEYS_NEEDING_QUOTES
Instance Attribute Summary collapse
-
#fragment_name ⇒ Object
readonly
Returns the value of attribute fragment_name.
-
#fragments ⇒ Object
readonly
Returns the value of attribute fragments.
-
#parent_query ⇒ Object
readonly
Returns the value of attribute parent_query.
-
#query_name ⇒ Object
readonly
Returns the value of attribute query_name.
-
#singular ⇒ Object
readonly
Returns the value of attribute singular.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Attributes inherited from ActiveShopifyGraphQL::Query::Node
#alias_name, #arguments, #children, #name
Instance Method Summary collapse
-
#initialize(query_name:, fragment_name:, parent_query:, variables: {}, fragments: [], singular: false) ⇒ NestedConnection
constructor
A new instance of NestedConnection.
- #to_s ⇒ Object
Methods inherited from ActiveShopifyGraphQL::Query::Node
Constructor Details
#initialize(query_name:, fragment_name:, parent_query:, variables: {}, fragments: [], singular: false) ⇒ NestedConnection
Returns a new instance of NestedConnection.
26 27 28 29 30 31 32 33 34 |
# File 'lib/active_shopify_graphql/query/node/nested_connection.rb', line 26 def initialize(query_name:, fragment_name:, parent_query:, variables: {}, fragments: [], singular: false) @query_name = query_name @fragment_name = fragment_name @variables = variables @parent_query = parent_query @fragments = fragments @singular = singular super(name: query_name) end |
Instance Attribute Details
#fragment_name ⇒ Object (readonly)
Returns the value of attribute fragment_name.
24 25 26 |
# File 'lib/active_shopify_graphql/query/node/nested_connection.rb', line 24 def fragment_name @fragment_name end |
#fragments ⇒ Object (readonly)
Returns the value of attribute fragments.
24 25 26 |
# File 'lib/active_shopify_graphql/query/node/nested_connection.rb', line 24 def fragments @fragments end |
#parent_query ⇒ Object (readonly)
Returns the value of attribute parent_query.
24 25 26 |
# File 'lib/active_shopify_graphql/query/node/nested_connection.rb', line 24 def parent_query @parent_query end |
#query_name ⇒ Object (readonly)
Returns the value of attribute query_name.
24 25 26 |
# File 'lib/active_shopify_graphql/query/node/nested_connection.rb', line 24 def query_name @query_name end |
#singular ⇒ Object (readonly)
Returns the value of attribute singular.
24 25 26 |
# File 'lib/active_shopify_graphql/query/node/nested_connection.rb', line 24 def singular @singular end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
24 25 26 |
# File 'lib/active_shopify_graphql/query/node/nested_connection.rb', line 24 def variables @variables end |
Instance Method Details
#to_s ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/active_shopify_graphql/query/node/nested_connection.rb', line 36 def to_s(*) if @singular render_singular_connection else render_nodes_connection end end |