algolia 3.0.0.alpha.14 → 3.0.0.alpha.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile.lock +2 -2
  4. data/lib/algolia/api/abtesting_client.rb +4 -4
  5. data/lib/algolia/api/analytics_client.rb +268 -98
  6. data/lib/algolia/api/ingestion_client.rb +4 -4
  7. data/lib/algolia/api/insights_client.rb +4 -4
  8. data/lib/algolia/api/monitoring_client.rb +4 -4
  9. data/lib/algolia/api/personalization_client.rb +4 -4
  10. data/lib/algolia/api/query_suggestions_client.rb +4 -4
  11. data/lib/algolia/api/recommend_client.rb +4 -4
  12. data/lib/algolia/api/search_client.rb +4 -4
  13. data/lib/algolia/models/abtesting/{currencies_value.rb → currency.rb} +3 -3
  14. data/lib/algolia/models/abtesting/variant.rb +2 -5
  15. data/lib/algolia/models/analytics/click_positions_inner.rb +242 -0
  16. data/lib/algolia/models/analytics/currencies_value.rb +208 -0
  17. data/lib/algolia/models/analytics/daily_add_to_cart_rates.rb +265 -0
  18. data/lib/algolia/models/analytics/daily_average_clicks.rb +249 -0
  19. data/lib/algolia/models/analytics/{click_through_rate_event.rb → daily_click_through_rates.rb} +24 -14
  20. data/lib/algolia/models/analytics/daily_conversion_rates.rb +265 -0
  21. data/lib/algolia/models/analytics/{no_click_rate_event.rb → daily_no_click_rates.rb} +21 -7
  22. data/lib/algolia/models/analytics/{no_results_rate_event.rb → daily_no_results_rates.rb} +7 -7
  23. data/lib/algolia/models/analytics/{conversion_rate_event.rb → daily_purchase_rates.rb} +18 -22
  24. data/lib/algolia/models/analytics/{average_click_event.rb → daily_revenue.rb} +15 -25
  25. data/lib/algolia/models/analytics/{search_event.rb → daily_searches.rb} +4 -4
  26. data/lib/algolia/models/analytics/{search_no_result_event.rb → daily_searches_no_clicks.rb} +19 -5
  27. data/lib/algolia/models/analytics/{search_no_click_event.rb → daily_searches_no_results.rb} +19 -5
  28. data/lib/algolia/models/analytics/{user_with_date.rb → daily_users.rb} +5 -5
  29. data/lib/algolia/models/analytics/get_add_to_cart_rate_response.rb +267 -0
  30. data/lib/algolia/models/analytics/get_average_click_position_response.rb +31 -5
  31. data/lib/algolia/models/analytics/get_click_positions_response.rb +6 -6
  32. data/lib/algolia/models/analytics/get_click_through_rate_response.rb +22 -12
  33. data/lib/algolia/models/analytics/get_conversion_rate_response.rb +267 -0
  34. data/lib/algolia/models/analytics/get_no_click_rate_response.rb +19 -5
  35. data/lib/algolia/models/analytics/get_no_results_rate_response.rb +5 -5
  36. data/lib/algolia/models/analytics/{get_conversation_rate_response.rb → get_purchase_rate_response.rb} +19 -23
  37. data/lib/algolia/models/analytics/{click_position.rb → get_revenue.rb} +23 -21
  38. data/lib/algolia/models/analytics/get_searches_count_response.rb +2 -2
  39. data/lib/algolia/models/analytics/get_searches_no_clicks_response.rb +2 -2
  40. data/lib/algolia/models/analytics/get_searches_no_results_response.rb +2 -2
  41. data/lib/algolia/models/analytics/get_status_response.rb +4 -2
  42. data/lib/algolia/models/analytics/get_top_countries_response.rb +1 -1
  43. data/lib/algolia/models/analytics/get_top_filter_attributes_response.rb +1 -1
  44. data/lib/algolia/models/analytics/get_top_filter_for_attribute.rb +23 -2
  45. data/lib/algolia/models/analytics/get_top_filters_no_results_response.rb +4 -2
  46. data/lib/algolia/models/analytics/get_top_filters_no_results_value.rb +23 -2
  47. data/lib/algolia/models/analytics/get_top_hits_response.rb +2 -1
  48. data/lib/algolia/models/analytics/get_top_searches_response.rb +2 -1
  49. data/lib/algolia/models/analytics/get_users_count_response.rb +3 -3
  50. data/lib/algolia/models/analytics/operator.rb +38 -0
  51. data/lib/algolia/models/analytics/top_country.rb +1 -1
  52. data/lib/algolia/models/analytics/top_hit.rb +1 -1
  53. data/lib/algolia/models/analytics/top_hit_with_analytics.rb +60 -21
  54. data/lib/algolia/models/analytics/top_hit_with_revenue_analytics.rb +437 -0
  55. data/lib/algolia/models/analytics/top_hits_response.rb +1 -1
  56. data/lib/algolia/models/analytics/top_hits_response_with_analytics.rb +1 -1
  57. data/lib/algolia/models/analytics/top_hits_response_with_revenue_analytics.rb +201 -0
  58. data/lib/algolia/models/analytics/top_search.rb +2 -2
  59. data/lib/algolia/models/analytics/top_search_with_analytics.rb +99 -17
  60. data/lib/algolia/models/analytics/top_search_with_revenue_analytics.rb +504 -0
  61. data/lib/algolia/models/analytics/top_searches_response.rb +1 -1
  62. data/lib/algolia/models/analytics/top_searches_response_with_analytics.rb +1 -1
  63. data/lib/algolia/models/analytics/top_searches_response_with_revenue_analytics.rb +201 -0
  64. data/lib/algolia/version.rb +1 -1
  65. metadata +26 -14
