Method: Algolia::Insights::AddedToCartObjectIDs#initialize
- Defined in:
- lib/algolia/models/insights/added_to_cart_object_ids.rb
#initialize(attributes = {}) ⇒ AddedToCartObjectIDs
Initializes the object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/algolia/models/insights/added_to_cart_object_ids.rb', line 94 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) raise( ArgumentError, "The input argument (attributes) must be a hash in `Algolia::AddedToCartObjectIDs` initialize method" ) end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) raise( ArgumentError, "`#{k}` is not a valid attribute in `Algolia::AddedToCartObjectIDs`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect ) end h[k.to_sym] = v } if attributes.key?(:event_name) self.event_name = attributes[:event_name] else self.event_name = nil end if attributes.key?(:event_type) self.event_type = attributes[:event_type] else self.event_type = nil end if attributes.key?(:event_subtype) self.event_subtype = attributes[:event_subtype] else self.event_subtype = nil end if attributes.key?(:index) self.index = attributes[:index] else self.index = nil end if attributes.key?(:object_ids) if (value = attributes[:object_ids]).is_a?(Array) self.object_ids = value end else self.object_ids = nil end if attributes.key?(:user_token) self.user_token = attributes[:user_token] else self.user_token = nil end if attributes.key?(:authenticated_user_token) self.authenticated_user_token = attributes[:authenticated_user_token] end if attributes.key?(:currency) self.currency = attributes[:currency] end if attributes.key?(:object_data) if (value = attributes[:object_data]).is_a?(Array) self.object_data = value end end if attributes.key?(:timestamp) self. = attributes[:timestamp] end if attributes.key?(:value) self.value = attributes[:value] end end |