Class: ActiveShopifyGraphQL::Query::Node::CurrentCustomer

Inherits:
ActiveShopifyGraphQL::Query::Node show all
Defined in:
lib/active_shopify_graphql/query/node/current_customer.rb

Overview

Renders a query that doesn't require an ID parameter. Used for Customer Account API's current customer query. Example:

query getCurrentCustomer {
customer {
  ...CustomerFragment
}
}

Constant Summary

Constants inherited from ActiveShopifyGraphQL::Query::Node

PAGE_INFO_FIELDS, STRING_KEYS_NEEDING_QUOTES

Instance Attribute Summary collapse

Attributes inherited from ActiveShopifyGraphQL::Query::Node

#alias_name, #arguments, #children, #name

Instance Method Summary collapse

Methods inherited from ActiveShopifyGraphQL::Query::Node

#add_child, #has_children?

Constructor Details

#initialize(model_type:, query_name:, fragment_name:, fragments: []) ⇒ CurrentCustomer

Returns a new instance of CurrentCustomer.



17
18
19
20
21
22
23
# File 'lib/active_shopify_graphql/query/node/current_customer.rb', line 17

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_nameObject (readonly)

Returns the value of attribute fragment_name.



15
16
17
# File 'lib/active_shopify_graphql/query/node/current_customer.rb', line 15

def fragment_name
  @fragment_name
end

#fragmentsObject (readonly)

Returns the value of attribute fragments.



15
16
17
# File 'lib/active_shopify_graphql/query/node/current_customer.rb', line 15

def fragments
  @fragments
end

#model_typeObject (readonly)

Returns the value of attribute model_type.



15
16
17
# File 'lib/active_shopify_graphql/query/node/current_customer.rb', line 15

def model_type
  @model_type
end

#query_nameObject (readonly)

Returns the value of attribute query_name.



15
16
17
# File 'lib/active_shopify_graphql/query/node/current_customer.rb', line 15

def query_name
  @query_name
end

Instance Method Details

#to_sObject



25
26
27
# File 'lib/active_shopify_graphql/query/node/current_customer.rb', line 25

def to_s
  "#{fragments_string} query getCurrent#{model_type} { #{query_name} { ...#{fragment_name} } }"
end