Class: ShopifyOracle::Accessor::SellingPlanGroup
- Defined in:
- lib/shopify_oracle/accessor/selling_plan_group.rb
Instance Attribute Summary collapse
-
#selling_plan_group ⇒ Object
readonly
Returns the value of attribute selling_plan_group.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #add_products(products:) ⇒ Object
- #add_variants(variants:) ⇒ Object
- #edit_name(name:) ⇒ Object
-
#initialize(id:) ⇒ SellingPlanGroup
constructor
A new instance of SellingPlanGroup.
- #reload ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(id:) ⇒ SellingPlanGroup
Returns a new instance of SellingPlanGroup.
14 15 16 17 |
# File 'lib/shopify_oracle/accessor/selling_plan_group.rb', line 14 def initialize(id:) super @selling_plan_group = @object end |
Instance Attribute Details
#selling_plan_group ⇒ Object (readonly)
Returns the value of attribute selling_plan_group.
12 13 14 |
# File 'lib/shopify_oracle/accessor/selling_plan_group.rb', line 12 def selling_plan_group @selling_plan_group end |
Class Method Details
.create(name:) ⇒ Object
7 8 9 |
# File 'lib/shopify_oracle/accessor/selling_plan_group.rb', line 7 def create(name:) ShopifyOracle.mutate(:create_selling_plan_group, name:) end |
Instance Method Details
#add_products(products:) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/shopify_oracle/accessor/selling_plan_group.rb', line 42 def add_products(products:) products = products.map { |v| v.is_a?(Integer) ? "gid://shopify/Product/#{v}" : v } @oracle.mutate( :add_products_to_selling_plan_group, sellingPlanGroup: @gid, products: ) end |
#add_variants(variants:) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/shopify_oracle/accessor/selling_plan_group.rb', line 32 def add_variants(variants:) variants = variants.map { |v| v.is_a?(Integer) ? "gid://shopify/ProductVariant/#{v}" : v } @oracle.mutate( :add_variants_to_selling_plan_group, sellingPlanGroup: @gid, variants: ) end |
#edit_name(name:) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/shopify_oracle/accessor/selling_plan_group.rb', line 24 def edit_name(name:) @oracle.mutate( :edit_selling_plan_group_name, sellingPlanGroup: @id, name: ) end |
#reload ⇒ Object
19 20 21 22 |
# File 'lib/shopify_oracle/accessor/selling_plan_group.rb', line 19 def reload super @selling_plan_group = @object end |