Class: EPlat::Woocommerce::Metafield
- Defined in:
- lib/e_plat/resource/platform_specific/woocommerce/metafield.rb
Constant Summary
Constants inherited from Metafield
Metafield::BIGCOMMERCE_DEFAULT_PERMISSION_SET, Metafield::READ_ONLY_ATTRIBUTES
Constants inherited from Base
Constants included from Concerns::GraphQLable
Concerns::GraphQLable::FILTER_ARGS, Concerns::GraphQLable::QUERY_ARG_ARGS
Instance Attribute Summary collapse
-
#order ⇒ Object
Returns the value of attribute order.
-
#product ⇒ Object
Returns the value of attribute product.
-
#variant ⇒ Object
Returns the value of attribute variant.
Attributes inherited from Base
Attributes included from Concerns::Aliases
Instance Method Summary collapse
Methods inherited from Metafield
#collection_path, #element_path, #normalize_attributes, #parent_class
Methods inherited from Base
cached_shopify_webhook?, client, #client, element_name_plural?, exclude_from_json, #formatted_id, #graphql_input, #headers, #include_root_in_json, inherited, #initialize, initialize_singleton!, #mapped?, #native_keys, platform_specific_class?, prefix=, #read_only?, #string_to_consistent_id
Methods included from Countable
Methods included from Concerns::GraphQLable
#graphql_mutation_string, #mutate_graphql, #remove_mutation_root_from
Methods included from Concerns::Aliases
Methods included from Concerns::FullJson
Methods included from Concerns::OverwriteRequestMethods
#collection_path, #element_path, included, #initialize
Methods included from Concerns::OverwriteInstanceMethods
#as_eplat_json, #as_json, #create, #create_resource_for, #to_eplat_json, #to_json, #update
Constructor Details
This class inherits a constructor from EPlat::Base
Instance Attribute Details
#order ⇒ Object
Returns the value of attribute order.
11 12 13 |
# File 'lib/e_plat/resource/platform_specific/woocommerce/metafield.rb', line 11 def order @order end |
#product ⇒ Object
Returns the value of attribute product.
11 12 13 |
# File 'lib/e_plat/resource/platform_specific/woocommerce/metafield.rb', line 11 def product @product end |
#variant ⇒ Object
Returns the value of attribute variant.
11 12 13 |
# File 'lib/e_plat/resource/platform_specific/woocommerce/metafield.rb', line 11 def variant @variant end |
Instance Method Details
#destroy ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/e_plat/resource/platform_specific/woocommerce/metafield.rb', line 13 def destroy return unless owner.present? run_callbacks :destroy do owner..each do |m| next unless m.id == id m.value = nil m.attribute_will_change!("id") m.attribute_will_change!("value") m.attribute_will_change!("key") end owner.attribute_will_change!("metafields") owner.save self.destroyed = true end end |
#owner ⇒ Object
32 33 34 |
# File 'lib/e_plat/resource/platform_specific/woocommerce/metafield.rb', line 32 def owner product || order || variant end |
#owner=(owner) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/e_plat/resource/platform_specific/woocommerce/metafield.rb', line 36 def owner=(owner) return if owner.nil? case owner.class.name when "EPlat::Woocommerce::Product" @product = owner when "EPlat::Woocommerce::Order" @order = owner when "EPlat::Woocommerce::Product::Variant" @variant = owner end end |