@@ -5,18 +5,18 @@ require 'time'
5
5
 
6
6
  module Algolia
7
7
  module Analytics
8
- class ClickPosition
9
- # Range of positions with the following pattern: - For positions 1 to 10, the number of click events are shown for each position - For positions 11 to 20, all click events are grouped - For positions 21 and up, all click events are grouped.
10
- attr_accessor :position
8
+ class GetRevenue
9
+ # Revenue associated with this search, broken-down by currencies.
10
+ attr_accessor :currencies
11
11
 
12
- # Number of click events.
13
- attr_accessor :click_count
12
+ # Daily revenue.
13
+ attr_accessor :dates
14
14
 
15
15
  # Attribute mapping from ruby-style variable name to JSON key.
16
16
  def self.attribute_map
17
17
  {
18
- :position => :position,
19
- :click_count => :clickCount
18
+ :currencies => :currencies,
19
+ :dates => :dates
20
20
  }
21
21
  end
22
22
 
@@ -28,8 +28,8 @@ module Algolia
28
28
  # Attribute type mapping.
29
29
  def self.types_mapping
30
30
  {
31
- :position => :'Array<Integer>',
32
- :click_count => :Integer
31
+ :currencies => :'Hash<String, CurrenciesValue>',
32
+ :dates => :'Array<DailyRevenue>'
33
33
  }
34
34
  end
35
35
 
@@ -42,31 +42,33 @@ module Algolia
42
42
  # @param [Hash] attributes Model attributes in the form of hash
43
43
  def initialize(attributes = {})
44
44
  unless attributes.is_a?(Hash)
45
- raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::ClickPosition` initialize method"
45
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::GetRevenue` initialize method"
46
46
  end
47
47
 
48
48
  # check to see if the attribute exists and convert string to symbol for hash key
49
49
  attributes = attributes.each_with_object({}) do |(k, v), h|
50
50
  unless self.class.attribute_map.key?(k.to_sym)
51
51
  raise ArgumentError,
52
- "`#{k}` is not a valid attribute in `Algolia::ClickPosition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
+ "`#{k}` is not a valid attribute in `Algolia::GetRevenue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
53
  end
54
54
 
55
55
  h[k.to_sym] = v
56
56
  end
57
57
 
