algolia 3.0.0.alpha.11 → 3.0.0.alpha.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +1 -0
  3. data/CHANGELOG.md +10 -0
  4. data/Gemfile.lock +5 -5
  5. data/lib/algolia/api/abtesting_client.rb +8 -4
  6. data/lib/algolia/api/analytics_client.rb +146 -282
  7. data/lib/algolia/api/ingestion_client.rb +4 -4
  8. data/lib/algolia/api/insights_client.rb +7 -7
  9. data/lib/algolia/api/recommend_client.rb +12 -12
  10. data/lib/algolia/api/search_client.rb +242 -242
  11. data/lib/algolia/models/abtesting/ab_test_response.rb +1 -1
  12. data/lib/algolia/models/analytics/search_no_result_event.rb +1 -1
  13. data/lib/algolia/models/analytics/top_search.rb +1 -1
  14. data/lib/algolia/models/analytics/top_search_with_analytics.rb +1 -1
  15. data/lib/algolia/models/ingestion/action_type.rb +2 -1
  16. data/lib/algolia/models/ingestion/mapping_field_directive.rb +214 -0
  17. data/lib/algolia/models/ingestion/mapping_input.rb +213 -0
  18. data/lib/algolia/models/ingestion/mapping_kit_action.rb +235 -0
  19. data/lib/algolia/models/ingestion/on_demand_date_utils_input.rb +13 -4
  20. data/lib/algolia/models/ingestion/schedule_date_utils_input.rb +13 -4
  21. data/lib/algolia/models/ingestion/source_ga4_big_query_export.rb +223 -0
  22. data/lib/algolia/models/ingestion/source_input.rb +1 -0
  23. data/lib/algolia/models/ingestion/source_type.rb +2 -1
  24. data/lib/algolia/models/ingestion/source_update_input.rb +1 -0
  25. data/lib/algolia/models/ingestion/streaming_trigger.rb +221 -0
  26. data/lib/algolia/models/ingestion/streaming_trigger_type.rb +32 -0
  27. data/lib/algolia/models/ingestion/streaming_utils_input.rb +199 -0
  28. data/lib/algolia/models/ingestion/task_create_trigger.rb +1 -0
  29. data/lib/algolia/models/ingestion/task_input.rb +2 -1
  30. data/lib/algolia/models/ingestion/trigger.rb +1 -0
  31. data/lib/algolia/models/ingestion/trigger_type.rb +2 -1
  32. data/lib/algolia/models/insights/added_to_cart_object_ids.rb +6 -6
  33. data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +6 -6
  34. data/lib/algolia/models/insights/clicked_filters.rb +6 -6
  35. data/lib/algolia/models/insights/clicked_object_ids.rb +6 -6
  36. data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +7 -7
  37. data/lib/algolia/models/insights/converted_filters.rb +6 -6
  38. data/lib/algolia/models/insights/converted_object_ids.rb +6 -6
  39. data/lib/algolia/models/insights/converted_object_ids_after_search.rb +6 -6
  40. data/lib/algolia/models/insights/discount.rb +1 -1
  41. data/lib/algolia/models/insights/insights_events.rb +1 -1
  42. data/lib/algolia/models/insights/object_data.rb +1 -1
  43. data/lib/algolia/models/insights/object_data_after_search.rb +1 -1
  44. data/lib/algolia/models/insights/price.rb +1 -1
  45. data/lib/algolia/models/insights/purchased_object_ids.rb +6 -6
  46. data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +6 -6
  47. data/lib/algolia/models/insights/viewed_filters.rb +6 -6
  48. data/lib/algolia/models/insights/viewed_object_ids.rb +6 -6
  49. data/lib/algolia/models/recommend/around_precision.rb +1 -1
  50. data/lib/algolia/models/recommend/around_precision_from_value_inner.rb +3 -0
  51. data/lib/algolia/models/recommend/around_radius.rb +1 -1
  52. data/lib/algolia/models/recommend/automatic_facet_filter.rb +4 -4
  53. data/lib/algolia/models/recommend/automatic_facet_filters.rb +1 -1
  54. data/lib/algolia/models/recommend/base_recommend_request.rb +1 -1
  55. data/lib/algolia/models/recommend/base_recommendations_query.rb +1 -1
  56. data/lib/algolia/models/recommend/base_recommended_for_you_query_parameters.rb +1 -1
  57. data/lib/algolia/models/recommend/base_search_params.rb +58 -38
  58. data/lib/algolia/models/recommend/base_search_params_without_query.rb +57 -37
  59. data/lib/algolia/models/recommend/base_search_response.rb +20 -6
  60. data/lib/algolia/models/recommend/condition.rb +32 -7
  61. data/lib/algolia/models/recommend/consequence.rb +33 -5
  62. data/lib/algolia/models/recommend/consequence_hide.rb +2 -2
  63. data/lib/algolia/models/recommend/consequence_params.rb +101 -79
  64. data/lib/algolia/models/recommend/consequence_query.rb +1 -1
  65. data/lib/algolia/models/recommend/consequence_query_object.rb +2 -2
  66. data/lib/algolia/models/recommend/deleted_at_response.rb +1 -1
  67. data/lib/algolia/models/recommend/distinct.rb +1 -1
  68. data/lib/algolia/models/recommend/edit.rb +1 -1
  69. data/lib/algolia/models/recommend/facet_filters.rb +1 -1
  70. data/lib/algolia/models/recommend/facet_ordering.rb +2 -2
  71. data/lib/algolia/models/recommend/facets.rb +2 -2
  72. data/lib/algolia/models/recommend/highlight_result_option.rb +3 -3
  73. data/lib/algolia/models/recommend/ignore_plurals.rb +1 -1
  74. data/lib/algolia/models/recommend/index_settings_as_search_params.rb +46 -44
  75. data/lib/algolia/models/recommend/numeric_filters.rb +1 -1
  76. data/lib/algolia/models/recommend/optional_filters.rb +1 -1
  77. data/lib/algolia/models/recommend/params.rb +1 -1
  78. data/lib/algolia/models/recommend/promote_object_id.rb +2 -2
  79. data/lib/algolia/models/recommend/promote_object_ids.rb +16 -2
  80. data/lib/algolia/models/recommend/ranking_info.rb +120 -7
  81. data/lib/algolia/models/recommend/re_ranking_apply_filter.rb +1 -1
  82. data/lib/algolia/models/recommend/recommend_hit.rb +3 -3
  83. data/lib/algolia/models/recommend/recommendations_hits.rb +1 -1
  84. data/lib/algolia/models/recommend/recommendations_query.rb +2 -2
  85. data/lib/algolia/models/recommend/recommendations_results.rb +21 -7
  86. data/lib/algolia/models/recommend/recommended_for_you_query.rb +1 -1
  87. data/lib/algolia/models/recommend/recommended_for_you_query_parameters.rb +102 -80
  88. data/lib/algolia/models/recommend/remove_stop_words.rb +1 -1
  89. data/lib/algolia/models/recommend/rendering_content.rb +1 -1
  90. data/lib/algolia/models/recommend/search_params_object.rb +102 -80
  91. data/lib/algolia/models/recommend/search_params_query.rb +1 -1
  92. data/lib/algolia/models/recommend/search_recommend_rules_params.rb +2 -2
  93. data/lib/algolia/models/recommend/search_recommend_rules_response.rb +17 -3
  94. data/lib/algolia/models/recommend/semantic_search.rb +2 -2
  95. data/lib/algolia/models/recommend/snippet_result_option.rb +2 -2
  96. data/lib/algolia/models/recommend/tag_filters.rb +1 -1
  97. data/lib/algolia/models/recommend/trending_facets_query.rb +1 -1
  98. data/lib/algolia/models/recommend/trending_items_query.rb +1 -1
  99. data/lib/algolia/models/recommend/typo_tolerance.rb +1 -1
  100. data/lib/algolia/models/recommend/value.rb +1 -1
  101. data/lib/algolia/models/search/add_api_key_response.rb +1 -1
  102. data/lib/algolia/models/search/api_key.rb +8 -8
  103. data/lib/algolia/models/search/around_precision.rb +1 -1
  104. data/lib/algolia/models/search/around_precision_from_value_inner.rb +3 -0
  105. data/lib/algolia/models/search/around_radius.rb +1 -1
  106. data/lib/algolia/models/search/automatic_facet_filter.rb +4 -4
  107. data/lib/algolia/models/search/automatic_facet_filters.rb +1 -1
  108. data/lib/algolia/models/search/base_index_settings.rb +44 -18
  109. data/lib/algolia/models/search/base_search_params.rb +58 -38
  110. data/lib/algolia/models/search/base_search_params_without_query.rb +57 -37
  111. data/lib/algolia/models/search/base_search_response.rb +20 -6
  112. data/lib/algolia/models/search/batch_dictionary_entries_params.rb +3 -3
  113. data/lib/algolia/models/search/batch_response.rb +2 -2
  114. data/lib/algolia/models/search/browse_params_object.rb +103 -81
  115. data/lib/algolia/models/search/browse_response.rb +23 -8
  116. data/lib/algolia/models/search/built_in_operation.rb +2 -2
  117. data/lib/algolia/models/search/condition.rb +32 -7
  118. data/lib/algolia/models/search/consequence.rb +33 -5
  119. data/lib/algolia/models/search/consequence_hide.rb +2 -2
  120. data/lib/algolia/models/search/consequence_params.rb +101 -79
  121. data/lib/algolia/models/search/consequence_query.rb +1 -1
  122. data/lib/algolia/models/search/consequence_query_object.rb +2 -2
  123. data/lib/algolia/models/search/created_at_response.rb +1 -1
  124. data/lib/algolia/models/search/cursor.rb +1 -1
  125. data/lib/algolia/models/search/delete_by_params.rb +4 -4
  126. data/lib/algolia/models/search/deleted_at_response.rb +1 -1
  127. data/lib/algolia/models/search/dictionary_entry.rb +5 -5
  128. data/lib/algolia/models/search/dictionary_language.rb +2 -2
  129. data/lib/algolia/models/search/dictionary_settings_params.rb +1 -1
  130. data/lib/algolia/models/search/distinct.rb +1 -1
  131. data/lib/algolia/models/search/edit.rb +1 -1
  132. data/lib/algolia/models/search/facet_filters.rb +1 -1
  133. data/lib/algolia/models/search/facet_hits.rb +2 -2
  134. data/lib/algolia/models/search/facet_ordering.rb +2 -2
  135. data/lib/algolia/models/search/facets.rb +2 -2
  136. data/lib/algolia/models/search/get_api_key_response.rb +8 -8
  137. data/lib/algolia/models/search/get_objects_request.rb +3 -3
  138. data/lib/algolia/models/search/get_objects_response.rb +1 -1
  139. data/lib/algolia/models/search/has_pending_mappings_response.rb +1 -1
  140. data/lib/algolia/models/search/highlight_result_option.rb +3 -3
  141. data/lib/algolia/models/search/hit.rb +4 -4
  142. data/lib/algolia/models/search/ignore_plurals.rb +1 -1
  143. data/lib/algolia/models/search/index_settings.rb +89 -61
  144. data/lib/algolia/models/search/index_settings_as_search_params.rb +46 -44
  145. data/lib/algolia/models/search/log.rb +39 -11
  146. data/lib/algolia/models/search/log_query.rb +1 -1
  147. data/lib/algolia/models/search/multiple_batch_response.rb +2 -2
  148. data/lib/algolia/models/search/numeric_filters.rb +1 -1
  149. data/lib/algolia/models/search/operation_index_params.rb +2 -2
  150. data/lib/algolia/models/search/optional_filters.rb +1 -1
  151. data/lib/algolia/models/search/params.rb +1 -1
  152. data/lib/algolia/models/search/promote_object_id.rb +2 -2
  153. data/lib/algolia/models/search/promote_object_ids.rb +16 -2
  154. data/lib/algolia/models/search/ranking_info.rb +120 -7
  155. data/lib/algolia/models/search/re_ranking_apply_filter.rb +1 -1
  156. data/lib/algolia/models/search/remove_stop_words.rb +1 -1
  157. data/lib/algolia/models/search/rendering_content.rb +1 -1
  158. data/lib/algolia/models/search/rule.rb +23 -5
  159. data/lib/algolia/models/search/save_object_response.rb +3 -3
  160. data/lib/algolia/models/search/save_synonym_response.rb +1 -1
  161. data/lib/algolia/models/search/search_dictionary_entries_params.rb +18 -4
  162. data/lib/algolia/models/search/search_dictionary_entries_response.rb +251 -0
  163. data/lib/algolia/models/search/search_for_facet_values_request.rb +1 -1
  164. data/lib/algolia/models/search/search_for_facet_values_response.rb +1 -0
  165. data/lib/algolia/models/search/search_for_facets.rb +103 -81
  166. data/lib/algolia/models/search/search_for_facets_options.rb +2 -2
  167. data/lib/algolia/models/search/search_for_hits.rb +103 -81
  168. data/lib/algolia/models/search/search_for_hits_options.rb +1 -1
  169. data/lib/algolia/models/search/search_hits.rb +2 -1
  170. data/lib/algolia/models/search/search_params_object.rb +102 -80
  171. data/lib/algolia/models/search/search_params_query.rb +1 -1
  172. data/lib/algolia/models/search/search_response.rb +22 -7
  173. data/lib/algolia/models/search/search_rules_params.rb +8 -20
  174. data/lib/algolia/models/search/search_rules_response.rb +2 -2
  175. data/lib/algolia/models/search/search_synonyms_params.rb +16 -2
  176. data/lib/algolia/models/search/search_synonyms_response.rb +2 -2
  177. data/lib/algolia/models/search/search_user_ids_params.rb +15 -1
  178. data/lib/algolia/models/search/search_user_ids_response.rb +16 -2
  179. data/lib/algolia/models/search/secured_api_key_restrictions.rb +5 -5
  180. data/lib/algolia/models/search/semantic_search.rb +2 -2
  181. data/lib/algolia/models/search/snippet_result_option.rb +2 -2
  182. data/lib/algolia/models/search/tag_filters.rb +1 -1
  183. data/lib/algolia/models/search/time_range.rb +2 -2
  184. data/lib/algolia/models/search/typo_tolerance.rb +1 -1
  185. data/lib/algolia/models/search/updated_at_response.rb +1 -1
  186. data/lib/algolia/models/search/updated_at_with_object_id_response.rb +2 -2
  187. data/lib/algolia/models/search/updated_rule_response.rb +2 -2
  188. data/lib/algolia/models/search/user_hit.rb +1 -1
  189. data/lib/algolia/models/search/user_id.rb +1 -1
  190. data/lib/algolia/models/search/value.rb +1 -1
  191. data/lib/algolia/version.rb +1 -1
  192. metadata +10 -2
