algolia 3.0.0.beta.10 → 3.0.0.beta.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/Gemfile.lock +2 -2
  4. data/lib/algolia/api/ingestion_client.rb +912 -359
  5. data/lib/algolia/api/query_suggestions_client.rb +4 -10
  6. data/lib/algolia/api/search_client.rb +4 -4
  7. data/lib/algolia/api/usage_client.rb +4 -4
  8. data/lib/algolia/error.rb +10 -0
  9. data/lib/algolia/logger_helper.rb +11 -2
  10. data/lib/algolia/models/abtesting/{filter_effects_empty_search.rb → empty_search_filter.rb} +3 -3
  11. data/lib/algolia/models/abtesting/filter_effects.rb +2 -2
  12. data/lib/algolia/models/abtesting/{filter_effects_outliers.rb → outliers_filter.rb} +3 -3
  13. data/lib/algolia/models/analytics/{click_positions_inner.rb → click_position.rb} +3 -3
  14. data/lib/algolia/models/analytics/get_click_positions_response.rb +1 -1
  15. data/lib/algolia/models/analytics/top_search_with_analytics.rb +1 -1
  16. data/lib/algolia/models/analytics/top_search_with_revenue_analytics.rb +1 -1
  17. data/lib/algolia/models/ingestion/action.rb +45 -0
  18. data/lib/algolia/models/{search/search_for_hits_options.rb → ingestion/batch_request.rb} +22 -20
  19. data/lib/algolia/models/ingestion/{source_shopify_base.rb → batch_write_params.rb} +14 -12
  20. data/lib/algolia/models/ingestion/docker_streams_input.rb +1 -0
  21. data/lib/algolia/models/{recommend/recommendations_hits.rb → ingestion/list_tasks_response_v1.rb} +26 -14
  22. data/lib/algolia/models/ingestion/task.rb +30 -9
  23. data/lib/algolia/models/ingestion/task_create.rb +11 -12
  24. data/lib/algolia/models/{search/search_for_facets_options.rb → ingestion/task_create_v1.rb} +86 -51
  25. data/lib/algolia/models/ingestion/task_update.rb +8 -7
  26. data/lib/algolia/models/{search/browse_pagination.rb → ingestion/task_update_v1.rb} +50 -55
  27. data/lib/algolia/models/{recommend/looking_similar.rb → ingestion/task_v1.rb} +147 -30
  28. data/lib/algolia/models/ingestion/{transformation_try_response_error.rb → transformation_error.rb} +3 -3
  29. data/lib/algolia/models/ingestion/transformation_try_response.rb +1 -1
  30. data/lib/algolia/models/monitoring/{incidents_inner.rb → incident_entry.rb} +3 -3
  31. data/lib/algolia/models/monitoring/{indexing_time_response_metrics.rb → indexing_metric.rb} +3 -3
  32. data/lib/algolia/models/monitoring/indexing_time_response.rb +1 -1
  33. data/lib/algolia/models/monitoring/infrastructure_response.rb +1 -1
  34. data/lib/algolia/models/monitoring/{latency_response_metrics.rb → latency_metric.rb} +3 -3
  35. data/lib/algolia/models/monitoring/latency_response.rb +1 -1
  36. data/lib/algolia/models/monitoring/{infrastructure_response_metrics.rb → metrics.rb} +3 -6
  37. data/lib/algolia/models/monitoring/{time_inner.rb → time_entry.rb} +3 -3
  38. data/lib/algolia/models/{recommend/trending_items.rb → query-suggestions/config_status.rb} +46 -58
  39. data/lib/algolia/models/{recommend/related_products.rb → query-suggestions/log_file.rb} +36 -32
  40. data/lib/algolia/models/recommend/around_precision.rb +1 -1
  41. data/lib/algolia/models/recommend/fallback_params.rb +1 -1
  42. data/lib/algolia/models/recommend/{around_precision_from_value_inner.rb → range.rb} +3 -6
  43. data/lib/algolia/models/recommend/recommend_rule.rb +1 -1
  44. data/lib/algolia/models/recommend/{redirect_rule_index_metadata_data.rb → redirect_rule_index_data.rb} +3 -3
  45. data/lib/algolia/models/recommend/redirect_rule_index_metadata.rb +1 -1
  46. data/lib/algolia/models/recommend/{recommend_rule_metadata.rb → rule_metadata.rb} +3 -3
  47. data/lib/algolia/models/recommend/search_params.rb +1 -1
  48. data/lib/algolia/models/recommend/search_params_object.rb +1 -1
  49. data/lib/algolia/models/search/around_precision.rb +1 -1
  50. data/lib/algolia/models/search/browse_params_object.rb +1 -1
  51. data/lib/algolia/models/search/built_in_operation.rb +1 -2
  52. data/lib/algolia/models/search/built_in_operation_value.rb +105 -0
  53. data/lib/algolia/models/search/consequence_params.rb +1 -1
  54. data/lib/algolia/models/search/dictionary_entry.rb +0 -2
  55. data/lib/algolia/models/search/index_settings.rb +2 -2
  56. data/lib/algolia/models/search/{around_precision_from_value_inner.rb → range.rb} +3 -6
  57. data/lib/algolia/models/search/{redirect_rule_index_metadata_data.rb → redirect_rule_index_data.rb} +3 -3
  58. data/lib/algolia/models/search/redirect_rule_index_metadata.rb +1 -1
  59. data/lib/algolia/models/search/search_for_facets.rb +1 -1
  60. data/lib/algolia/models/search/search_for_hits.rb +1 -1
  61. data/lib/algolia/models/search/search_params_object.rb +1 -1
  62. data/lib/algolia/models/search/search_params_string.rb +1 -0
  63. data/lib/algolia/models/search/{index_settings_as_search_params.rb → settings_response.rb} +251 -11
  64. data/lib/algolia/models/usage/{get_usage400_response_error_errors_inner.rb → error_item.rb} +3 -3
  65. data/lib/algolia/models/usage/{get_usage400_response_error.rb → forbidden_error.rb} +4 -4
  66. data/lib/algolia/models/usage/{get_usage200_response.rb → index_usage.rb} +4 -4
  67. data/lib/algolia/models/usage/invalid_request_error.rb +231 -0
  68. data/lib/algolia/models/usage/{get_usage200_response_statistics_inner.rb → statistic_entry.rb} +3 -3
  69. data/lib/algolia/transport/transport.rb +8 -2
  70. data/lib/algolia/version.rb +1 -1
  71. metadata +32 -63
  72. data/lib/algolia/models/abtesting/custom_search_params.rb +0 -214
  73. data/lib/algolia/models/abtesting/error_base.rb +0 -212
  74. data/lib/algolia/models/analytics/error_base.rb +0 -212
  75. data/lib/algolia/models/ingestion/error_base.rb +0 -212
  76. data/lib/algolia/models/insights/error_base.rb +0 -212
  77. data/lib/algolia/models/monitoring/error_base.rb +0 -212
  78. data/lib/algolia/models/monitoring/get_servers403_response.rb +0 -211
  79. data/lib/algolia/models/personalization/error_base.rb +0 -212
  80. data/lib/algolia/models/query-suggestions/app_id.rb +0 -209
  81. data/lib/algolia/models/query-suggestions/error_base.rb +0 -212
  82. data/lib/algolia/models/recommend/base_recommend_request.rb +0 -281
  83. data/lib/algolia/models/recommend/base_search_params.rb +0 -635
  84. data/lib/algolia/models/recommend/base_search_params_without_query.rb +0 -616
  85. data/lib/algolia/models/recommend/base_search_response.rb +0 -499
  86. data/lib/algolia/models/recommend/error_base.rb +0 -212
  87. data/lib/algolia/models/recommend/frequently_bought_together.rb +0 -247
  88. data/lib/algolia/models/recommend/index_settings_as_search_params.rb +0 -788
  89. data/lib/algolia/models/recommend/recommended_for_you.rb +0 -244
  90. data/lib/algolia/models/recommend/search_pagination.rb +0 -282
  91. data/lib/algolia/models/recommend/search_params_query.rb +0 -212
  92. data/lib/algolia/models/recommend/trending_facets.rb +0 -258
  93. data/lib/algolia/models/search/base_get_api_key_response.rb +0 -224
  94. data/lib/algolia/models/search/base_index_settings.rb +0 -426
  95. data/lib/algolia/models/search/base_search_params.rb +0 -635
  96. data/lib/algolia/models/search/base_search_params_without_query.rb +0 -616
  97. data/lib/algolia/models/search/base_search_response.rb +0 -499
  98. data/lib/algolia/models/search/cursor.rb +0 -209
  99. data/lib/algolia/models/search/error_base.rb +0 -212
  100. data/lib/algolia/models/search/params.rb +0 -236
  101. data/lib/algolia/models/search/search_hits.rb +0 -240
  102. data/lib/algolia/models/search/search_pagination.rb +0 -282
  103. data/lib/algolia/models/search/search_params_query.rb +0 -212
  104. data/lib/algolia/models/usage/error_base.rb +0 -212
  105. data/lib/algolia/models/usage/get_usage400_response.rb +0 -213