58
- if attributes.key?(:position)
59
- if (value = attributes[:position]).is_a?(Array)
60
- self.position = value
58
+ if attributes.key?(:currencies)
59
+ if (value = attributes[:currencies]).is_a?(Hash)
60
+ self.currencies = value
61
61
  end
62
62
  else
63
- self.position = nil
63
+ self.currencies = nil
64
64
  end
65
65
 
66
- if attributes.key?(:click_count)
67
- self.click_count = attributes[:click_count]
66
+ if attributes.key?(:dates)
67
+ if (value = attributes[:dates]).is_a?(Array)
68
+ self.dates = value
69
+ end
68
70
  else
69
- self.click_count = nil
71
+ self.dates = nil
70
72
  end
71
73
  end
72
74
 
@@ -76,8 +78,8 @@ module Algolia
76
78
  return true if equal?(other)
77
79
 
78
80
  self.class == other.class &&
79
- position == other.position &&
80
- click_count == other.click_count
81
+ currencies == other.currencies &&
82
+ dates == other.dates
81
83
  end
82
84
 
83
85
  # @see the `==` method
@@ -89,7 +91,7 @@ module Algolia
89
91
  # Calculates hash code according to all attributes.
90
92
  # @return [Integer] Hash code
91
93
  def hash
92
- [position, click_count].hash
94
+ [currencies, dates].hash
93
95
  end
94
96
 
95
97
  # Builds the object from hash
@@ -9,7 +9,7 @@ module Algolia
9
9
  # Number of occurrences.
10
10
  attr_accessor :count
11
11
 
12
- # Search events with their associated dates and hit counts.
12
+ # Daily number of searches.
13
13
  attr_accessor :dates
14
14
 
15
15
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -29,7 +29,7 @@ module Algolia
29
29
  def self.types_mapping
30
30
  {
31
31
  :count => :Integer,
32
- :dates => :'Array<SearchEvent>'
32
+ :dates => :'Array<DailySearches>'
33
33
  }
34
34
  end
35
35
 
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetSearchesNoClicksResponse
9
- # Searches with no clicks.
9
+ # Searches without any clicks.
10
10
  attr_accessor :searches
11
11
 
12
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -24,7 +24,7 @@ module Algolia
24
24
  # Attribute type mapping.
25
25
  def self.types_mapping
26
26
  {
27
- :searches => :'Array<SearchNoClickEvent>'
27
+ :searches => :'Array<DailySearchesNoClicks>'
28
28
  }
29
29
  end
30
30
 
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetSearchesNoResultsResponse
9
- # Searches with no results.
9
+ # Searches without results.
10
10
  attr_accessor :searches
11
11
 
12
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -24,7 +24,7 @@ module Algolia
24
24
  # Attribute type mapping.
25
25
  def self.types_mapping
26
26
  {
27
- :searches => :'Array<SearchNoResultEvent>'
27
+ :searches => :'Array<DailySearchesNoResults>'
28
28
  }
29
29
  end
30
30
 
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetStatusResponse
9
- # Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format.
9
+ # Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. If null, no update was performed yet.
10
10
  attr_accessor :updated_at
11
11
 
12
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -30,7 +30,9 @@ module Algolia
30
30
 
31
31
  # List of attributes with nullable: true
32
32
  def self.openapi_nullable
33
- Set.new([])
33
+ Set.new([
34
+ :updated_at
35
+ ])
34
36
  end
35
37
 
36
38
  # Initializes the object
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetTopCountriesResponse
9
- # Countries
9
+ # Countries and number of searches.
10
10
  attr_accessor :countries
11
11
 
12
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetTopFilterAttributesResponse
9
- # Filterable attributes.
9
+ # Most frequent filters.
10
10
  attr_accessor :attributes
11
11
 
12
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -9,7 +9,6 @@ module Algolia
9
9
  # Attribute name.
10
10
  attr_accessor :attribute
11
11
 
12
- # Operator.
13
12
  attr_accessor :operator
14
13
 
15
14
  # Attribute value.
@@ -18,6 +17,28 @@ module Algolia
18
17
  # Number of occurrences.
19
18
  attr_accessor :count
20
19
 
