Class: EPlat::Product::Variant
- Defined in:
- lib/e_plat/resource/product/variant.rb,
lib/e_plat/resource/product/variant/option_value.rb
Direct Known Subclasses
Bigcommerce::Product::Variant, Shopify::Product::Variant, ShopifyWebhook::Product::Variant
Defined Under Namespace
Classes: OptionValue
Constant Summary
Constants included from Concerns::GraphQLable
Concerns::GraphQLable::FILTER_ARGS, Concerns::GraphQLable::QUERY_ARG_ARGS
Instance Attribute Summary
Attributes inherited from Base
Attributes included from Concerns::Aliases
Instance Method Summary collapse
-
#image_src(images = []) ⇒ Object
EPlat::Product::Image => string.
- #save ⇒ Object
Methods inherited from Base
cached_shopify_webhook?, client, #client, 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?
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
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 Method Details
#image_src(images = []) ⇒ Object
EPlat::Product::Image => string
40 41 42 43 44 45 46 47 48 |
# File 'lib/e_plat/resource/product/variant.rb', line 40 def image_src(images=[]) # EPlat::Product::Image => string if client.bigcommerce? image_url elsif is_a?(EPlat::ShopifyWebhook::Product::Variant) images.to_a.find{ |i| i.id == image_id }.try(:src) elsif is_a?(EPlat::Shopify::Product::Variant) image&.src end end |
#save ⇒ Object
35 36 37 38 |
# File 'lib/e_plat/resource/product/variant.rb', line 35 def save [:product] ||= try(:product)&.id super end |