@@ -0,0 +1,235 @@
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
+ # Describes how a destination object should be resolved by means of applying a set of directives.
9
+ class MappingKitAction
10
+ # ID to uniquely identify this action.
11
+ attr_accessor :id
12
+
13
+ # Whether this action has any effect.
14
+ attr_accessor :enabled
15
+
16
+ # Condition which must be satisfied to apply the action. If this evaluates to false, the action is not applied, and the process attempts to apply the next action, if any.
17
+ attr_accessor :trigger
18
+
19
+ attr_accessor :field_directives
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :id => :id,
25
+ :enabled => :enabled,
26
+ :trigger => :trigger,
27
+ :field_directives => :fieldDirectives
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.types_mapping
38
+ {
39
+ :id => :String,
40
+ :enabled => :Boolean,
41
+ :trigger => :String,
42
+ :field_directives => :'Array<MappingFieldDirective>'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ unless attributes.is_a?(Hash)
55
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::MappingKitAction` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) do |(k, v), h|
60
+ unless self.class.attribute_map.key?(k.to_sym)
61
+ raise ArgumentError,
62
+ "`#{k}` is not a valid attribute in `Algolia::MappingKitAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+
65
+ h[k.to_sym] = v
66
+ end
67
+
68
+ if attributes.key?(:id)
69
+ self.id = attributes[:id]
70
+ end
71
+
72
+ if attributes.key?(:enabled)
73
+ self.enabled = attributes[:enabled]
74
+ else
75
+ self.enabled = nil
76
+ end
77
+
78
+ if attributes.key?(:trigger)
79
+ self.trigger = attributes[:trigger]
80
+ else
81
+ self.trigger = nil
82
+ end
83
+
84
+ if attributes.key?(:field_directives)
85
+ if (value = attributes[:field_directives]).is_a?(Array)
86
+ self.field_directives = value
87
+ end
88
+ else
89
+ self.field_directives = nil
90
+ end
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(other)
96
+ return true if equal?(other)
97
+
98
+ self.class == other.class &&
99
+ id == other.id &&
100
+ enabled == other.enabled &&
101
+ trigger == other.trigger &&
102
+ field_directives == other.field_directives
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(other)
108
+ self == other
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [id, enabled, trigger, field_directives].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+
123
+ attributes = attributes.transform_keys(&:to_sym)
124
+ transformed_hash = {}
125
+ types_mapping.each_pair do |key, type|
126
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
127
+ transformed_hash[key.to_sym] = nil
128
+ elsif type =~ /\AArray<(.*)>/i
129
+ # check to ensure the input is an array given that the attribute
130
+ # is documented as an array but the input is not
131
+ if attributes[attribute_map[key]].is_a?(Array)
132
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
133
+ end
134
+ elsif !attributes[attribute_map[key]].nil?
135
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
136
+ end
137
+ end
138
+ new(transformed_hash)
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def self._deserialize(type, value)
146
+ case type.to_sym
147
+ when :Time
148
+ Time.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :Boolean
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ # models (e.g. Pet) or oneOf
179
+ klass = Algolia::Ingestion.const_get(type)
180
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ def to_json(*_args)
197
+ to_hash.to_json
198
+ end
199
+
200
+ # Returns the object in the form of hash
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_hash
203
+ hash = {}
204
+ self.class.attribute_map.each_pair do |attr, param|
205
+ value = send(attr)
206
+ if value.nil?
207
+ is_nullable = self.class.openapi_nullable.include?(attr)
208
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
209
+ end
210
+
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+ end
234
+ end
235
+ end
@@ -13,11 +13,14 @@ module Algolia
13
13
  # The end date of the extraction (RFC3339 format).
14
14
  attr_accessor :end_date
15
15
 
16
+ attr_accessor :mapping
17
+
16
18
  # Attribute mapping from ruby-style variable name to JSON key.
17
19
  def self.attribute_map
18
20
  {
19
21
  :start_date => :startDate,
20
- :end_date => :endDate
22
+ :end_date => :endDate,
23
+ :mapping => :mapping
21
24
  }
22
25
  end
23
26
 
@@ -30,7 +33,8 @@ module Algolia
30
33
  def self.types_mapping
31
34
  {
32
35
  :start_date => :String,
33
- :end_date => :String
36
+ :end_date => :String,
37
+ :mapping => :MappingInput
34
38
  }
35
39
  end
36
40
 
@@ -67,6 +71,10 @@ module Algolia
67
71
  else
68
72
  self.end_date = nil
69
73
  end
74
+
75
+ if attributes.key?(:mapping)
76
+ self.mapping = attributes[:mapping]
77
+ end
70
78
  end
71
79
 
72
80
  # Checks equality by comparing each attribute.
@@ -76,7 +84,8 @@ module Algolia
76
84
 
77
85
  self.class == other.class &&
78
86
  start_date == other.start_date &&
79
- end_date == other.end_date
87
+ end_date == other.end_date &&
88
+ mapping == other.mapping
80
89
  end
81
90
 
82
91
  # @see the `==` method
@@ -88,7 +97,7 @@ module Algolia
88
97
  # Calculates hash code according to all attributes.
89
98
  # @return [Integer] Hash code
90
99
  def hash
91
- [start_date, end_date].hash
100
+ [start_date, end_date, mapping].hash
92
101
  end
93
102
 
94
103
  # Builds the object from hash
@@ -10,10 +10,13 @@ module Algolia
10
10
  # The timeframe of the extraction, in number of days from today.
11
11
  attr_accessor :timeframe
12
12
 
13
+ attr_accessor :mapping
14
+
13
15
  # Attribute mapping from ruby-style variable name to JSON key.
14
16
  def self.attribute_map
15
17
  {
16
- :timeframe => :timeframe
18
+ :timeframe => :timeframe,
19
+ :mapping => :mapping
17
20
  }
18
21
  end
19
22
 
@@ -25,7 +28,8 @@ module Algolia
25
28
  # Attribute type mapping.
26
29
  def self.types_mapping
27
30
  {
28
- :timeframe => :Integer
31
+ :timeframe => :Integer,
32
+ :mapping => :MappingInput
29
33
  }
30
34
  end
31
35
 
@@ -56,6 +60,10 @@ module Algolia
56
60
  else
57
61
  self.timeframe = nil
58
62
  end
63
+
64
+ if attributes.key?(:mapping)
65
+ self.mapping = attributes[:mapping]
66
+ end
59
67
  end
60
68
 
61
69
  # Custom attribute writer method with validation
@@ -82,7 +90,8 @@ module Algolia
82
90
  return true if equal?(other)
83
91
 
84
92
  self.class == other.class &&
85
- timeframe == other.timeframe
93
+ timeframe == other.timeframe &&
94
+ mapping == other.mapping
86
95
  end
87
96
 
88
97
  # @see the `==` method
@@ -94,7 +103,7 @@ module Algolia
94
103
  # Calculates hash code according to all attributes.
95
104
  # @return [Integer] Hash code
96
105
  def hash
97
- [timeframe].hash
106
+ [timeframe, mapping].hash
98
107
  end
99
108
 
100
109
  # Builds the object from hash
@@ -0,0 +1,223 @@
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 SourceGA4BigQueryExport
9
+ # GCP project ID that the BigQuery Export writes to.
10
+ attr_accessor :project_id
11
+
12
+ # BigQuery dataset ID that the BigQuery Export writes to.
13
+ attr_accessor :dataset_id
14
+
15
+ # Prefix of the tables that the BigQuery Export writes to (i.e. events_intraday_ for streaming, events_ for daily).
16
+ attr_accessor :table_prefix
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :project_id => :projectID,
22
+ :dataset_id => :datasetID,
23
+ :table_prefix => :tablePrefix
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.types_mapping
34
+ {
35
+ :project_id => :String,
36
+ :dataset_id => :String,
37
+ :table_prefix => :String
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ unless attributes.is_a?(Hash)
50
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::SourceGA4BigQueryExport` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) do |(k, v), h|
55
+ unless self.class.attribute_map.key?(k.to_sym)
56
+ raise ArgumentError,
57
+ "`#{k}` is not a valid attribute in `Algolia::SourceGA4BigQueryExport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+
60
+ h[k.to_sym] = v
61
+ end
62
+
63
+ if attributes.key?(:project_id)
64
+ self.project_id = attributes[:project_id]
65
+ else
66
+ self.project_id = nil
67
+ end
68
+
69
+ if attributes.key?(:dataset_id)
70
+ self.dataset_id = attributes[:dataset_id]
71
+ else
72
+ self.dataset_id = nil
73
+ end
74
+
75
+ if attributes.key?(:table_prefix)
76
+ self.table_prefix = attributes[:table_prefix]
77
+ else
78
+ self.table_prefix = nil
79
+ end
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(other)
85
+ return true if equal?(other)
86
+
87
+ self.class == other.class &&
88
+ project_id == other.project_id &&
89
+ dataset_id == other.dataset_id &&
90
+ table_prefix == other.table_prefix
91
+ end
92
+
93
+ # @see the `==` method
94
+ # @param [Object] Object to be compared
95
+ def eql?(other)
96
+ self == other
97
+ end
98
+
99
+ # Calculates hash code according to all attributes.
100
+ # @return [Integer] Hash code
101
+ def hash
102
+ [project_id, dataset_id, table_prefix].hash
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def self.build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+
111
+ attributes = attributes.transform_keys(&:to_sym)
112
+ transformed_hash = {}
113
+ types_mapping.each_pair do |key, type|
114
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
115
+ transformed_hash[key.to_sym] = nil
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[attribute_map[key]].is_a?(Array)
120
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
121
+ end
122
+ elsif !attributes[attribute_map[key]].nil?
123
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
124
+ end
125
+ end
126
+ new(transformed_hash)
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def self._deserialize(type, value)
134
+ case type.to_sym
135
+ when :Time
136
+ Time.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :Boolean
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ # models (e.g. Pet) or oneOf
167
+ klass = Algolia::Ingestion.const_get(type)
168
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ def to_json(*_args)
185
+ to_hash.to_json
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = send(attr)
194
+ if value.nil?
195
+ is_nullable = self.class.openapi_nullable.include?(attr)
196
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
197
+ end
198
+
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+ end
222
+ end
223
+ end
@@ -15,6 +15,7 @@ module Algolia
15
15
  :SourceCSV,
16
16
  :SourceCommercetools,
17
17
  :SourceDocker,
18
+ :SourceGA4BigQueryExport,
18
19
  :SourceJSON
19
20
  ]
20
21
  end
@@ -12,9 +12,10 @@ module Algolia
12
12
  CSV = "csv".freeze
13
13
  BIGQUERY = "bigquery".freeze
14
14
  DOCKER = "docker".freeze
15
+ GA4_BIGQUERY_EXPORT = "ga4BigqueryExport".freeze
15
16
 
16
17
  def self.all_vars
17
- @all_vars ||= [BIGCOMMERCE, COMMERCETOOLS, JSON, CSV, BIGQUERY, DOCKER].freeze
18
+ @all_vars ||= [BIGCOMMERCE, COMMERCETOOLS, JSON, CSV, BIGQUERY, DOCKER, GA4_BIGQUERY_EXPORT].freeze
18
19
  end
19
20
 
20
21
  # Builds the enum from string
@@ -12,6 +12,7 @@ module Algolia
12
12
  [
13
13
  :SourceBigQuery,
14
14
  :SourceCSV,
15
+ :SourceGA4BigQueryExport,
15
16
  :SourceJSON,
16
17
  :SourceUpdateCommercetools,
17
18
  :SourceUpdateDocker