20
+ class EnumAttributeValidator
21
+ attr_reader :datatype
22
+ attr_reader :allowable_values
23
+
24
+ def initialize(datatype, allowable_values)
25
+ @allowable_values = allowable_values.map do |value|
26
+ case datatype.to_s
27
+ when /Integer/i
28
+ value.to_i
29
+ when /Float/i
30
+ value.to_f
31
+ else
32
+ value
33
+ end
34
+ end
35
+ end
36
+
37
+ def valid?(value)
38
+ !value || allowable_values.include?(value)
39
+ end
40
+ end
41
+
21
42
  # Attribute mapping from ruby-style variable name to JSON key.
22
43
  def self.attribute_map
23
44
  {
@@ -37,7 +58,7 @@ module Algolia
37
58
  def self.types_mapping
38
59
  {
39
60
  :attribute => :String,
40
- :operator => :String,
61
+ :operator => :Operator,
41
62
  :value => :String,
42
63
  :count => :Integer
43
64
  }
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetTopFiltersNoResultsResponse
9
- # Filters with no results.
9
+ # Filters for searches without any results. If null, the search term specified with the `search` parameter is not a search without results, or the `search` parameter is absent from the request.
10
10
  attr_accessor :values
11
11
 
12
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -30,7 +30,9 @@ module Algolia
30
30
 
31
31
  # List of attributes with nullable: true
32
32
  def self.openapi_nullable
33
- Set.new([])
33
+ Set.new([
34
+ :values
35
+ ])
34
36
  end
35
37
 
36
38
  # Initializes the object
@@ -9,12 +9,33 @@ module Algolia
9
9
  # Attribute name.
10
10
  attr_accessor :attribute
11
11
 
12
- # Operator.
13
12
  attr_accessor :operator
14
13
 
15
14
  # Attribute value.
16
15
  attr_accessor :value
17
16
 
17
+ class EnumAttributeValidator
18
+ attr_reader :datatype
19
+ attr_reader :allowable_values
20
+
21
+ def initialize(datatype, allowable_values)
22
+ @allowable_values = allowable_values.map do |value|
23
+ case datatype.to_s
24
+ when /Integer/i
25
+ value.to_i
26
+ when /Float/i
27
+ value.to_f
28
+ else
29
+ value
30
+ end
31
+ end
32
+ end
33
+
34
+ def valid?(value)
35
+ !value || allowable_values.include?(value)
36
+ end
37
+ end
38
+
18
39
  # Attribute mapping from ruby-style variable name to JSON key.
19
40
  def self.attribute_map
20
41
  {
@@ -33,7 +54,7 @@ module Algolia
33
54
  def self.types_mapping
34
55
  {
35
56
  :attribute => :String,
36
- :operator => :String,
57
+ :operator => :Operator,
37
58
  :value => :String
38
59
  }
39
60
  end
@@ -11,7 +11,8 @@ module Algolia
11
11
  def openapi_one_of
12
12
  [
13
13
  :TopHitsResponse,
14
- :TopHitsResponseWithAnalytics
14
+ :TopHitsResponseWithAnalytics,
15
+ :TopHitsResponseWithRevenueAnalytics
15
16
  ]
16
17
  end
17
18
 
@@ -11,7 +11,8 @@ module Algolia
11
11
  def openapi_one_of
12
12
  [
13
13
  :TopSearchesResponse,
14
- :TopSearchesResponseWithAnalytics
14
+ :TopSearchesResponseWithAnalytics,
15
+ :TopSearchesResponseWithRevenueAnalytics
15
16
  ]
16
17
  end
17
18
 
@@ -6,10 +6,10 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class GetUsersCountResponse
9
- # Number of occurrences.
9
+ # Number of unique users.
10
10
  attr_accessor :count
11
11
 
12
- # User count.
12
+ # Daily number of unique users.
13
13
  attr_accessor :dates
14
14
 
15
15
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -29,7 +29,7 @@ module Algolia
29
29
  def self.types_mapping
30
30
  {
31
31
  :count => :Integer,
32
- :dates => :'Array<UserWithDate>'
32
+ :dates => :'Array<DailyUsers>'
33
33
  }
34
34
  end
35
35
 
@@ -0,0 +1,38 @@
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 Analytics
8
+ class Operator
9
+ APPLY = ":".freeze
10
+ LESS_THAN = "<".freeze
11
+ LESS_EQUALS = "<=".freeze
12
+ EQUALS = "=".freeze
13
+ NOT_EQUALS = "!=".freeze
14
+ GREATER_THAN = ">".freeze
15
+ GREATER_EQUALS = ">=".freeze
16
+
17
+ def self.all_vars
18
+ @all_vars ||= [APPLY, LESS_THAN, LESS_EQUALS, EQUALS, NOT_EQUALS, GREATER_THAN, GREATER_EQUALS].freeze
19
+ end
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def self.build_from_hash(value)
25
+ new.build_from_hash(value)
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def build_from_hash(value)
32
+ return value if Operator.all_vars.include?(value)
33
+
34
+ raise "Invalid ENUM value #{value} for class #Operator"
35
+ end
36
+ end
37
+ end
38
+ end
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class TopCountry
9
- # Country.
9
+ # Country code.
10
10
  attr_accessor :country
11
11
 
12
12
  # Number of occurrences.
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class TopHit
9
- # Hit.
9
+ # Object ID of a record that's returned as a search result.
10
10
  attr_accessor :hit
11
11
 
12
12
  # Number of occurrences.
@@ -6,25 +6,25 @@ require 'time'
6
6
  module Algolia
7
7
  module Analytics
8
8
  class TopHitWithAnalytics
9
- # Hit.
9
+ # Object ID of a record that's returned as a search result.
10
10
  attr_accessor :hit
11
11
 
12
12
  # Number of occurrences.
13
13
  attr_accessor :count
14
14
 
15
- # [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate).
15
+ # Click-through rate, calculated as number of tracked searches with at least one click event divided by the number of tracked searches. If null, Algolia didn't receive any search requests with `clickAnalytics` set to true.
16
16
  attr_accessor :click_through_rate
17
17
 
18
- # [Conversion rate (CR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate).
18
+ # Conversion rate, calculated as number of tracked searches with at least one conversion event divided by the number of tracked searches. If null, Algolia didn't receive any search requests with `clickAnalytics` set to true.
19
19
  attr_accessor :conversion_rate
20
20
 
21
- # Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`.
22
- attr_accessor :tracked_search_count
21
+ # Number of tracked searches. Tracked searches are search requests where the `clickAnalytics` parameter is true.
22
+ attr_accessor :tracked_hit_count
23
23
 
24
- # Number of click events.
24
+ # Number of clicks associated with this search.
25
25
  attr_accessor :click_count
26
26
 
27
- # Number of converted clicks.
27
+ # Number of conversions from this search.
28
28
  attr_accessor :conversion_count
29
29
 
30
30
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -34,7 +34,7 @@ module Algolia
34
34
  :count => :count,
35
35
  :click_through_rate => :clickThroughRate,
36
36
  :conversion_rate => :conversionRate,
37
- :tracked_search_count => :trackedSearchCount,
37
+ :tracked_hit_count => :trackedHitCount,
38
38
  :click_count => :clickCount,
39
39
  :conversion_count => :conversionCount
40
40
  }
@@ -52,7 +52,7 @@ module Algolia
52
52
  :count => :Integer,
53
53
  :click_through_rate => :Float,
54
54
  :conversion_rate => :Float,
55
- :tracked_search_count => :Integer,
55
+ :tracked_hit_count => :Integer,
56
56
  :click_count => :Integer,
57
57
  :conversion_count => :Integer
58
58
  }
