Class: ActiveShopifyGraphQL::Query::Node::SingleRecord
- Inherits:
-
ActiveShopifyGraphQL::Query::Node
- Object
- ActiveShopifyGraphQL::Query::Node
- ActiveShopifyGraphQL::Query::Node::SingleRecord
- Defined in:
- lib/active_shopify_graphql/query/node/single_record.rb
Overview
Renders a single record query by ID. Example:
query getCustomer($id: ID!) {
customer(id: $id) {
...CustomerFragment
}
}
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.
-
#model_type ⇒ Object
readonly
Returns the value of attribute model_type.
-
#query_name ⇒ Object
readonly
Returns the value of attribute query_name.
Attributes inherited from ActiveShopifyGraphQL::Query::Node
#alias_name, #arguments, #children, #name
Instance Method Summary collapse
-
#initialize(model_type:, query_name:, fragment_name:, fragments: []) ⇒ SingleRecord
constructor
A new instance of SingleRecord.
- #to_s ⇒ Object
Methods inherited from ActiveShopifyGraphQL::Query::Node
Constructor Details
#initialize(model_type:, query_name:, fragment_name:, fragments: []) ⇒ SingleRecord
Returns a new instance of SingleRecord.
16 17 18 19 20 21 22 |
# File 'lib/active_shopify_graphql/query/node/single_record.rb', line 16 def initialize(model_type:, query_name:, fragment_name:, fragments: []) @model_type = model_type @query_name = query_name @fragment_name = fragment_name @fragments = fragments super(name: query_name) end |
Instance Attribute Details
#fragment_name ⇒ Object (readonly)
Returns the value of attribute fragment_name.
14 15 16 |
# File 'lib/active_shopify_graphql/query/node/single_record.rb', line 14 def fragment_name @fragment_name end |
#fragments ⇒ Object (readonly)
Returns the value of attribute fragments.
14 15 16 |
# File 'lib/active_shopify_graphql/query/node/single_record.rb', line 14 def fragments @fragments end |
#model_type ⇒ Object (readonly)
Returns the value of attribute model_type.
14 15 16 |
# File 'lib/active_shopify_graphql/query/node/single_record.rb', line 14 def model_type @model_type end |
#query_name ⇒ Object (readonly)
Returns the value of attribute query_name.
14 15 16 |
# File 'lib/active_shopify_graphql/query/node/single_record.rb', line 14 def query_name @query_name end |
Instance Method Details
#to_s ⇒ Object
24 25 26 |
# File 'lib/active_shopify_graphql/query/node/single_record.rb', line 24 def to_s "#{fragments_string} query get#{model_type}($id: ID!) { #{query_name}(id: $id) { ...#{fragment_name} } }" end |