@@ -15,7 +15,14 @@ module Algolia
15
15
  # Universally unique identifier (UUID) of a destination resource.
16
16
  attr_accessor :destination_id
17
17
 
18
- attr_accessor :trigger
18
+ # Cron expression for the task's schedule.
19
+ attr_accessor :cron
20
+
21
+ # The last time the scheduled task ran in RFC 3339 format.
22
+ attr_accessor :last_run
23
+
24
+ # The next scheduled run of the task in RFC 3339 format.
25
+ attr_accessor :next_run
19
26
 
20
27
  attr_accessor :input
21
28
 
@@ -64,7 +71,9 @@ module Algolia
64
71
  :task_id => :taskID,
65
72
  :source_id => :sourceID,
66
73
  :destination_id => :destinationID,
67
- :trigger => :trigger,
74
+ :cron => :cron,
75
+ :last_run => :lastRun,
76
+ :next_run => :nextRun,
68
77
  :input => :input,
69
78
  :enabled => :enabled,
70
79
  :failure_threshold => :failureThreshold,
@@ -86,7 +95,9 @@ module Algolia
86
95
  :task_id => :"String",
87
96
  :source_id => :"String",
88
97
  :destination_id => :"String",
89
- :trigger => :"Trigger",
98
+ :cron => :"String",
99
+ :last_run => :"String",
100
+ :next_run => :"String",
90
101
  :input => :"TaskInput",
