algolia 3.0.0.alpha.16 → 3.0.0.alpha.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.openapi-generator/FILES +10 -167
- data/CHANGELOG.md +16 -0
- data/Gemfile.lock +4 -4
- data/lib/algolia/api/abtesting_client.rb +20 -20
- data/lib/algolia/api/analytics_client.rb +76 -76
- data/lib/algolia/api/personalization_client.rb +12 -12
- data/lib/algolia/api/recommend_client.rb +22 -22
- data/lib/algolia/api/search_client.rb +8 -8
- data/lib/algolia/api/usage_client.rb +329 -0
- data/lib/algolia/models/abtesting/ab_test.rb +41 -16
- data/lib/algolia/models/abtesting/ab_test_configuration.rb +217 -0
- data/lib/algolia/models/abtesting/ab_test_response.rb +2 -2
- data/lib/algolia/models/abtesting/ab_tests_variant.rb +21 -3
- data/lib/algolia/models/abtesting/ab_tests_variant_search_params.rb +21 -3
- data/lib/algolia/models/abtesting/add_ab_tests_request.rb +1 -1
- data/lib/algolia/models/abtesting/custom_search_params.rb +1 -1
- data/lib/algolia/models/abtesting/effect.rb +35 -0
- data/lib/algolia/models/abtesting/empty_search.rb +198 -0
- data/lib/algolia/models/abtesting/list_ab_tests_response.rb +1 -1
- data/lib/algolia/models/abtesting/minimum_detectable_effect.rb +247 -0
- data/lib/algolia/models/abtesting/outliers.rb +198 -0
- data/lib/algolia/models/abtesting/status.rb +35 -0
- data/lib/algolia/models/abtesting/variant.rb +31 -13
- data/lib/algolia/models/analytics/get_status_response.rb +1 -1
- data/lib/algolia/models/ingestion/auth_algolia_insights.rb +212 -0
- data/lib/algolia/models/{recommend/consequence_query_object.rb → ingestion/auth_algolia_insights_partial.rb} +21 -24
- data/lib/algolia/models/ingestion/auth_input.rb +1 -0
- data/lib/algolia/models/ingestion/auth_input_partial.rb +1 -0
- data/lib/algolia/models/ingestion/authentication_type.rb +2 -1
- data/lib/algolia/models/ingestion/destination_index_name.rb +1 -1
- data/lib/algolia/models/ingestion/shopify_input.rb +212 -0
- data/lib/algolia/models/ingestion/shopify_market.rb +227 -0
- data/lib/algolia/models/ingestion/shopify_metafield.rb +221 -0
- data/lib/algolia/models/ingestion/source_input.rb +2 -1
- data/lib/algolia/models/ingestion/source_shopify.rb +278 -0
- data/lib/algolia/models/{recommend/base_recommended_for_you_query_parameters.rb → ingestion/source_shopify_base.rb} +14 -14
- data/lib/algolia/models/ingestion/source_update_input.rb +2 -1
- data/lib/algolia/models/ingestion/source_update_shopify.rb +258 -0
- data/lib/algolia/models/ingestion/task_input.rb +1 -0
- data/lib/algolia/models/insights/added_to_cart_object_ids.rb +2 -2
- data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +2 -2
- data/lib/algolia/models/insights/clicked_filters.rb +2 -2
- data/lib/algolia/models/insights/clicked_object_ids.rb +2 -2
- data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +2 -2
- data/lib/algolia/models/insights/converted_filters.rb +2 -2
- data/lib/algolia/models/insights/converted_object_ids.rb +2 -2
- data/lib/algolia/models/insights/converted_object_ids_after_search.rb +2 -2
- data/lib/algolia/models/insights/purchased_object_ids.rb +2 -2
- data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +2 -2
- data/lib/algolia/models/insights/viewed_filters.rb +2 -2
- data/lib/algolia/models/insights/viewed_object_ids.rb +2 -2
- data/lib/algolia/models/monitoring/incidents_inner.rb +1 -1
- data/lib/algolia/models/monitoring/probes_metric.rb +1 -1
- data/lib/algolia/models/monitoring/time_inner.rb +1 -1
- data/lib/algolia/models/personalization/delete_user_profile_response.rb +2 -2
- data/lib/algolia/models/personalization/event_scoring.rb +25 -4
- data/lib/algolia/models/personalization/event_type.rb +34 -0
- data/lib/algolia/models/personalization/facet_scoring.rb +2 -2
- data/lib/algolia/models/personalization/get_user_token_response.rb +3 -3
- data/lib/algolia/models/personalization/personalization_strategy_params.rb +21 -3
- data/lib/algolia/models/query-suggestions/get_config_status200_response.rb +3 -3
- data/lib/algolia/models/query-suggestions/get_log_file200_response.rb +1 -1
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +1 -1
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_with_index.rb +1 -1
- data/lib/algolia/models/query-suggestions/source_index.rb +1 -1
- data/lib/algolia/models/recommend/auto_facet_filter.rb +208 -0
- data/lib/algolia/models/recommend/base_recommend_request.rb +37 -8
- data/lib/algolia/models/recommend/base_search_params.rb +4 -4
- data/lib/algolia/models/recommend/base_search_params_without_query.rb +4 -4
- data/lib/algolia/models/recommend/bought_together_query.rb +319 -0
- data/lib/algolia/models/recommend/condition.rb +12 -62
- data/lib/algolia/models/recommend/consequence.rb +32 -54
- data/lib/algolia/models/recommend/deleted_at_response.rb +1 -1
- data/lib/algolia/models/recommend/{recommended_for_you_query_parameters.rb → fallback_params.rb} +17 -20
- data/lib/algolia/models/recommend/{edit_type.rb → fbt_model.rb} +5 -6
- data/lib/algolia/models/recommend/{base_trending_facets_query.rb → frequently_bought_together.rb} +20 -18
- data/lib/algolia/models/recommend/get_recommendations_params.rb +2 -2
- data/lib/algolia/models/recommend/{consequence_hide.rb → hide_consequence_object.rb} +4 -6
- data/lib/algolia/models/recommend/index_settings_as_search_params.rb +10 -10
- data/lib/algolia/models/recommend/{base_recommendations_query.rb → looking_similar.rb} +6 -15
- data/lib/algolia/models/recommend/{anchoring.rb → looking_similar_model.rb} +5 -8
- data/lib/algolia/models/recommend/looking_similar_query.rb +328 -0
- data/lib/algolia/models/recommend/{params.rb → params_consequence.rb} +26 -28
- data/lib/algolia/models/recommend/{promote_object_id.rb → promote_consequence_object.rb} +19 -9
- data/lib/algolia/models/recommend/re_ranking_apply_filter.rb +1 -1
- data/lib/algolia/models/recommend/{rule_response.rb → recommend_rule.rb} +13 -18
- data/lib/algolia/models/recommend/{rule_response_metadata.rb → recommend_rule_metadata.rb} +5 -4
- data/lib/algolia/models/recommend/recommendations_hits.rb +4 -24
- data/lib/algolia/models/recommend/recommendations_request.rb +3 -1
- data/lib/algolia/models/recommend/recommendations_results.rb +4 -24
- data/lib/algolia/models/recommend/{base_recommended_for_you_query.rb → recommended_for_you.rb} +5 -14
- data/lib/algolia/models/recommend/recommended_for_you_query.rb +36 -16
- data/lib/algolia/models/recommend/{recommendation_models.rb → related_model.rb} +4 -5
- data/lib/algolia/models/recommend/{edit.rb → related_products.rb} +27 -24
- data/lib/algolia/models/recommend/{recommendations_query.rb → related_query.rb} +40 -20
- data/lib/algolia/models/recommend/{consequence_params.rb → search_params.rb} +33 -52
- data/lib/algolia/models/recommend/search_params_object.rb +15 -14
- data/lib/algolia/models/recommend/search_recommend_rules_params.rb +58 -10
- data/lib/algolia/models/recommend/search_recommend_rules_response.rb +2 -2
- data/lib/algolia/models/recommend/trending_facet_hit.rb +2 -2
- data/lib/algolia/models/recommend/trending_facets.rb +243 -0
- data/lib/algolia/models/recommend/trending_facets_query.rb +51 -11
- data/lib/algolia/models/recommend/{base_trending_items_query.rb → trending_items.rb} +12 -15
- data/lib/algolia/models/recommend/trending_items_query.rb +43 -17
- data/lib/algolia/models/search/add_api_key_response.rb +1 -1
- data/lib/algolia/models/search/base_get_api_key_response.rb +1 -1
- data/lib/algolia/models/search/base_index_settings.rb +10 -10
- data/lib/algolia/models/search/base_search_params.rb +4 -4
- data/lib/algolia/models/search/base_search_params_without_query.rb +4 -4
- data/lib/algolia/models/search/browse_params_object.rb +14 -14
- data/lib/algolia/models/search/consequence_params.rb +14 -14
- data/lib/algolia/models/search/created_at_response.rb +1 -1
- data/lib/algolia/models/search/delete_api_key_response.rb +1 -1
- data/lib/algolia/models/search/delete_by_params.rb +2 -2
- data/lib/algolia/models/search/delete_source_response.rb +1 -1
- data/lib/algolia/models/search/deleted_at_response.rb +1 -1
- data/lib/algolia/models/search/fetched_index.rb +1 -1
- data/lib/algolia/models/search/get_api_key_response.rb +1 -1
- data/lib/algolia/models/search/index_settings.rb +20 -20
- data/lib/algolia/models/search/index_settings_as_search_params.rb +10 -10
- data/lib/algolia/models/search/log.rb +1 -1
- data/lib/algolia/models/search/multiple_batch_request.rb +1 -1
- data/lib/algolia/models/search/operation_index_params.rb +1 -1
- data/lib/algolia/models/search/re_ranking_apply_filter.rb +1 -1
- data/lib/algolia/models/search/remove_user_id_response.rb +1 -1
- data/lib/algolia/models/search/replace_source_response.rb +1 -1
- data/lib/algolia/models/search/save_object_response.rb +1 -1
- data/lib/algolia/models/search/save_synonym_response.rb +1 -1
- data/lib/algolia/models/search/search_for_facets.rb +15 -15
- data/lib/algolia/models/search/search_for_facets_options.rb +1 -1
- data/lib/algolia/models/search/search_for_hits.rb +15 -15
- data/lib/algolia/models/search/search_for_hits_options.rb +1 -1
- data/lib/algolia/models/search/search_params_object.rb +15 -14
- data/lib/algolia/models/search/search_user_ids_response.rb +1 -1
- data/lib/algolia/models/search/secured_api_key_restrictions.rb +1 -1
- data/lib/algolia/models/search/update_api_key_response.rb +1 -1
- data/lib/algolia/models/search/updated_at_response.rb +1 -1
- data/lib/algolia/models/search/updated_at_with_object_id_response.rb +1 -1
- data/lib/algolia/models/search/updated_rule_response.rb +1 -1
- data/lib/algolia/models/search/user_hit.rb +1 -1
- data/lib/algolia/models/search/user_id.rb +1 -1
- data/lib/algolia/models/usage/error_base.rb +205 -0
- data/lib/algolia/models/usage/get_usage200_response.rb +198 -0
- data/lib/algolia/models/usage/get_usage200_response_statistics_inner.rb +206 -0
- data/lib/algolia/models/usage/get_usage400_response.rb +198 -0
- data/lib/algolia/models/usage/get_usage400_response_error.rb +216 -0
- data/lib/algolia/models/usage/get_usage400_response_error_errors_inner.rb +225 -0
- data/lib/algolia/models/usage/granularity.rb +33 -0
- data/lib/algolia/models/usage/statistic.rb +116 -0
- data/lib/algolia/models/{recommend/promote.rb → usage/statistic_value.rb} +5 -5
- data/lib/algolia/version.rb +1 -1
- metadata +47 -25
- data/lib/algolia/models/recommend/automatic_facet_filter.rb +0 -220
- data/lib/algolia/models/recommend/automatic_facet_filters.rb +0 -97
- data/lib/algolia/models/recommend/consequence_query.rb +0 -97
- data/lib/algolia/models/recommend/promote_object_ids.rb +0 -228
@@ -0,0 +1,278 @@
|
|
1
|
+
# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'time'
|
5
|
+
|
6
|
+
module Algolia
|
7
|
+
module Ingestion
|
8
|
+
class SourceShopify
|
9
|
+
# Whether to index collection IDs. If your store has `has_collection_search_page` set to true, collection IDs will be indexed even if `collectionIDIndexing` is false.
|
10
|
+
attr_accessor :collection_id_indexing
|
11
|
+
|
12
|
+
# Whether to increase the number of indexed collections per product. If true, Algolia indexes 200 collections per product. If false, 100 collections per product are indexed.
|
13
|
+
attr_accessor :increase_product_collection_limit
|
14
|
+
|
15
|
+
# Whether to set the default price ratio to 1 if no sale price is present. The price ratio is determined by the ratio: `sale_price` / `regular_price`. If no sale price is present, the price ratio would be 0. If `defaultPriceRatioAsOne` is true, the price ratio is indexed as 1 instead.
|
16
|
+
attr_accessor :default_price_ratio_as_one
|
17
|
+
|
18
|
+
# Whether to exclude out-of-stock variants when determining the `max_variant_price` and `min_variant_price` attributes.
|
19
|
+
attr_accessor :exclude_oos_variants_for_price_at_trs
|
20
|
+
|
21
|
+
# Whether to include an inventory with every variant for every product record.
|
22
|
+
attr_accessor :include_variants_inventory
|
23
|
+
|
24
|
+
# Whether to include collection IDs and handles in the product records.
|
25
|
+
attr_accessor :has_collection_search_page
|
26
|
+
|
27
|
+
# Whether to convert tags on products to named tags. To learn more, see [Named tags](https://www.algolia.com/doc/integration/shopify/sending-and-managing-data/named-tags).
|
28
|
+
attr_accessor :product_named_tags
|
29
|
+
|
30
|
+
# URL of the Shopify store.
|
31
|
+
attr_accessor :shop_url
|
32
|
+
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
34
|
+
def self.attribute_map
|
35
|
+
{
|
36
|
+
:collection_id_indexing => :collectionIDIndexing,
|
37
|
+
:increase_product_collection_limit => :increaseProductCollectionLimit,
|
38
|
+
:default_price_ratio_as_one => :defaultPriceRatioAsOne,
|
39
|
+
:exclude_oos_variants_for_price_at_trs => :excludeOOSVariantsForPriceAtTRS,
|
40
|
+
:include_variants_inventory => :includeVariantsInventory,
|
41
|
+
:has_collection_search_page => :hasCollectionSearchPage,
|
42
|
+
:product_named_tags => :productNamedTags,
|
43
|
+
:shop_url => :shopURL
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# Returns all the JSON keys this model knows about
|
48
|
+
def self.acceptable_attributes
|
49
|
+
attribute_map.values
|
50
|
+
end
|
51
|
+
|
52
|
+
# Attribute type mapping.
|
53
|
+
def self.types_mapping
|
54
|
+
{
|
55
|
+
:collection_id_indexing => :Boolean,
|
56
|
+
:increase_product_collection_limit => :Boolean,
|
57
|
+
:default_price_ratio_as_one => :Boolean,
|
58
|
+
:exclude_oos_variants_for_price_at_trs => :Boolean,
|
59
|
+
:include_variants_inventory => :Boolean,
|
60
|
+
:has_collection_search_page => :Boolean,
|
61
|
+
:product_named_tags => :Boolean,
|
62
|
+
:shop_url => :String
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# List of attributes with nullable: true
|
67
|
+
def self.openapi_nullable
|
68
|
+
Set.new([])
|
69
|
+
end
|
70
|
+
|
71
|
+
# List of class defined in allOf (OpenAPI v3)
|
72
|
+
def self.openapi_all_of
|
73
|
+
[
|
74
|
+
:SourceShopifyBase,
|
75
|
+
:SourceUpdateShopify
|
76
|
+
]
|
77
|
+
end
|
78
|
+
|
79
|
+
# Initializes the object
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
81
|
+
def initialize(attributes = {})
|
82
|
+
unless attributes.is_a?(Hash)
|
83
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::SourceShopify` initialize method"
|
84
|
+
end
|
85
|
+
|
86
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
87
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
88
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
89
|
+
raise ArgumentError,
|
90
|
+
"`#{k}` is not a valid attribute in `Algolia::SourceShopify`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
91
|
+
end
|
92
|
+
|
93
|
+
h[k.to_sym] = v
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.key?(:collection_id_indexing)
|
97
|
+
self.collection_id_indexing = attributes[:collection_id_indexing]
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:increase_product_collection_limit)
|
101
|
+
self.increase_product_collection_limit = attributes[:increase_product_collection_limit]
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:default_price_ratio_as_one)
|
105
|
+
self.default_price_ratio_as_one = attributes[:default_price_ratio_as_one]
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.key?(:exclude_oos_variants_for_price_at_trs)
|
109
|
+
self.exclude_oos_variants_for_price_at_trs = attributes[:exclude_oos_variants_for_price_at_trs]
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.key?(:include_variants_inventory)
|
113
|
+
self.include_variants_inventory = attributes[:include_variants_inventory]
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:has_collection_search_page)
|
117
|
+
self.has_collection_search_page = attributes[:has_collection_search_page]
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.key?(:product_named_tags)
|
121
|
+
self.product_named_tags = attributes[:product_named_tags]
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.key?(:shop_url)
|
125
|
+
self.shop_url = attributes[:shop_url]
|
126
|
+
else
|
127
|
+
self.shop_url = nil
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# Checks equality by comparing each attribute.
|
132
|
+
# @param [Object] Object to be compared
|
133
|
+
def ==(other)
|
134
|
+
return true if equal?(other)
|
135
|
+
|
136
|
+
self.class == other.class &&
|
137
|
+
collection_id_indexing == other.collection_id_indexing &&
|
138
|
+
increase_product_collection_limit == other.increase_product_collection_limit &&
|
139
|
+
default_price_ratio_as_one == other.default_price_ratio_as_one &&
|
140
|
+
exclude_oos_variants_for_price_at_trs == other.exclude_oos_variants_for_price_at_trs &&
|
141
|
+
include_variants_inventory == other.include_variants_inventory &&
|
142
|
+
has_collection_search_page == other.has_collection_search_page &&
|
143
|
+
product_named_tags == other.product_named_tags &&
|
144
|
+
shop_url == other.shop_url
|
145
|
+
end
|
146
|
+
|
147
|
+
# @see the `==` method
|
148
|
+
# @param [Object] Object to be compared
|
149
|
+
def eql?(other)
|
150
|
+
self == other
|
151
|
+
end
|
152
|
+
|
153
|
+
# Calculates hash code according to all attributes.
|
154
|
+
# @return [Integer] Hash code
|
155
|
+
def hash
|
156
|
+
[collection_id_indexing, increase_product_collection_limit, default_price_ratio_as_one, exclude_oos_variants_for_price_at_trs, include_variants_inventory,
|
157
|
+
has_collection_search_page, product_named_tags, shop_url].hash
|
158
|
+
end
|
159
|
+
|
160
|
+
# Builds the object from hash
|
161
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
162
|
+
# @return [Object] Returns the model itself
|
163
|
+
def self.build_from_hash(attributes)
|
164
|
+
return nil unless attributes.is_a?(Hash)
|
165
|
+
|
166
|
+
attributes = attributes.transform_keys(&:to_sym)
|
167
|
+
transformed_hash = {}
|
168
|
+
types_mapping.each_pair do |key, type|
|
169
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
170
|
+
transformed_hash[key.to_sym] = nil
|
171
|
+
elsif type =~ /\AArray<(.*)>/i
|
172
|
+
# check to ensure the input is an array given that the attribute
|
173
|
+
# is documented as an array but the input is not
|
174
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
175
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
176
|
+
end
|
177
|
+
elsif !attributes[attribute_map[key]].nil?
|
178
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
179
|
+
end
|
180
|
+
end
|
181
|
+
new(transformed_hash)
|
182
|
+
end
|
183
|
+
|
184
|
+
# Deserializes the data based on type
|
185
|
+
# @param string type Data type
|
186
|
+
# @param string value Value to be deserialized
|
187
|
+
# @return [Object] Deserialized data
|
188
|
+
def self._deserialize(type, value)
|
189
|
+
case type.to_sym
|
190
|
+
when :Time
|
191
|
+
Time.parse(value)
|
192
|
+
when :Date
|
193
|
+
Date.parse(value)
|
194
|
+
when :String
|
195
|
+
value.to_s
|
196
|
+
when :Integer
|
197
|
+
value.to_i
|
198
|
+
when :Float
|
199
|
+
value.to_f
|
200
|
+
when :Boolean
|
201
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
202
|
+
true
|
203
|
+
else
|
204
|
+
false
|
205
|
+
end
|
206
|
+
when :Object
|
207
|
+
# generic object (usually a Hash), return directly
|
208
|
+
value
|
209
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
210
|
+
inner_type = Regexp.last_match[:inner_type]
|
211
|
+
value.map { |v| _deserialize(inner_type, v) }
|
212
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
213
|
+
k_type = Regexp.last_match[:k_type]
|
214
|
+
v_type = Regexp.last_match[:v_type]
|
215
|
+
{}.tap do |hash|
|
216
|
+
value.each do |k, v|
|
217
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
else # model
|
221
|
+
# models (e.g. Pet) or oneOf
|
222
|
+
klass = Algolia::Ingestion.const_get(type)
|
223
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
# Returns the string representation of the object
|
228
|
+
# @return [String] String presentation of the object
|
229
|
+
def to_s
|
230
|
+
to_hash.to_s
|
231
|
+
end
|
232
|
+
|
233
|
+
# to_body is an alias to to_hash (backward compatibility)
|
234
|
+
# @return [Hash] Returns the object in the form of hash
|
235
|
+
def to_body
|
236
|
+
to_hash
|
237
|
+
end
|
238
|
+
|
239
|
+
def to_json(*_args)
|
240
|
+
to_hash.to_json
|
241
|
+
end
|
242
|
+
|
243
|
+
# Returns the object in the form of hash
|
244
|
+
# @return [Hash] Returns the object in the form of hash
|
245
|
+
def to_hash
|
246
|
+
hash = {}
|
247
|
+
self.class.attribute_map.each_pair do |attr, param|
|
248
|
+
value = send(attr)
|
249
|
+
if value.nil?
|
250
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
251
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
252
|
+
end
|
253
|
+
|
254
|
+
hash[param] = _to_hash(value)
|
255
|
+
end
|
256
|
+
hash
|
257
|
+
end
|
258
|
+
|
259
|
+
# Outputs non-array value in the form of hash
|
260
|
+
# For object, use to_hash. Otherwise, just return the value
|
261
|
+
# @param [Object] value Any valid value
|
262
|
+
# @return [Hash] Returns the value in the form of hash
|
263
|
+
def _to_hash(value)
|
264
|
+
if value.is_a?(Array)
|
265
|
+
value.compact.map { |v| _to_hash(v) }
|
266
|
+
elsif value.is_a?(Hash)
|
267
|
+
{}.tap do |hash|
|
268
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
269
|
+
end
|
270
|
+
elsif value.respond_to? :to_hash
|
271
|
+
value.to_hash
|
272
|
+
else
|
273
|
+
value
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
@@ -4,15 +4,15 @@ require 'date'
|
|
4
4
|
require 'time'
|
5
5
|
|
6
6
|
module Algolia
|
7
|
-
module
|
8
|
-
class
|
9
|
-
#
|
10
|
-
attr_accessor :
|
7
|
+
module Ingestion
|
8
|
+
class SourceShopifyBase
|
9
|
+
# URL of the Shopify store.
|
10
|
+
attr_accessor :shop_url
|
11
11
|
|
12
12
|
# Attribute mapping from ruby-style variable name to JSON key.
|
13
13
|
def self.attribute_map
|
14
14
|
{
|
15
|
-
:
|
15
|
+
:shop_url => :shopURL
|
16
16
|
}
|
17
17
|
end
|
18
18
|
|
@@ -24,7 +24,7 @@ module Algolia
|
|
24
24
|
# Attribute type mapping.
|
25
25
|
def self.types_mapping
|
26
26
|
{
|
27
|
-
:
|
27
|
+
:shop_url => :String
|
28
28
|
}
|
29
29
|
end
|
30
30
|
|
@@ -37,23 +37,23 @@ module Algolia
|
|
37
37
|
# @param [Hash] attributes Model attributes in the form of hash
|
38
38
|
def initialize(attributes = {})
|
39
39
|
unless attributes.is_a?(Hash)
|
40
|
-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::
|
40
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::SourceShopifyBase` initialize method"
|
41
41
|
end
|
42
42
|
|
43
43
|
# check to see if the attribute exists and convert string to symbol for hash key
|
44
44
|
attributes = attributes.each_with_object({}) do |(k, v), h|
|
45
45
|
unless self.class.attribute_map.key?(k.to_sym)
|
46
46
|
raise ArgumentError,
|
47
|
-
"`#{k}` is not a valid attribute in `Algolia::
|
47
|
+
"`#{k}` is not a valid attribute in `Algolia::SourceShopifyBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
48
48
|
end
|
49
49
|
|
50
50
|
h[k.to_sym] = v
|
51
51
|
end
|
52
52
|
|
53
|
-
if attributes.key?(:
|
54
|
-
self.
|
53
|
+
if attributes.key?(:shop_url)
|
54
|
+
self.shop_url = attributes[:shop_url]
|
55
55
|
else
|
56
|
-
self.
|
56
|
+
self.shop_url = nil
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -63,7 +63,7 @@ module Algolia
|
|
63
63
|
return true if equal?(other)
|
64
64
|
|
65
65
|
self.class == other.class &&
|
66
|
-
|
66
|
+
shop_url == other.shop_url
|
67
67
|
end
|
68
68
|
|
69
69
|
# @see the `==` method
|
@@ -75,7 +75,7 @@ module Algolia
|
|
75
75
|
# Calculates hash code according to all attributes.
|
76
76
|
# @return [Integer] Hash code
|
77
77
|
def hash
|
78
|
-
[
|
78
|
+
[shop_url].hash
|
79
79
|
end
|
80
80
|
|
81
81
|
# Builds the object from hash
|
@@ -140,7 +140,7 @@ module Algolia
|
|
140
140
|
end
|
141
141
|
else # model
|
142
142
|
# models (e.g. Pet) or oneOf
|
143
|
-
klass = Algolia::
|
143
|
+
klass = Algolia::Ingestion.const_get(type)
|
144
144
|
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
145
145
|
end
|
146
146
|
end
|
@@ -0,0 +1,258 @@
|
|
1
|
+
# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'time'
|
5
|
+
|
6
|
+
module Algolia
|
7
|
+
module Ingestion
|
8
|
+
class SourceUpdateShopify
|
9
|
+
# Whether to index collection IDs. If your store has `has_collection_search_page` set to true, collection IDs will be indexed even if `collectionIDIndexing` is false.
|
10
|
+
attr_accessor :collection_id_indexing
|
11
|
+
|
12
|
+
# Whether to increase the number of indexed collections per product. If true, Algolia indexes 200 collections per product. If false, 100 collections per product are indexed.
|
13
|
+
attr_accessor :increase_product_collection_limit
|
14
|
+
|
15
|
+
# Whether to set the default price ratio to 1 if no sale price is present. The price ratio is determined by the ratio: `sale_price` / `regular_price`. If no sale price is present, the price ratio would be 0. If `defaultPriceRatioAsOne` is true, the price ratio is indexed as 1 instead.
|
16
|
+
attr_accessor :default_price_ratio_as_one
|
17
|
+
|
18
|
+
# Whether to exclude out-of-stock variants when determining the `max_variant_price` and `min_variant_price` attributes.
|
19
|
+
attr_accessor :exclude_oos_variants_for_price_at_trs
|
20
|
+
|
21
|
+
# Whether to include an inventory with every variant for every product record.
|
22
|
+
attr_accessor :include_variants_inventory
|
23
|
+
|
24
|
+
# Whether to include collection IDs and handles in the product records.
|
25
|
+
attr_accessor :has_collection_search_page
|
26
|
+
|
27
|
+
# Whether to convert tags on products to named tags. To learn more, see [Named tags](https://www.algolia.com/doc/integration/shopify/sending-and-managing-data/named-tags).
|
28
|
+
attr_accessor :product_named_tags
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:collection_id_indexing => :collectionIDIndexing,
|
34
|
+
:increase_product_collection_limit => :increaseProductCollectionLimit,
|
35
|
+
:default_price_ratio_as_one => :defaultPriceRatioAsOne,
|
36
|
+
:exclude_oos_variants_for_price_at_trs => :excludeOOSVariantsForPriceAtTRS,
|
37
|
+
:include_variants_inventory => :includeVariantsInventory,
|
38
|
+
:has_collection_search_page => :hasCollectionSearchPage,
|
39
|
+
:product_named_tags => :productNamedTags
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Returns all the JSON keys this model knows about
|
44
|
+
def self.acceptable_attributes
|
45
|
+
attribute_map.values
|
46
|
+
end
|
47
|
+
|
48
|
+
# Attribute type mapping.
|
49
|
+
def self.types_mapping
|
50
|
+
{
|
51
|
+
:collection_id_indexing => :Boolean,
|
52
|
+
:increase_product_collection_limit => :Boolean,
|
53
|
+
:default_price_ratio_as_one => :Boolean,
|
54
|
+
:exclude_oos_variants_for_price_at_trs => :Boolean,
|
55
|
+
:include_variants_inventory => :Boolean,
|
56
|
+
:has_collection_search_page => :Boolean,
|
57
|
+
:product_named_tags => :Boolean
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# List of attributes with nullable: true
|
62
|
+
def self.openapi_nullable
|
63
|
+
Set.new([])
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
unless attributes.is_a?(Hash)
|
70
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::SourceUpdateShopify` initialize method"
|
71
|
+
end
|
72
|
+
|
73
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
74
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
75
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
76
|
+
raise ArgumentError,
|
77
|
+
"`#{k}` is not a valid attribute in `Algolia::SourceUpdateShopify`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
78
|
+
end
|
79
|
+
|
80
|
+
h[k.to_sym] = v
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:collection_id_indexing)
|
84
|
+
self.collection_id_indexing = attributes[:collection_id_indexing]
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:increase_product_collection_limit)
|
88
|
+
self.increase_product_collection_limit = attributes[:increase_product_collection_limit]
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:default_price_ratio_as_one)
|
92
|
+
self.default_price_ratio_as_one = attributes[:default_price_ratio_as_one]
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:exclude_oos_variants_for_price_at_trs)
|
96
|
+
self.exclude_oos_variants_for_price_at_trs = attributes[:exclude_oos_variants_for_price_at_trs]
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:include_variants_inventory)
|
100
|
+
self.include_variants_inventory = attributes[:include_variants_inventory]
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:has_collection_search_page)
|
104
|
+
self.has_collection_search_page = attributes[:has_collection_search_page]
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:product_named_tags)
|
108
|
+
self.product_named_tags = attributes[:product_named_tags]
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# Checks equality by comparing each attribute.
|
113
|
+
# @param [Object] Object to be compared
|
114
|
+
def ==(other)
|
115
|
+
return true if equal?(other)
|
116
|
+
|
117
|
+
self.class == other.class &&
|
118
|
+
collection_id_indexing == other.collection_id_indexing &&
|
119
|
+
increase_product_collection_limit == other.increase_product_collection_limit &&
|
120
|
+
default_price_ratio_as_one == other.default_price_ratio_as_one &&
|
121
|
+
exclude_oos_variants_for_price_at_trs == other.exclude_oos_variants_for_price_at_trs &&
|
122
|
+
include_variants_inventory == other.include_variants_inventory &&
|
123
|
+
has_collection_search_page == other.has_collection_search_page &&
|
124
|
+
product_named_tags == other.product_named_tags
|
125
|
+
end
|
126
|
+
|
127
|
+
# @see the `==` method
|
128
|
+
# @param [Object] Object to be compared
|
129
|
+
def eql?(other)
|
130
|
+
self == other
|
131
|
+
end
|
132
|
+
|
133
|
+
# Calculates hash code according to all attributes.
|
134
|
+
# @return [Integer] Hash code
|
135
|
+
def hash
|
136
|
+
[collection_id_indexing, increase_product_collection_limit, default_price_ratio_as_one, exclude_oos_variants_for_price_at_trs, include_variants_inventory,
|
137
|
+
has_collection_search_page, product_named_tags].hash
|
138
|
+
end
|
139
|
+
|
140
|
+
# Builds the object from hash
|
141
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
142
|
+
# @return [Object] Returns the model itself
|
143
|
+
def self.build_from_hash(attributes)
|
144
|
+
return nil unless attributes.is_a?(Hash)
|
145
|
+
|
146
|
+
attributes = attributes.transform_keys(&:to_sym)
|
147
|
+
transformed_hash = {}
|
148
|
+
types_mapping.each_pair do |key, type|
|
149
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
150
|
+
transformed_hash[key.to_sym] = nil
|
151
|
+
elsif type =~ /\AArray<(.*)>/i
|
152
|
+
# check to ensure the input is an array given that the attribute
|
153
|
+
# is documented as an array but the input is not
|
154
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
155
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
156
|
+
end
|
157
|
+
elsif !attributes[attribute_map[key]].nil?
|
158
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
159
|
+
end
|
160
|
+
end
|
161
|
+
new(transformed_hash)
|
162
|
+
end
|
163
|
+
|
164
|
+
# Deserializes the data based on type
|
165
|
+
# @param string type Data type
|
166
|
+
# @param string value Value to be deserialized
|
167
|
+
# @return [Object] Deserialized data
|
168
|
+
def self._deserialize(type, value)
|
169
|
+
case type.to_sym
|
170
|
+
when :Time
|
171
|
+
Time.parse(value)
|
172
|
+
when :Date
|
173
|
+
Date.parse(value)
|
174
|
+
when :String
|
175
|
+
value.to_s
|
176
|
+
when :Integer
|
177
|
+
value.to_i
|
178
|
+
when :Float
|
179
|
+
value.to_f
|
180
|
+
when :Boolean
|
181
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
182
|
+
true
|
183
|
+
else
|
184
|
+
false
|
185
|
+
end
|
186
|
+
when :Object
|
187
|
+
# generic object (usually a Hash), return directly
|
188
|
+
value
|
189
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
190
|
+
inner_type = Regexp.last_match[:inner_type]
|
191
|
+
value.map { |v| _deserialize(inner_type, v) }
|
192
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
193
|
+
k_type = Regexp.last_match[:k_type]
|
194
|
+
v_type = Regexp.last_match[:v_type]
|
195
|
+
{}.tap do |hash|
|
196
|
+
value.each do |k, v|
|
197
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
else # model
|
201
|
+
# models (e.g. Pet) or oneOf
|
202
|
+
klass = Algolia::Ingestion.const_get(type)
|
203
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# Returns the string representation of the object
|
208
|
+
# @return [String] String presentation of the object
|
209
|
+
def to_s
|
210
|
+
to_hash.to_s
|
211
|
+
end
|
212
|
+
|
213
|
+
# to_body is an alias to to_hash (backward compatibility)
|
214
|
+
# @return [Hash] Returns the object in the form of hash
|
215
|
+
def to_body
|
216
|
+
to_hash
|
217
|
+
end
|
218
|
+
|
219
|
+
def to_json(*_args)
|
220
|
+
to_hash.to_json
|
221
|
+
end
|
222
|
+
|
223
|
+
# Returns the object in the form of hash
|
224
|
+
# @return [Hash] Returns the object in the form of hash
|
225
|
+
def to_hash
|
226
|
+
hash = {}
|
227
|
+
self.class.attribute_map.each_pair do |attr, param|
|
228
|
+
value = send(attr)
|
229
|
+
if value.nil?
|
230
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
231
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
232
|
+
end
|
233
|
+
|
234
|
+
hash[param] = _to_hash(value)
|
235
|
+
end
|
236
|
+
hash
|
237
|
+
end
|
238
|
+
|
239
|
+
# Outputs non-array value in the form of hash
|
240
|
+
# For object, use to_hash. Otherwise, just return the value
|
241
|
+
# @param [Object] value Any valid value
|
242
|
+
# @return [Hash] Returns the value in the form of hash
|
243
|
+
def _to_hash(value)
|
244
|
+
if value.is_a?(Array)
|
245
|
+
value.compact.map { |v| _to_hash(v) }
|
246
|
+
elsif value.is_a?(Hash)
|
247
|
+
{}.tap do |hash|
|
248
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
249
|
+
end
|
250
|
+
elsif value.respond_to? :to_hash
|
251
|
+
value.to_hash
|
252
|
+
else
|
253
|
+
value
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
@@ -14,7 +14,7 @@ module Algolia
|
|
14
14
|
|
15
15
|
attr_accessor :event_subtype
|
16
16
|
|
17
|
-
# Index name to which the event's items belong.
|
17
|
+
# Index name (case-sensitive) to which the event's items belong.
|
18
18
|
attr_accessor :index
|
19
19
|
|
20
20
|
# Object IDs of the records that are part of the event.
|
@@ -32,7 +32,7 @@ module Algolia
|
|
32
32
|
# Extra information about the records involved in a purchase or add-to-cart event. If specified, it must have the same length as `objectIDs`.
|
33
33
|
attr_accessor :object_data
|
34
34
|
|
35
|
-
# Timestamp of the event in milliseconds
|
35
|
+
# Timestamp of the event, measured in milliseconds since the Unix epoch. By default, the Insights API uses the time it receives an event as its timestamp.
|
36
36
|
attr_accessor :timestamp
|
37
37
|
|
38
38
|
attr_accessor :value
|
@@ -14,7 +14,7 @@ module Algolia
|
|
14
14
|
|
15
15
|
attr_accessor :event_subtype
|
16
16
|
|
17
|
-
# Index name to which the event's items belong.
|
17
|
+
# Index name (case-sensitive) to which the event's items belong.
|
18
18
|
attr_accessor :index
|
19
19
|
|
20
20
|
# Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response.
|
@@ -35,7 +35,7 @@ module Algolia
|
|
35
35
|
# Extra information about the records involved in a purchase or add-to-cart events. If provided, it must be the same length as `objectIDs`.
|
36
36
|
attr_accessor :object_data
|
37
37
|
|
38
|
-
# Timestamp of the event in milliseconds
|
38
|
+
# Timestamp of the event, measured in milliseconds since the Unix epoch. By default, the Insights API uses the time it receives an event as its timestamp.
|
39
39
|
attr_accessor :timestamp
|
40
40
|
|
41
41
|
attr_accessor :value
|