Class: EPlat::Mapping::Bigcommerce::V3::ScriptTag

Inherits:
EPlat::Mapping::Base show all
Defined in:
lib/e_plat/mapping/bigcommerce/v_3/script_tag.rb

Constant Summary collapse

DEFAULT_VALUES =
{
    location: "head",
    auto_uninstall: true,
    kind: "src",
    load_method: "async",
    name: "app-script",
    enabled: true
}

Instance Attribute Summary

Attributes inherited from EPlat::Mapping::Base

#resource, #virtual_collection

Instance Method Summary collapse

Methods inherited from EPlat::Mapping::Base

#aliases, #e_plat_key_to, #initialize, #inspect, #keys_aliased_to_native_keys, #mappable_keys, #mappings, #native_key_to, #native_setter, #to_e_plat_keys, #to_native_keys, #via_native_attributes_where_possible, virtual_collection

Methods included from RequestBodyRoot

#include_root_in_request_body?

Constructor Details

This class inherits a constructor from EPlat::Mapping::Base

Instance Method Details

#native_attribute_aliasesObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/e_plat/mapping/bigcommerce/v_3/script_tag.rb', line 40

def native_attribute_aliases
    super.concat([
        {
            existing_entry: {native_key: "src", e_plat_key: "src"}
        },
        {
            alias_attribute: {native_key: "date_created", e_plat_key: "created_at"}
        },
        {
            alias_attribute: {native_key: "date_modified", e_plat_key: "updated_at"}
        },
        {
            alias_attribute: {native_key: "visibility", e_plat_key: "display_scope",
                custom_e_plat_getter: "-> (value) {
                    case value
                    when 'storefront'; then 'online_store'
                    when 'all_pages'; then 'all'
                    when 'order_confirmation'; then 'order_status'
                    else value
                    end
                }",
                custom_native_setter: "-> (value) {
                    case value
                    when 'online_store'; then 'storefront'
                    when 'all'; then 'all_pages'
                    when 'order_status'; then 'order_confirmation'
                    else value
                    end
                }"
            }
        }
    ])
end

#native_attributesObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/e_plat/mapping/bigcommerce/v_3/script_tag.rb', line 19

def native_attributes
    super.concat([
        "name",
        "description",
        "html",
        "src",
        "auto_uninstall",
        "load_method",  # default | async | defer
        "location",     # head | footer
        "visibility",   # storefront | all_pages | checkout | order_confirmation
        "kind",         # src | script_tag
        "api_client_id",
        "consent_category",
        "enabled",
        "channel_id",
        "date_created",
        "date_modified",
        "uuid"
    ])
end

#native_top_keyObject



15
16
17
# File 'lib/e_plat/mapping/bigcommerce/v_3/script_tag.rb', line 15

def native_top_key
    "data"
end