91
102
  :enabled => :"Boolean",
92
103
  :failure_threshold => :"Integer",
@@ -142,10 +153,16 @@ module Algolia
142
153
  self.destination_id = nil
143
154
  end
144
155
 
145
- if attributes.key?(:trigger)
146
- self.trigger = attributes[:trigger]
147
- else
148
- self.trigger = nil
156
+ if attributes.key?(:cron)
157
+ self.cron = attributes[:cron]
158
+ end
159
+
160
+ if attributes.key?(:last_run)
161
+ self.last_run = attributes[:last_run]
162
+ end
163
+
164
+ if attributes.key?(:next_run)
165
+ self.next_run = attributes[:next_run]
149
166
  end
150
167
 
151
168
  if attributes.key?(:input)
@@ -209,7 +226,9 @@ module Algolia
209
226
  task_id == other.task_id &&
210
227
  source_id == other.source_id &&
211
228
  destination_id == other.destination_id &&
212
- trigger == other.trigger &&
229
+ cron == other.cron &&
230
+ last_run == other.last_run &&
231
+ next_run == other.next_run &&
213
232
  input == other.input &&
214
233
  enabled == other.enabled &&
215
234
  failure_threshold == other.failure_threshold &&
@@ -232,7 +251,9 @@ module Algolia
232
251
  task_id,
233
252
  source_id,
234
253
  destination_id,
235
- trigger,
254
+ cron,
255
+ last_run,
256
+ next_run,
236
257
  input,
237
258
  enabled,
238
259
  failure_threshold,
@@ -13,10 +13,11 @@ module Algolia
13
13
  # Universally unique identifier (UUID) of a destination resource.
14
14
  attr_accessor :destination_id
15
15
 
16
- attr_accessor :trigger
17
-
18
16
  attr_accessor :action