@@ -61,7 +61,8 @@ module Algolia
61
61
  # List of attributes with nullable: true
62
62
  def self.openapi_nullable
63
63
  Set.new([
64
- :tracked_search_count
64
+ :click_through_rate,
65
+ :conversion_rate
65
66
  ])
66
67
  end
67
68
 
@@ -106,10 +107,10 @@ module Algolia
106
107
  self.conversion_rate = nil
107
108
  end
108
109
 
109
- if attributes.key?(:tracked_search_count)
110
- self.tracked_search_count = attributes[:tracked_search_count]
110
+ if attributes.key?(:tracked_hit_count)
111
+ self.tracked_hit_count = attributes[:tracked_hit_count]
111
112
  else
112
- self.tracked_search_count = nil
113
+ self.tracked_hit_count = nil
113
114
  end
114
115
 
115
116
  if attributes.key?(:click_count)
@@ -128,21 +129,59 @@ module Algolia
128
129
  # Custom attribute writer method with validation
129
130
  # @param [Object] click_through_rate Value to be assigned
130
131
  def click_through_rate=(click_through_rate)
131
- if click_through_rate.nil?
132
- raise ArgumentError, 'click_through_rate cannot be nil'
133
- end
134
-
135
- if click_through_rate > 1
132
+ if !click_through_rate.nil? && click_through_rate > 1
136
133
  raise ArgumentError, 'invalid value for "click_through_rate", must be smaller than or equal to 1.'
