algolia 3.0.0.alpha.14 → 3.0.0.alpha.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -2
- data/lib/algolia/api/abtesting_client.rb +4 -4
- data/lib/algolia/api/analytics_client.rb +268 -98
- data/lib/algolia/api/ingestion_client.rb +4 -4
- data/lib/algolia/api/insights_client.rb +4 -4
- data/lib/algolia/api/monitoring_client.rb +4 -4
- data/lib/algolia/api/personalization_client.rb +4 -4
- data/lib/algolia/api/query_suggestions_client.rb +4 -4
- data/lib/algolia/api/recommend_client.rb +4 -4
- data/lib/algolia/api/search_client.rb +4 -4
- data/lib/algolia/models/abtesting/{currencies_value.rb → currency.rb} +3 -3
- data/lib/algolia/models/abtesting/variant.rb +2 -5
- data/lib/algolia/models/analytics/click_positions_inner.rb +242 -0
- data/lib/algolia/models/analytics/currencies_value.rb +208 -0
- data/lib/algolia/models/analytics/daily_add_to_cart_rates.rb +265 -0
- data/lib/algolia/models/analytics/daily_average_clicks.rb +249 -0
- data/lib/algolia/models/analytics/{click_through_rate_event.rb → daily_click_through_rates.rb} +24 -14
- data/lib/algolia/models/analytics/daily_conversion_rates.rb +265 -0
- data/lib/algolia/models/analytics/{no_click_rate_event.rb → daily_no_click_rates.rb} +21 -7
- data/lib/algolia/models/analytics/{no_results_rate_event.rb → daily_no_results_rates.rb} +7 -7
- data/lib/algolia/models/analytics/{conversion_rate_event.rb → daily_purchase_rates.rb} +18 -22
- data/lib/algolia/models/analytics/{average_click_event.rb → daily_revenue.rb} +15 -25
- data/lib/algolia/models/analytics/{search_event.rb → daily_searches.rb} +4 -4
- data/lib/algolia/models/analytics/{search_no_result_event.rb → daily_searches_no_clicks.rb} +19 -5
- data/lib/algolia/models/analytics/{search_no_click_event.rb → daily_searches_no_results.rb} +19 -5
- data/lib/algolia/models/analytics/{user_with_date.rb → daily_users.rb} +5 -5
- data/lib/algolia/models/analytics/get_add_to_cart_rate_response.rb +267 -0
- data/lib/algolia/models/analytics/get_average_click_position_response.rb +31 -5
- data/lib/algolia/models/analytics/get_click_positions_response.rb +6 -6
- data/lib/algolia/models/analytics/get_click_through_rate_response.rb +22 -12
- data/lib/algolia/models/analytics/get_conversion_rate_response.rb +267 -0
- data/lib/algolia/models/analytics/get_no_click_rate_response.rb +19 -5
- data/lib/algolia/models/analytics/get_no_results_rate_response.rb +5 -5
- data/lib/algolia/models/analytics/{get_conversation_rate_response.rb → get_purchase_rate_response.rb} +19 -23
- data/lib/algolia/models/analytics/{click_position.rb → get_revenue.rb} +23 -21
- data/lib/algolia/models/analytics/get_searches_count_response.rb +2 -2
- data/lib/algolia/models/analytics/get_searches_no_clicks_response.rb +2 -2
- data/lib/algolia/models/analytics/get_searches_no_results_response.rb +2 -2
- data/lib/algolia/models/analytics/get_status_response.rb +4 -2
- data/lib/algolia/models/analytics/get_top_countries_response.rb +1 -1
- data/lib/algolia/models/analytics/get_top_filter_attributes_response.rb +1 -1
- data/lib/algolia/models/analytics/get_top_filter_for_attribute.rb +23 -2
- data/lib/algolia/models/analytics/get_top_filters_no_results_response.rb +4 -2
- data/lib/algolia/models/analytics/get_top_filters_no_results_value.rb +23 -2
- data/lib/algolia/models/analytics/get_top_hits_response.rb +2 -1
- data/lib/algolia/models/analytics/get_top_searches_response.rb +2 -1
- data/lib/algolia/models/analytics/get_users_count_response.rb +3 -3
- data/lib/algolia/models/analytics/operator.rb +38 -0
- data/lib/algolia/models/analytics/top_country.rb +1 -1
- data/lib/algolia/models/analytics/top_hit.rb +1 -1
- data/lib/algolia/models/analytics/top_hit_with_analytics.rb +60 -21
- data/lib/algolia/models/analytics/top_hit_with_revenue_analytics.rb +437 -0
- data/lib/algolia/models/analytics/top_hits_response.rb +1 -1
- data/lib/algolia/models/analytics/top_hits_response_with_analytics.rb +1 -1
- data/lib/algolia/models/analytics/top_hits_response_with_revenue_analytics.rb +201 -0
- data/lib/algolia/models/analytics/top_search.rb +2 -2
- data/lib/algolia/models/analytics/top_search_with_analytics.rb +99 -17
- data/lib/algolia/models/analytics/top_search_with_revenue_analytics.rb +504 -0
- data/lib/algolia/models/analytics/top_searches_response.rb +1 -1
- data/lib/algolia/models/analytics/top_searches_response_with_analytics.rb +1 -1
- data/lib/algolia/models/analytics/top_searches_response_with_revenue_analytics.rb +201 -0
- data/lib/algolia/version.rb +1 -1
- metadata +26 -14
@@ -5,17 +5,17 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Analytics
|
8
|
-
class
|
9
|
-
# Date
|
8
|
+
class DailyNoResultsRates
|
9
|
+
# Date in the format YYYY-MM-DD.
|
10
10
|
attr_accessor :date
|
11
11
|
|
12
|
-
# Number of
|
12
|
+
# Number of searches without any results.
|
13
13
|
attr_accessor :no_result_count
|
14
14
|
|
15
|
-
# Number of
|
15
|
+
# Number of searches.
|
16
16
|
attr_accessor :count
|
17
17
|
|
18
|
-
#
|
18
|
+
# No results rate, calculated as number of searches with zero results divided by the total number of searches.
|
19
19
|
attr_accessor :rate
|
20
20
|
|
21
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -52,14 +52,14 @@ module Algolia
|
|
52
52
|
# @param [Hash] attributes Model attributes in the form of hash
|
53
53
|
def initialize(attributes = {})
|
54
54
|
unless attributes.is_a?(Hash)
|
55
|
-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::
|
55
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::DailyNoResultsRates` initialize method"
|
56
56
|
end
|
57
57
|
|
58
58
|
# check to see if the attribute exists and convert string to symbol for hash key
|
59
59
|
attributes = attributes.each_with_object({}) do |(k, v), h|
|
60
60
|
unless self.class.attribute_map.key?(k.to_sym)
|
61
61
|
raise ArgumentError,
|
62
|
-
"`#{k}` is not a valid attribute in `Algolia::
|
62
|
+
"`#{k}` is not a valid attribute in `Algolia::DailyNoResultsRates`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
63
63
|
end
|
64
64
|
|
65
65
|
h[k.to_sym] = v
|
@@ -5,17 +5,17 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Analytics
|
8
|
-
class
|
9
|
-
#
|
8
|
+
class DailyPurchaseRates
|
9
|
+
# Purchase rate, calculated as number of tracked searches with at least one purchase event divided by the number of tracked searches. If null, Algolia didn't receive any search requests with `clickAnalytics` set to true.
|
10
10
|
attr_accessor :rate
|
11
11
|
|
12
|
-
# Number of tracked searches.
|
12
|
+
# Number of tracked searches. Tracked searches are search requests where the `clickAnalytics` parameter is true.
|
13
13
|
attr_accessor :tracked_search_count
|
14
14
|
|
15
|
-
# Number of
|
16
|
-
attr_accessor :
|
15
|
+
# Number of purchase events from this search.
|
16
|
+
attr_accessor :purchase_count
|
17
17
|
|
18
|
-
# Date
|
18
|
+
# Date in the format YYYY-MM-DD.
|
19
19
|
attr_accessor :date
|
20
20
|
|
21
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -23,7 +23,7 @@ module Algolia
|
|
23
23
|
{
|
24
24
|
:rate => :rate,
|
25
25
|
:tracked_search_count => :trackedSearchCount,
|
26
|
-
:
|
26
|
+
:purchase_count => :purchaseCount,
|
27
27
|
:date => :date
|
28
28
|
}
|
29
29
|
end
|
@@ -38,7 +38,7 @@ module Algolia
|
|
38
38
|
{
|
39
39
|
:rate => :Float,
|
40
40
|
:tracked_search_count => :Integer,
|
41
|
-
:
|
41
|
+
:purchase_count => :Integer,
|
42
42
|
:date => :String
|
43
43
|
}
|
44
44
|
end
|
@@ -46,7 +46,7 @@ module Algolia
|
|
46
46
|
# List of attributes with nullable: true
|
47
47
|
def self.openapi_nullable
|
48
48
|
Set.new([
|
49
|
-
:
|
49
|
+
:rate
|
50
50
|
])
|
51
51
|
end
|
52
52
|
|
@@ -54,14 +54,14 @@ module Algolia
|
|
54
54
|
# @param [Hash] attributes Model attributes in the form of hash
|
55
55
|
def initialize(attributes = {})
|
56
56
|
unless attributes.is_a?(Hash)
|
57
|
-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::
|
57
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::DailyPurchaseRates` initialize method"
|
58
58
|
end
|
59
59
|
|
60
60
|
# check to see if the attribute exists and convert string to symbol for hash key
|
61
61
|
attributes = attributes.each_with_object({}) do |(k, v), h|
|
62
62
|
unless self.class.attribute_map.key?(k.to_sym)
|
63
63
|
raise ArgumentError,
|
64
|
-
"`#{k}` is not a valid attribute in `Algolia::
|
64
|
+
"`#{k}` is not a valid attribute in `Algolia::DailyPurchaseRates`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
65
65
|
end
|
66
66
|
|
67
67
|
h[k.to_sym] = v
|
@@ -79,10 +79,10 @@ module Algolia
|
|
79
79
|
self.tracked_search_count = nil
|
80
80
|
end
|
81
81
|
|
82
|
-
if attributes.key?(:
|
83
|
-
self.
|
82
|
+
if attributes.key?(:purchase_count)
|
83
|
+
self.purchase_count = attributes[:purchase_count]
|
84
84
|
else
|
85
|
-
self.
|
85
|
+
self.purchase_count = nil
|
86
86
|
end
|
87
87
|
|
88
88
|
if attributes.key?(:date)
|
@@ -95,15 +95,11 @@ module Algolia
|
|
95
95
|
# Custom attribute writer method with validation
|
96
96
|
# @param [Object] rate Value to be assigned
|
97
97
|
def rate=(rate)
|
98
|
-
if rate.nil?
|
99
|
-
raise ArgumentError, 'rate cannot be nil'
|
100
|
-
end
|
101
|
-
|
102
|
-
if rate > 1
|
98
|
+
if !rate.nil? && rate > 1
|
103
99
|
raise ArgumentError, 'invalid value for "rate", must be smaller than or equal to 1.'
|
104
100
|
end
|
105
101
|
|
106
|
-
if rate < 0
|
102
|
+
if !rate.nil? && rate < 0
|
107
103
|
raise ArgumentError, 'invalid value for "rate", must be greater than or equal to 0.'
|
108
104
|
end
|
109
105
|
|
@@ -118,7 +114,7 @@ module Algolia
|
|
118
114
|
self.class == other.class &&
|
119
115
|
rate == other.rate &&
|
120
116
|
tracked_search_count == other.tracked_search_count &&
|
121
|
-
|
117
|
+
purchase_count == other.purchase_count &&
|
122
118
|
date == other.date
|
123
119
|
end
|
124
120
|
|
@@ -131,7 +127,7 @@ module Algolia
|
|
131
127
|
# Calculates hash code according to all attributes.
|
132
128
|
# @return [Integer] Hash code
|
133
129
|
def hash
|
134
|
-
[rate, tracked_search_count,
|
130
|
+
[rate, tracked_search_count, purchase_count, date].hash
|
135
131
|
end
|
136
132
|
|
137
133
|
# Builds the object from hash
|
@@ -5,21 +5,17 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Analytics
|
8
|
-
class
|
9
|
-
#
|
10
|
-
attr_accessor :
|
8
|
+
class DailyRevenue
|
9
|
+
# Revenue associated with this search, broken-down by currencies.
|
10
|
+
attr_accessor :currencies
|
11
11
|
|
12
|
-
#
|
13
|
-
attr_accessor :click_count
|
14
|
-
|
15
|
-
# Date of the event in the format YYYY-MM-DD.
|
12
|
+
# Date in the format YYYY-MM-DD.
|
16
13
|
attr_accessor :date
|
17
14
|
|
18
15
|
# Attribute mapping from ruby-style variable name to JSON key.
|
19
16
|
def self.attribute_map
|
20
17
|
{
|
21
|
-
:
|
22
|
-
:click_count => :clickCount,
|
18
|
+
:currencies => :currencies,
|
23
19
|
:date => :date
|
24
20
|
}
|
25
21
|
end
|
@@ -32,8 +28,7 @@ module Algolia
|
|
32
28
|
# Attribute type mapping.
|
33
29
|
def self.types_mapping
|
34
30
|
{
|
35
|
-
:
|
36
|
-
:click_count => :Integer,
|
31
|
+
:currencies => :'Hash<String, CurrenciesValue>',
|
37
32
|
:date => :String
|
38
33
|
}
|
39
34
|
end
|
@@ -47,29 +42,25 @@ module Algolia
|
|
47
42
|
# @param [Hash] attributes Model attributes in the form of hash
|
48
43
|
def initialize(attributes = {})
|
49
44
|
unless attributes.is_a?(Hash)
|
50
|
-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::
|
45
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::DailyRevenue` initialize method"
|
51
46
|
end
|
52
47
|
|
53
48
|
# check to see if the attribute exists and convert string to symbol for hash key
|
54
49
|
attributes = attributes.each_with_object({}) do |(k, v), h|
|
55
50
|
unless self.class.attribute_map.key?(k.to_sym)
|
56
51
|
raise ArgumentError,
|
57
|
-
"`#{k}` is not a valid attribute in `Algolia::
|
52
|
+
"`#{k}` is not a valid attribute in `Algolia::DailyRevenue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
58
53
|
end
|
59
54
|
|
60
55
|
h[k.to_sym] = v
|
61
56
|
end
|
62
57
|
|
63
|
-
if attributes.key?(:
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
if attributes.key?(:click_count)
|
70
|
-
self.click_count = attributes[:click_count]
|
58
|
+
if attributes.key?(:currencies)
|
59
|
+
if (value = attributes[:currencies]).is_a?(Hash)
|
60
|
+
self.currencies = value
|
61
|
+
end
|
71
62
|
else
|
72
|
-
self.
|
63
|
+
self.currencies = nil
|
73
64
|
end
|
74
65
|
|
75
66
|
if attributes.key?(:date)
|
@@ -85,8 +76,7 @@ module Algolia
|
|
85
76
|
return true if equal?(other)
|
86
77
|
|
87
78
|
self.class == other.class &&
|
88
|
-
|
89
|
-
click_count == other.click_count &&
|
79
|
+
currencies == other.currencies &&
|
90
80
|
date == other.date
|
91
81
|
end
|
92
82
|
|
@@ -99,7 +89,7 @@ module Algolia
|
|
99
89
|
# Calculates hash code according to all attributes.
|
100
90
|
# @return [Integer] Hash code
|
101
91
|
def hash
|
102
|
-
[
|
92
|
+
[currencies, date].hash
|
103
93
|
end
|
104
94
|
|
105
95
|
# Builds the object from hash
|
@@ -5,8 +5,8 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Analytics
|
8
|
-
class
|
9
|
-
# Date
|
8
|
+
class DailySearches
|
9
|
+
# Date in the format YYYY-MM-DD.
|
10
10
|
attr_accessor :date
|
11
11
|
|
12
12
|
# Number of occurrences.
|
@@ -42,14 +42,14 @@ 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::
|
45
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::DailySearches` 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::
|
52
|
+
"`#{k}` is not a valid attribute in `Algolia::DailySearches`. 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
|
@@ -5,11 +5,11 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Analytics
|
8
|
-
class
|
9
|
-
#
|
8
|
+
class DailySearchesNoClicks
|
9
|
+
# Search query.
|
10
10
|
attr_accessor :search
|
11
11
|
|
12
|
-
# Number of
|
12
|
+
# Number of tracked searches.
|
13
13
|
attr_accessor :count
|
14
14
|
|
15
15
|
# Number of results (hits).
|
@@ -47,14 +47,14 @@ module Algolia
|
|
47
47
|
# @param [Hash] attributes Model attributes in the form of hash
|
48
48
|
def initialize(attributes = {})
|
49
49
|
unless attributes.is_a?(Hash)
|
50
|
-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::
|
50
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::DailySearchesNoClicks` initialize method"
|
51
51
|
end
|
52
52
|
|
53
53
|
# check to see if the attribute exists and convert string to symbol for hash key
|
54
54
|
attributes = attributes.each_with_object({}) do |(k, v), h|
|
55
55
|
unless self.class.attribute_map.key?(k.to_sym)
|
56
56
|
raise ArgumentError,
|
57
|
-
"`#{k}` is not a valid attribute in `Algolia::
|
57
|
+
"`#{k}` is not a valid attribute in `Algolia::DailySearchesNoClicks`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
58
58
|
end
|
59
59
|
|
60
60
|
h[k.to_sym] = v
|
@@ -79,6 +79,20 @@ module Algolia
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
+
# Custom attribute writer method with validation
|
83
|
+
# @param [Object] count Value to be assigned
|
84
|
+
def count=(count)
|
85
|
+
if count.nil?
|
86
|
+
raise ArgumentError, 'count cannot be nil'
|
87
|
+
end
|
88
|
+
|
89
|
+
if count < 1
|
90
|
+
raise ArgumentError, 'invalid value for "count", must be greater than or equal to 1.'
|
91
|
+
end
|
92
|
+
|
93
|
+
@count = count
|
94
|
+
end
|
95
|
+
|
82
96
|
# Checks equality by comparing each attribute.
|
83
97
|
# @param [Object] Object to be compared
|
84
98
|
def ==(other)
|
@@ -5,14 +5,14 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Analytics
|
8
|
-
class
|
9
|
-
#
|
8
|
+
class DailySearchesNoResults
|
9
|
+
# Search query.
|
10
10
|
attr_accessor :search
|
11
11
|
|
12
12
|
# Number of occurrences.
|
13
13
|
attr_accessor :count
|
14
14
|
|
15
|
-
# Number of
|
15
|
+
# Number of searches for this term with applied filters.
|
16
16
|
attr_accessor :with_filter_count
|
17
17
|
|
18
18
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -47,14 +47,14 @@ module Algolia
|
|
47
47
|
# @param [Hash] attributes Model attributes in the form of hash
|
48
48
|
def initialize(attributes = {})
|
49
49
|
unless attributes.is_a?(Hash)
|
50
|
-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::
|
50
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::DailySearchesNoResults` initialize method"
|
51
51
|
end
|
52
52
|
|
53
53
|
# check to see if the attribute exists and convert string to symbol for hash key
|
54
54
|
attributes = attributes.each_with_object({}) do |(k, v), h|
|
55
55
|
unless self.class.attribute_map.key?(k.to_sym)
|
56
56
|
raise ArgumentError,
|
57
|
-
"`#{k}` is not a valid attribute in `Algolia::
|
57
|
+
"`#{k}` is not a valid attribute in `Algolia::DailySearchesNoResults`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
58
58
|
end
|
59
59
|
|
60
60
|
h[k.to_sym] = v
|
@@ -79,6 +79,20 @@ module Algolia
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
+
# Custom attribute writer method with validation
|
83
|
+
# @param [Object] with_filter_count Value to be assigned
|
84
|
+
def with_filter_count=(with_filter_count)
|
85
|
+
if with_filter_count.nil?
|
86
|
+
raise ArgumentError, 'with_filter_count cannot be nil'
|
87
|
+
end
|
88
|
+
|
89
|
+
if with_filter_count < 0
|
90
|
+
raise ArgumentError, 'invalid value for "with_filter_count", must be greater than or equal to 0.'
|
91
|
+
end
|
92
|
+
|
93
|
+
@with_filter_count = with_filter_count
|
94
|
+
end
|
95
|
+
|
82
96
|
# Checks equality by comparing each attribute.
|
83
97
|
# @param [Object] Object to be compared
|
84
98
|
def ==(other)
|
@@ -5,11 +5,11 @@ require 'time'
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Analytics
|
8
|
-
class
|
9
|
-
# Date
|
8
|
+
class DailyUsers
|
9
|
+
# Date in the format YYYY-MM-DD.
|
10
10
|
attr_accessor :date
|
11
11
|
|
12
|
-
# Number of
|
12
|
+
# Number of unique users.
|
13
13
|
attr_accessor :count
|
14
14
|
|
15
15
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -42,14 +42,14 @@ 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::
|
45
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::DailyUsers` 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::
|
52
|
+
"`#{k}` is not a valid attribute in `Algolia::DailyUsers`. 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
|
@@ -0,0 +1,267 @@
|
|
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 GetAddToCartRateResponse
|
9
|
+
# Add-to-cart rate, calculated as number of tracked searches with at least one add-to-cart event divided by the number of tracked searches. If null, Algolia didn't receive any search requests with `clickAnalytics` set to true.
|
10
|
+
attr_accessor :rate
|
11
|
+
|
12
|
+
# Number of tracked searches. Tracked searches are search requests where the `clickAnalytics` parameter is true.
|
13
|
+
attr_accessor :tracked_search_count
|
14
|
+
|
15
|
+
# Number of add-to-cart events from this search.
|
16
|
+
attr_accessor :add_to_cart_count
|
17
|
+
|
18
|
+
# Daily add-to-cart rates.
|
19
|
+
attr_accessor :dates
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:rate => :rate,
|
25
|
+
:tracked_search_count => :trackedSearchCount,
|
26
|
+
:add_to_cart_count => :addToCartCount,
|
27
|
+
:dates => :dates
|
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
|
+
:rate => :Float,
|
40
|
+
:tracked_search_count => :Integer,
|
41
|
+
:add_to_cart_count => :Integer,
|
42
|
+
:dates => :'Array<DailyAddToCartRates>'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# List of attributes with nullable: true
|
47
|
+
def self.openapi_nullable
|
48
|
+
Set.new([
|
49
|
+
:rate
|
50
|
+
])
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initializes the object
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
55
|
+
def initialize(attributes = {})
|
56
|
+
unless attributes.is_a?(Hash)
|
57
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::GetAddToCartRateResponse` initialize method"
|
58
|
+
end
|
59
|
+
|
60
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
61
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
62
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
63
|
+
raise ArgumentError,
|
64
|
+
"`#{k}` is not a valid attribute in `Algolia::GetAddToCartRateResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
65
|
+
end
|
66
|
+
|
67
|
+
h[k.to_sym] = v
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:rate)
|
71
|
+
self.rate = attributes[:rate]
|
72
|
+
else
|
73
|
+
self.rate = nil
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.key?(:tracked_search_count)
|
77
|
+
self.tracked_search_count = attributes[:tracked_search_count]
|
78
|
+
else
|
79
|
+
self.tracked_search_count = nil
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:add_to_cart_count)
|
83
|
+
self.add_to_cart_count = attributes[:add_to_cart_count]
|
84
|
+
else
|
85
|
+
self.add_to_cart_count = nil
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.key?(:dates)
|
89
|
+
if (value = attributes[:dates]).is_a?(Array)
|
90
|
+
self.dates = value
|
91
|
+
end
|
92
|
+
else
|
93
|
+
self.dates = nil
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Custom attribute writer method with validation
|
98
|
+
# @param [Object] rate Value to be assigned
|
99
|
+
def rate=(rate)
|
100
|
+
if !rate.nil? && rate > 1
|
101
|
+
raise ArgumentError, 'invalid value for "rate", must be smaller than or equal to 1.'
|
102
|
+
end
|
103
|
+
|
104
|
+
if !rate.nil? && rate < 0
|
105
|
+
raise ArgumentError, 'invalid value for "rate", must be greater than or equal to 0.'
|
106
|
+
end
|
107
|
+
|
108
|
+
@rate = rate
|
109
|
+
end
|
110
|
+
|
111
|
+
# Custom attribute writer method with validation
|
112
|
+
# @param [Object] add_to_cart_count Value to be assigned
|
113
|
+
def add_to_cart_count=(add_to_cart_count)
|
114
|
+
if add_to_cart_count.nil?
|
115
|
+
raise ArgumentError, 'add_to_cart_count cannot be nil'
|
116
|
+
end
|
117
|
+
|
118
|
+
if add_to_cart_count < 0
|
119
|
+
raise ArgumentError, 'invalid value for "add_to_cart_count", must be greater than or equal to 0.'
|
120
|
+
end
|
121
|
+
|
122
|
+
@add_to_cart_count = add_to_cart_count
|
123
|
+
end
|
124
|
+
|
125
|
+
# Checks equality by comparing each attribute.
|
126
|
+
# @param [Object] Object to be compared
|
127
|
+
def ==(other)
|
128
|
+
return true if equal?(other)
|
129
|
+
|
130
|
+
self.class == other.class &&
|
131
|
+
rate == other.rate &&
|
132
|
+
tracked_search_count == other.tracked_search_count &&
|
133
|
+
add_to_cart_count == other.add_to_cart_count &&
|
134
|
+
dates == other.dates
|
135
|
+
end
|
136
|
+
|
137
|
+
# @see the `==` method
|
138
|
+
# @param [Object] Object to be compared
|
139
|
+
def eql?(other)
|
140
|
+
self == other
|
141
|
+
end
|
142
|
+
|
143
|
+
# Calculates hash code according to all attributes.
|
144
|
+
# @return [Integer] Hash code
|
145
|
+
def hash
|
146
|
+
[rate, tracked_search_count, add_to_cart_count, dates].hash
|
147
|
+
end
|
148
|
+
|
149
|
+
# Builds the object from hash
|
150
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
151
|
+
# @return [Object] Returns the model itself
|
152
|
+
def self.build_from_hash(attributes)
|
153
|
+
return nil unless attributes.is_a?(Hash)
|
154
|
+
|
155
|
+
attributes = attributes.transform_keys(&:to_sym)
|
156
|
+
transformed_hash = {}
|
157
|
+
types_mapping.each_pair do |key, type|
|
158
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
159
|
+
transformed_hash[key.to_sym] = nil
|
160
|
+
elsif type =~ /\AArray<(.*)>/i
|
161
|
+
# check to ensure the input is an array given that the attribute
|
162
|
+
# is documented as an array but the input is not
|
163
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
164
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
165
|
+
end
|
166
|
+
elsif !attributes[attribute_map[key]].nil?
|
167
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
168
|
+
end
|
169
|
+
end
|
170
|
+
new(transformed_hash)
|
171
|
+
end
|
172
|
+
|
173
|
+
# Deserializes the data based on type
|
174
|
+
# @param string type Data type
|
175
|
+
# @param string value Value to be deserialized
|
176
|
+
# @return [Object] Deserialized data
|
177
|
+
def self._deserialize(type, value)
|
178
|
+
case type.to_sym
|
179
|
+
when :Time
|
180
|
+
Time.parse(value)
|
181
|
+
when :Date
|
182
|
+
Date.parse(value)
|
183
|
+
when :String
|
184
|
+
value.to_s
|
185
|
+
when :Integer
|
186
|
+
value.to_i
|
187
|
+
when :Float
|
188
|
+
value.to_f
|
189
|
+
when :Boolean
|
190
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
191
|
+
true
|
192
|
+
else
|
193
|
+
false
|
194
|
+
end
|
195
|
+
when :Object
|
196
|
+
# generic object (usually a Hash), return directly
|
197
|
+
value
|
198
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
199
|
+
inner_type = Regexp.last_match[:inner_type]
|
200
|
+
value.map { |v| _deserialize(inner_type, v) }
|
201
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
202
|
+
k_type = Regexp.last_match[:k_type]
|
203
|
+
v_type = Regexp.last_match[:v_type]
|
204
|
+
{}.tap do |hash|
|
205
|
+
value.each do |k, v|
|
206
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
else # model
|
210
|
+
# models (e.g. Pet) or oneOf
|
211
|
+
klass = Algolia::Analytics.const_get(type)
|
212
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns the string representation of the object
|
217
|
+
# @return [String] String presentation of the object
|
218
|
+
def to_s
|
219
|
+
to_hash.to_s
|
220
|
+
end
|
221
|
+
|
222
|
+
# to_body is an alias to to_hash (backward compatibility)
|
223
|
+
# @return [Hash] Returns the object in the form of hash
|
224
|
+
def to_body
|
225
|
+
to_hash
|
226
|
+
end
|
227
|
+
|
228
|
+
def to_json(*_args)
|
229
|
+
to_hash.to_json
|
230
|
+
end
|
231
|
+
|
232
|
+
# Returns the object in the form of hash
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_hash
|
235
|
+
hash = {}
|
236
|
+
self.class.attribute_map.each_pair do |attr, param|
|
237
|
+
value = send(attr)
|
238
|
+
if value.nil?
|
239
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
240
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
241
|
+
end
|
242
|
+
|
243
|
+
hash[param] = _to_hash(value)
|
244
|
+
end
|
245
|
+
hash
|
246
|
+
end
|
247
|
+
|
248
|
+
# Outputs non-array value in the form of hash
|
249
|
+
# For object, use to_hash. Otherwise, just return the value
|
250
|
+
# @param [Object] value Any valid value
|
251
|
+
# @return [Hash] Returns the value in the form of hash
|
252
|
+
def _to_hash(value)
|
253
|
+
if value.is_a?(Array)
|
254
|
+
value.compact.map { |v| _to_hash(v) }
|
255
|
+
elsif value.is_a?(Hash)
|
256
|
+
{}.tap do |hash|
|
257
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
258
|
+
end
|
259
|
+
elsif value.respond_to? :to_hash
|
260
|
+
value.to_hash
|
261
|
+
else
|
262
|
+
value
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|