19
17
 
18
+ # Cron expression for the task's schedule.
19
+ attr_accessor :cron
20
+
20
21
  # Whether the task is enabled.
21
22
  attr_accessor :enabled
22
23
 
@@ -55,8 +56,8 @@ module Algolia
55
56
  {
56
57
  :source_id => :sourceID,
57
58
  :destination_id => :destinationID,
58
- :trigger => :trigger,
59
59
  :action => :action,
60
+ :cron => :cron,
60
61
  :enabled => :enabled,
61
62
  :failure_threshold => :failureThreshold,
62
63
  :input => :input,
@@ -74,8 +75,8 @@ module Algolia
74
75
  {
75
76
  :source_id => :"String",
76
77
  :destination_id => :"String",
77
- :trigger => :"TaskCreateTrigger",
78
78
  :action => :"ActionType",
79
+ :cron => :"String",
79
80
  :enabled => :"Boolean",
80
81
  :failure_threshold => :"Integer",
81
82
  :input => :"TaskInput",
@@ -125,18 +126,16 @@ module Algolia
125
126
  self.destination_id = nil
126
127
  end
127
128
 
128
- if attributes.key?(:trigger)
129
- self.trigger = attributes[:trigger]
130
- else
131
- self.trigger = nil
132
- end
133
-
134
129
  if attributes.key?(:action)
135
130
  self.action = attributes[:action]
136
131
  else
137
132
  self.action = nil
138
133
  end
139
134
 
135
+ if attributes.key?(:cron)
136
+ self.cron = attributes[:cron]
137
+ end
138
+
140
139
  if attributes.key?(:enabled)
141
140
  self.enabled = attributes[:enabled]
142
141
  end
@@ -179,8 +178,8 @@ module Algolia
179
178
  self.class == other.class &&
180
179
  source_id == other.source_id &&
181
180
  destination_id == other.destination_id &&
182
- trigger == other.trigger &&
183
181
  action == other.action &&
182
+ cron == other.cron &&
184
183
  enabled == other.enabled &&
185
184
  failure_threshold == other.failure_threshold &&
186
185
  input == other.input &&
@@ -196,7 +195,7 @@ module Algolia
196
195
  # Calculates hash code according to all attributes.
197
196
  # @return [Integer] Hash code
198
197
  def hash
199
- [source_id, destination_id, trigger, action, enabled, failure_threshold, input, cursor].hash
198
+ [source_id, destination_id, action, cron, enabled, failure_threshold, input, cursor].hash
200
199
  end
201
200
 
202
201
  # Builds the object from hash
@@ -4,21 +4,29 @@ require "date"
4
4
  require "time"
5
5
 
6
6
  module Algolia
7
- module Search
8
- class SearchForFacetsOptions
9
- # Facet name.
10
- attr_accessor :facet
7
+ module Ingestion
8
+ # API request body for creating a task using the V1 shape, please use methods and types that don't contain the V1 suffix.
9
+ class TaskCreateV1
10
+ # Universally uniqud identifier (UUID) of a source.
11
+ attr_accessor :source_id
11
12
 
12
- # Index name (case-sensitive).
13
- attr_accessor :index_name
13
+ # Universally unique identifier (UUID) of a destination resource.
14
+ attr_accessor :destination_id
14
15
 
15
- # Text to search inside the facet's values.
16
- attr_accessor :facet_query
16
+ attr_accessor :trigger
17
17
 
18
- # Maximum number of facet values to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
19
- attr_accessor :max_facet_hits
18
+ attr_accessor :action
20
19
 
21
- attr_accessor :type
20
+ # Whether the task is enabled.
21
+ attr_accessor :enabled
22
+
23
+ # Maximum accepted percentage of failures for a task run to finish successfully.
24
+ attr_accessor :failure_threshold
25
+
26
+ attr_accessor :input
27
+
28
+ # Date of the last cursor in RFC 3339 format.
29
+ attr_accessor :cursor
22
30
 
23
31
  class EnumAttributeValidator
24
32
  attr_reader :datatype
@@ -45,11 +53,14 @@ module Algolia
45
53
  # Attribute mapping from ruby-style variable name to JSON key.
46
54
  def self.attribute_map
47
55
  {
48
- :facet => :facet,
49
- :index_name => :indexName,
50
- :facet_query => :facetQuery,
51
- :max_facet_hits => :maxFacetHits,
52
- :type => :type
56
+ :source_id => :sourceID,
57
+ :destination_id => :destinationID,
58
+ :trigger => :trigger,
59
+ :action => :action,
60
+ :enabled => :enabled,
61
+ :failure_threshold => :failureThreshold,
62
+ :input => :input,
63
+ :cursor => :cursor
53
64
  }
54
65
  end
55
66
 
@@ -61,11 +72,14 @@ module Algolia
61
72
  # Attribute type mapping.
62
73
  def self.types_mapping
63
74
  {
64
- :facet => :"String",
65
- :index_name => :"String",
66
- :facet_query => :"String",
67
- :max_facet_hits => :"Integer",
68
- :type => :"SearchTypeFacet"
75
+ :source_id => :"String",
76
+ :destination_id => :"String",
77
+ :trigger => :"TaskCreateTrigger",
78
+ :action => :"ActionType",
79
+ :enabled => :"Boolean",
80
+ :failure_threshold => :"Integer",
81
+ :input => :"TaskInput",
82
+ :cursor => :"String"
69
83
  }
70
84
  end
71
85
 
@@ -82,7 +96,7 @@ module Algolia
82
96
  if (!attributes.is_a?(Hash))
83
97
  raise(
84
98
  ArgumentError,
85
- "The input argument (attributes) must be a hash in `Algolia::SearchForFacetsOptions` initialize method"
99
+ "The input argument (attributes) must be a hash in `Algolia::TaskCreateV1` initialize method"
86
100
  )
87
101
  end
88
102
 
@@ -91,7 +105,7 @@ module Algolia
91
105
  if (!self.class.attribute_map.key?(k.to_sym))
92
106
  raise(
93
107
  ArgumentError,
94
- "`#{k}` is not a valid attribute in `Algolia::SearchForFacetsOptions`. Please check the name to make sure it's valid. List of attributes: " +
108
+ "`#{k}` is not a valid attribute in `Algolia::TaskCreateV1`. Please check the name to make sure it's valid. List of attributes: " +
95
109
  self.class.attribute_map.keys.inspect
96
110
  )
97
111
  end
@@ -99,45 +113,63 @@ module Algolia
99
113
  h[k.to_sym] = v
100
114
  }
101
115
 
102
- if attributes.key?(:facet)
103
- self.facet = attributes[:facet]
116
+ if attributes.key?(:source_id)
117
+ self.source_id = attributes[:source_id]
104
118
  else
105
- self.facet = nil
119
+ self.source_id = nil
106
120
  end
107
121
 
108
- if attributes.key?(:index_name)
109
- self.index_name = attributes[:index_name]
122
+ if attributes.key?(:destination_id)
123
+ self.destination_id = attributes[:destination_id]
110
124
  else
111
- self.index_name = nil
125
+ self.destination_id = nil
112
126
  end
113
127
 
114
- if attributes.key?(:facet_query)
115
- self.facet_query = attributes[:facet_query]
128
+ if attributes.key?(:trigger)
129
+ self.trigger = attributes[:trigger]
130
+ else
131
+ self.trigger = nil
116
132
  end
117
133
 
118
- if attributes.key?(:max_facet_hits)
119
- self.max_facet_hits = attributes[:max_facet_hits]
134
+ if attributes.key?(:action)
135
+ self.action = attributes[:action]
136
+ else
137
+ self.action = nil
120
138
  end
121
139
 
122
- if attributes.key?(:type)
123
- self.type = attributes[:type]
124
- else
125
- self.type = nil
140
+ if attributes.key?(:enabled)
141
+ self.enabled = attributes[:enabled]
142
+ end
143
+
144
+ if attributes.key?(:failure_threshold)
145
+ self.failure_threshold = attributes[:failure_threshold]
146
+ end
147
+
148
+ if attributes.key?(:input)
149
+ self.input = attributes[:input]
150
+ end
151
+
152
+ if attributes.key?(:cursor)
153
+ self.cursor = attributes[:cursor]
126
154
  end
127
155
  end
128
156
 
129
157
  # Custom attribute writer method with validation
130
- # @param [Object] max_facet_hits Value to be assigned
131
- def max_facet_hits=(max_facet_hits)
132
- if max_facet_hits.nil?
133
- raise ArgumentError, "max_facet_hits cannot be nil"
158
+ # @param [Object] failure_threshold Value to be assigned
159
+ def failure_threshold=(failure_threshold)
160
+ if failure_threshold.nil?
161
+ raise ArgumentError, "failure_threshold cannot be nil"
162
+ end
163
+
164
+ if failure_threshold > 100
165
+ raise ArgumentError, "invalid value for \"failure_threshold\", must be smaller than or equal to 100."
134
166
  end
135
167
 
136
- if max_facet_hits > 100
137
- raise ArgumentError, "invalid value for \"max_facet_hits\", must be smaller than or equal to 100."
168
+ if failure_threshold < 0
169
+ raise ArgumentError, "invalid value for \"failure_threshold\", must be greater than or equal to 0."
138
170
  end
139
171
 
140
- @max_facet_hits = max_facet_hits
172
+ @failure_threshold = failure_threshold
141
173
  end
142
174
 
143
175
  # Checks equality by comparing each attribute.
@@ -145,11 +177,14 @@ module Algolia
145
177
  def ==(other)
146
178
  return true if self.equal?(other)
147
179
  self.class == other.class &&
148
- facet == other.facet &&
149
- index_name == other.index_name &&
150
- facet_query == other.facet_query &&
151
- max_facet_hits == other.max_facet_hits &&
152
- type == other.type
180
+ source_id == other.source_id &&
181
+ destination_id == other.destination_id &&
182
+ trigger == other.trigger &&
183
+ action == other.action &&
184
+ enabled == other.enabled &&
185
+ failure_threshold == other.failure_threshold &&
186
+ input == other.input &&
187
+ cursor == other.cursor
153
188
  end
154
189
 
155
190
  # @see the `==` method
@@ -161,7 +196,7 @@ module Algolia
161
196
  # Calculates hash code according to all attributes.
162
197
  # @return [Integer] Hash code
163
198
  def hash
164
- [facet, index_name, facet_query, max_facet_hits, type].hash
199
+ [source_id, destination_id, trigger, action, enabled, failure_threshold, input, cursor].hash
165
200
  end
166
201
 
167
202
  # Builds the object from hash
@@ -230,7 +265,7 @@ module Algolia
230
265
  # model
231
266
  else
232
267
  # models (e.g. Pet) or oneOf
233
- klass = Algolia::Search.const_get(type)
268
+ klass = Algolia::Ingestion.const_get(type)
234
269
  klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
235
270
  .build_from_hash(value)
236
271
  end
@@ -10,7 +10,8 @@ module Algolia
10
10
  # Universally unique identifier (UUID) of a destination resource.
11
11
  attr_accessor :destination_id
12
12
 
13
- attr_accessor :trigger
13
+ # Cron expression for the task's schedule.
14
+ attr_accessor :cron
14
15
 
15
16
  attr_accessor :input
16
17
 
@@ -24,7 +25,7 @@ module Algolia
24
25
  def self.attribute_map
25
26
  {
26
27
  :destination_id => :destinationID,
27
- :trigger => :trigger,
28
+ :cron => :cron,
28
29
  :input => :input,
29
30
  :enabled => :enabled,
30
31
  :failure_threshold => :failureThreshold
@@ -40,7 +41,7 @@ module Algolia
40
41
  def self.types_mapping
41
42
  {
42
43
  :destination_id => :"String",
43
- :trigger => :"TriggerUpdateInput",
44
+ :cron => :"String",
44
45
  :input => :"TaskInput",
45
46
  :enabled => :"Boolean",
46
47
  :failure_threshold => :"Integer"
@@ -81,8 +82,8 @@ module Algolia
81
82
  self.destination_id = attributes[:destination_id]
82
83
  end
83
84
 
84
- if attributes.key?(:trigger)
85
- self.trigger = attributes[:trigger]
85
+ if attributes.key?(:cron)
86
+ self.cron = attributes[:cron]
86
87
  end
87
88
 
88
89
  if attributes.key?(:input)
@@ -122,7 +123,7 @@ module Algolia
122
123
  return true if self.equal?(other)
123
124
  self.class == other.class &&
124
125
  destination_id == other.destination_id &&
125
- trigger == other.trigger &&
126
+ cron == other.cron &&
126
127
  input == other.input &&
127
128
  enabled == other.enabled &&
128
129
  failure_threshold == other.failure_threshold
@@ -137,7 +138,7 @@ module Algolia
137
138
  # Calculates hash code according to all attributes.
138
139
  # @return [Integer] Hash code
139
140
  def hash
140
- [destination_id, trigger, input, enabled, failure_threshold].hash
141
+ [destination_id, cron, input, enabled, failure_threshold].hash
141
142
  end
142
143
 
143
144
  # Builds the object from hash
@@ -4,27 +4,30 @@ require "date"
4
4
  require "time"
5
5
 
6
6
  module Algolia
7
- module Search
8
- class BrowsePagination
9
- # Page of search results to retrieve.
10
- attr_accessor :page
7
+ module Ingestion
8
+ # API request body for updating a task using the V1 shape, please use methods and types that don't contain the V1 suffix.
9
+ class TaskUpdateV1
10
+ # Universally unique identifier (UUID) of a destination resource.
11
+ attr_accessor :destination_id
11
12
 
12
- # Number of results (hits).
13
- attr_accessor :nb_hits
13
+ attr_accessor :trigger
14
14
 
15
- # Number of pages of results.
16
- attr_accessor :nb_pages
15
+ attr_accessor :input
17
16
 
18
- # Number of hits per page.
19
- attr_accessor :hits_per_page
17
+ # Whether the task is enabled.
18
+ attr_accessor :enabled
19
+
20
+ # Maximum accepted percentage of failures for a task run to finish successfully.
21
+ attr_accessor :failure_threshold
20
22
 
21
23
  # Attribute mapping from ruby-style variable name to JSON key.
22
24
  def self.attribute_map
23
25
  {
24
- :page => :page,
25
- :nb_hits => :nbHits,
26
- :nb_pages => :nbPages,
27
- :hits_per_page => :hitsPerPage
26
+ :destination_id => :destinationID,
27
+ :trigger => :trigger,
28
+ :input => :input,
29
+ :enabled => :enabled,
30
+ :failure_threshold => :failureThreshold
28
31
  }
29
32
  end
30
33
 
@@ -36,10 +39,11 @@ module Algolia
36
39
  # Attribute type mapping.
37
40
  def self.types_mapping
38
41
  {
39
- :page => :"Integer",
40
- :nb_hits => :"Integer",
41
- :nb_pages => :"Integer",
42
- :hits_per_page => :"Integer"
42
+ :destination_id => :"String",
43
+ :trigger => :"TriggerUpdateInput",
44
+ :input => :"TaskInput",
45
+ :enabled => :"Boolean",
46
+ :failure_threshold => :"Integer"
43
47
  }
44
48
  end
45
49
 
@@ -56,7 +60,7 @@ module Algolia
56
60
  if (!attributes.is_a?(Hash))
57
61
  raise(
58
62
  ArgumentError,
59
- "The input argument (attributes) must be a hash in `Algolia::BrowsePagination` initialize method"
63
+ "The input argument (attributes) must be a hash in `Algolia::TaskUpdateV1` initialize method"
60
64
  )
61
65
  end
62
66
 
@@ -65,7 +69,7 @@ module Algolia
65
69
  if (!self.class.attribute_map.key?(k.to_sym))
66
70
  raise(
67
71
  ArgumentError,
68
- "`#{k}` is not a valid attribute in `Algolia::BrowsePagination`. Please check the name to make sure it's valid. List of attributes: " +
72
+ "`#{k}` is not a valid attribute in `Algolia::TaskUpdateV1`. Please check the name to make sure it's valid. List of attributes: " +
69
73
  self.class.attribute_map.keys.inspect
70
74
  )
71
75
  end
@@ -73,53 +77,43 @@ module Algolia
73
77
  h[k.to_sym] = v
74
78
  }
75
79
 
76
- if attributes.key?(:page)
77
- self.page = attributes[:page]
78
- end
79
-
80
- if attributes.key?(:nb_hits)
81
- self.nb_hits = attributes[:nb_hits]
80
+ if attributes.key?(:destination_id)
81
+ self.destination_id = attributes[:destination_id]
82
82
  end
83
83
 
84
- if attributes.key?(:nb_pages)
85
- self.nb_pages = attributes[:nb_pages]
84
+ if attributes.key?(:trigger)
85
+ self.trigger = attributes[:trigger]
86
86
  end
87
87
 
88
- if attributes.key?(:hits_per_page)
89
- self.hits_per_page = attributes[:hits_per_page]
88
+ if attributes.key?(:input)
89
+ self.input = attributes[:input]
90
90
  end
91
- end
92
91
 
93
- # Custom attribute writer method with validation
94
- # @param [Object] page Value to be assigned
95
- def page=(page)
96
- if page.nil?
97
- raise ArgumentError, "page cannot be nil"
92
+ if attributes.key?(:enabled)
93
+ self.enabled = attributes[:enabled]
98
94
  end
99
95
 
100
- if page < 0
101
- raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0."
96
+ if attributes.key?(:failure_threshold)
97
+ self.failure_threshold = attributes[:failure_threshold]
102
98
  end
103
-
104
- @page = page
105
99
  end
106
100
 
107
101
  # Custom attribute writer method with validation
108
- # @param [Object] hits_per_page Value to be assigned
109
- def hits_per_page=(hits_per_page)
110
- if hits_per_page.nil?
111
- raise ArgumentError, "hits_per_page cannot be nil"
102
+ # @param [Object] failure_threshold Value to be assigned
103
+ def failure_threshold=(failure_threshold)
104
+ if failure_threshold.nil?
105
+ raise ArgumentError, "failure_threshold cannot be nil"
112
106
  end
113
107
 
114
- if hits_per_page > 1000
115
- raise ArgumentError, "invalid value for \"hits_per_page\", must be smaller than or equal to 1000."
108
+ if failure_threshold > 100
109
+ raise ArgumentError, "invalid value for \"failure_threshold\", must be smaller than or equal to 100."
116
110
  end
117
111
 
118
- if hits_per_page < 1
119
- raise ArgumentError, "invalid value for \"hits_per_page\", must be greater than or equal to 1."
112
+ if failure_threshold < 0
113
+ raise ArgumentError, "invalid value for \"failure_threshold\", must be greater than or equal to 0."
120
114
  end
121
115
 
122
- @hits_per_page = hits_per_page
116
+ @failure_threshold = failure_threshold
123
117
  end
124
118
 
125
119
  # Checks equality by comparing each attribute.
@@ -127,10 +121,11 @@ module Algolia
127
121
  def ==(other)
128
122
  return true if self.equal?(other)
129
123
  self.class == other.class &&
130
- page == other.page &&
131
- nb_hits == other.nb_hits &&
132
- nb_pages == other.nb_pages &&
133
- hits_per_page == other.hits_per_page
124
+ destination_id == other.destination_id &&
125
+ trigger == other.trigger &&
126
+ input == other.input &&
127
+ enabled == other.enabled &&
128
+ failure_threshold == other.failure_threshold
134
129
  end
135
130
 
136
131
  # @see the `==` method
@@ -142,7 +137,7 @@ module Algolia
142
137
  # Calculates hash code according to all attributes.
143
138
  # @return [Integer] Hash code
144
139
  def hash
145
- [page, nb_hits, nb_pages, hits_per_page].hash
140
+ [destination_id, trigger, input, enabled, failure_threshold].hash
146
141
  end
147
142
 
148
143
  # Builds the object from hash
@@ -211,7 +206,7 @@ module Algolia
211
206
  # model
212
207
  else
213
208
  # models (e.g. Pet) or oneOf
214
- klass = Algolia::Search.const_get(type)
209
+ klass = Algolia::Ingestion.const_get(type)
215
210
  klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
216
211
  .build_from_hash(value)
217
212
  end