137
134
  end
138
135
 
139
- if click_through_rate < 0
136
+ if !click_through_rate.nil? && click_through_rate < 0
140
137
  raise ArgumentError, 'invalid value for "click_through_rate", must be greater than or equal to 0.'
141
138
  end
142
139
 
143
140
  @click_through_rate = click_through_rate
144
141
  end
145
142
 
143
+ # Custom attribute writer method with validation
144
+ # @param [Object] conversion_rate Value to be assigned
145
+ def conversion_rate=(conversion_rate)
146
+ if !conversion_rate.nil? && conversion_rate > 1
147
+ raise ArgumentError, 'invalid value for "conversion_rate", must be smaller than or equal to 1.'
148
+ end
149
+
150
+ if !conversion_rate.nil? && conversion_rate < 0
151
+ raise ArgumentError, 'invalid value for "conversion_rate", must be greater than or equal to 0.'
152
+ end
153
+
154
+ @conversion_rate = conversion_rate
155
+ end
156
+
157
+ # Custom attribute writer method with validation
158
+ # @param [Object] click_count Value to be assigned
159
+ def click_count=(click_count)
160
+ if click_count.nil?
161
+ raise ArgumentError, 'click_count cannot be nil'
162
+ end
163
+
164
+ if click_count < 0
165
+ raise ArgumentError, 'invalid value for "click_count", must be greater than or equal to 0.'
166
+ end
167
+
168
+ @click_count = click_count
169
+ end
170
+
171
+ # Custom attribute writer method with validation
172
+ # @param [Object] conversion_count Value to be assigned
173
+ def conversion_count=(conversion_count)
174
+ if conversion_count.nil?
175
+ raise ArgumentError, 'conversion_count cannot be nil'
176
+ end
177
+
178
+ if conversion_count < 0
179
+ raise ArgumentError, 'invalid value for "conversion_count", must be greater than or equal to 0.'
180
+ end
181
+
182
+ @conversion_count = conversion_count
183
+ end
184
+
146
185
  # Checks equality by comparing each attribute.
147
186
  # @param [Object] Object to be compared
148
187
  def ==(other)
@@ -153,7 +192,7 @@ module Algolia
153
192
  count == other.count &&
154
193
  click_through_rate == other.click_through_rate &&
155
194
  conversion_rate == other.conversion_rate &&
156
- tracked_search_count == other.tracked_search_count &&
195
+ tracked_hit_count == other.tracked_hit_count &&
157
196
  click_count == other.click_count &&
158
197
  conversion_count == other.conversion_count
159
198
  end
@@ -167,7 +206,7 @@ module Algolia
167
206
  # Calculates hash code according to all attributes.
168
207
  # @return [Integer] Hash code
169
208
  def hash
170
- [hit, count, click_through_rate, conversion_rate, tracked_search_count, click_count, conversion_count].hash
209
+ [hit, count, click_through_rate, conversion_rate, tracked_hit_count, click_count, conversion_count].hash
171
210
  end
172
211
 
173
212
  # Builds the object from hash