Class: EPlat::Mapping

Inherits:
Object
  • Object
show all
Defined in:
lib/e_plat/mapping.rb,
lib/e_plat/mapping/base.rb,
lib/e_plat/mapping/request_body_root.rb,
lib/e_plat/mapping/bigcommerce/v_3/shop.rb,
lib/e_plat/mapping/bigcommerce/v_3/order.rb,
lib/e_plat/mapping/shopify/v_2024_01/shop.rb,
lib/e_plat/mapping/shopify/v_2024_07/shop.rb,
lib/e_plat/mapping/bigcommerce/v_3/product.rb,
lib/e_plat/mapping/bigcommerce/v_3/webhook.rb,
lib/e_plat/mapping/shopify/v_2024_01/order.rb,
lib/e_plat/mapping/shopify/v_2024_07/order.rb,
lib/e_plat/mapping/virtual_collection/base.rb,
lib/e_plat/mapping/bigcommerce/v_3/metafield.rb,
lib/e_plat/mapping/shopify/v_2024_01/product.rb,
lib/e_plat/mapping/shopify/v_2024_01/webhook.rb,
lib/e_plat/mapping/shopify/v_2024_07/product.rb,
lib/e_plat/mapping/shopify/v_2024_07/webhook.rb,
lib/e_plat/mapping/bigcommerce/v_3/script_tag.rb,
lib/e_plat/mapping/shopify/v_2024_01/metafield.rb,
lib/e_plat/mapping/shopify/v_2024_07/metafield.rb,
lib/e_plat/mapping/shopify/v_2024_01/script_tag.rb,
lib/e_plat/mapping/shopify/v_2024_07/script_tag.rb,
lib/e_plat/mapping/bigcommerce/v_3/product/image.rb,
lib/e_plat/mapping/bigcommerce/v_3/product/option.rb,
lib/e_plat/mapping/bigcommerce/v_3/order/line_item.rb,
lib/e_plat/mapping/bigcommerce/v_3/product/variant.rb,
lib/e_plat/mapping/shopify/v_2024_01/product/image.rb,
lib/e_plat/mapping/shopify/v_2024_07/product/image.rb,
lib/e_plat/mapping/shopify/v_2024_07/product/option.rb,
lib/e_plat/mapping/shopify/v_2024_01/product/variant.rb,
lib/e_plat/mapping/shopify/v_2024_07/product/variant.rb,
lib/e_plat/mapping/bigcommerce/v_3/order/billing_address.rb,
lib/e_plat/mapping/bigcommerce/v_3/order/shipping_address.rb,
lib/e_plat/mapping/shopify/v_2024_01/order/billing_address.rb,
lib/e_plat/mapping/shopify/v_2024_07/order/billing_address.rb,
lib/e_plat/mapping/shopify/v_2024_01/order/shipping_address.rb,
lib/e_plat/mapping/shopify/v_2024_07/order/shipping_address.rb,
lib/e_plat/mapping/bigcommerce/v_3/product/variant/option_value.rb,
lib/e_plat/mapping/shopify/v_2024_07/product/variant/option_value.rb,
lib/e_plat/mapping/virtual_collection/bigcommerce/order_line_items.rb,
lib/e_plat/mapping/virtual_collection/shopify/product/variant/option_value.rb

Defined Under Namespace

Modules: Bigcommerce, RequestBodyRoot, Shopify, VirtualCollection Classes: Base

Class Method Summary collapse

Class Method Details

.new_instance(specifc_mapping:, resource: nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/e_plat/mapping.rb', line 8

def new_instance(specifc_mapping:, resource: nil)
	platform = EPlat::Current.e_plat_session.platform.to_s
	sanitized_mapping = sanitize_mapping(specifc_mapping, platform)

	if Object.const_defined?(sanitized_mapping)
		sanitized_mapping.constantize.new(resource)
	elsif Object.const_defined?(specifc_mapping)
		specifc_mapping.constantize.new(resource)
	else
		EPlat::Mapping::Base.new(resource)
	end
end