Class: NewStoreApi::ImportSchemasController

Inherits:
BaseController show all
Defined in:
lib/new_store_api/controllers/import_schemas_controller.rb

Overview

ImportSchemasController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent

Constructor Details

This class inherits a constructor from NewStoreApi::BaseController

Instance Method Details

#create_import_schema(body, id: nil, entity: nil) ⇒ ImportSchemaCreated

Create new schema object containing jsonschema of version 7. This schema is used during import process to validate entity object before persisting it in catalog indexes. Valid jsonschema file

  • is validated against meta schema
  • references only properties mentioned in whitelist
  • #ref points only to local resource, e.g. external resources are not allowed. Here is list of whitelisted fields that can be used in schema (case sensitive):
  • brand (string, may be null)
  • title (string, may be null)
  • caption (string, may be null)
  • description (string, may be null)
  • keywords (array of strings, may be null)
  • product_id (string, max size 255, cannot contain characters =%)
  • variant_group_id (string, max size 255)
  • template_id (string, may be null)
  • tax_class_id (string, may be null)
  • schedule_b (string, may be null, definition)
  • product_hts_number (string, may be null)
  • google_category (string, may be null)
  • preorder_start (time RFC 3339 string, may be null)
  • online_to (time RFC 3339 string, may be null)
  • online_from (time RFC 3339 string, may be null)
  • country_of_origin (string, may be null)
  • material (string, may be null)
  • extended_attributes (array of attributes, may be null)
    • name (string, may be null)
    • value (string, may be null)
  • external_identifiers (array of identifiers, may be null)
    • type (string, may be null)
    • value (string, may be null)
  • filterable_attributes (array of attributes, may be null)
    • name (string, may be null)
    • value (string, may be null)
  • searchable_attributes (object contain key value string pairs, may be null )
    • [string] : [string] (name of searchable attribute)
  • shipping_dimension_unit (string, may be null)
  • shipping_dimension_width (number, may be null)
  • shipping_dimension_height (number, may be null)
  • shipping_dimension_length (number, may be null)
  • shipping_weight_value (number, may be null)
  • shipping_weight_unit (string, may be null)
  • variation_additional_1_name (string, may be null)
  • variation_additional_2_name (string, may be null)
  • variation_additional_1_value (string, may be null)
  • variation_additional_2_value (string, may be null)
  • variation_color_value (string, may be null)
  • variation_size_gender (string, may be null)
  • variation_size_system (string, may be null)
  • variation_size_value (string, may be null)
  • variation_size_type (string, may be null) here

Parameters:

  • body (File | UploadIO)

    Required parameter: TODO: type description

  • id (String) (defaults to: nil)

    Optional parameter: default generated id is returned

  • entity (ImportEntityEnum) (defaults to: nil)

    Optional parameter: default id PRODUCTS

Returns:



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/new_store_api/controllers/import_schemas_controller.rb', line 71

def create_import_schema(body,
                         id: nil,
                         entity: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/catalog/import-schemas',
                                 Server::API)
               .multipart_param(new_parameter(body, key: 'body')
                                 .default_content_type('application/octet-stream'))
               .query_param(new_parameter(id, key: 'id'))
               .query_param(new_parameter(entity, key: 'entity'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ImportSchemaCreated.method(:from_hash)))
    .execute
end

#destroy_import_schema(id) ⇒ void

This method returns an undefined value.

TODO: type endpoint description here

Parameters:

  • id (String)

    Required parameter: TODO: type description here



93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/new_store_api/controllers/import_schemas_controller.rb', line 93

def destroy_import_schema(id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/catalog/import-schemas/{id}',
                                 Server::API)
               .template_param(new_parameter(id, key: 'id')
                                .should_encode(true))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#show_import_schema(id) ⇒ ImportSchemaGet

TODO: type endpoint description here

Parameters:

  • id (String)

    Required parameter: TODO: type description here

Returns:



109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/new_store_api/controllers/import_schemas_controller.rb', line 109

def show_import_schema(id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/catalog/import-schemas/{id}',
                                 Server::API)
               .template_param(new_parameter(id, key: 'id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ImportSchemaGet.method(:from_hash)))
    .execute
end

#update_import_schema(id, body) ⇒ void

This method returns an undefined value.

TODO: type endpoint description here here

Parameters:

  • id (String)

    Required parameter: TODO: type description here

  • body (File | UploadIO)

    Required parameter: TODO: type description



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/new_store_api/controllers/import_schemas_controller.rb', line 129

def update_import_schema(id,
                         body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/catalog/import-schemas/{id}',
                                 Server::API)
               .template_param(new_parameter(id, key: 'id')
                                .should_encode(true))
               .multipart_param(new_parameter(body, key: 'body')
                                 .default_content_type('application/octet-stream'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end