=begin #UltraCart Rest API V2 #UltraCart REST API Version 2 The version of the OpenAPI document: 2.0.0 Contact: support@ultracart.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.0.1-SNAPSHOT =end require 'date' require 'time' module UltracartClient class EmailStat # Count of clicked emails attr_accessor :click_count # Count of clicked emails, formatted attr_accessor :click_count_formatted # Count of conversions attr_accessor :conversion_count # Count of conversions, formatted attr_accessor :conversion_count_formatted # True if campaign/flow has been archived attr_accessor :deleted # Count of delivered emails attr_accessor :delivered_count # Count of delivered emails, formatted attr_accessor :delivered_count_formatted # Count of emails kicked attr_accessor :kickbox_count # Count of emails kicked, formatted attr_accessor :kickbox_count_formatted # Merchant ID attr_accessor :merchant_id # List or segment name attr_accessor :name # Count of opened emails attr_accessor :open_count # Count of opened emails, formatted attr_accessor :open_count_formatted # Count of orders attr_accessor :order_count # Count of orders, formatted attr_accessor :order_count_formatted # Count of emails permanently bounced attr_accessor :permanent_bounce_count # Count of emails permanently bounced, formatted attr_accessor :permanent_bounce_count_formatted # Profit attr_accessor :profit # Profit, formatted attr_accessor :profit_formatted # Revenue attr_accessor :revenue # Revenue, formatted attr_accessor :revenue_formatted # Count of emails sent attr_accessor :send_count # Count of emails sent, formatted attr_accessor :send_count_formatted # Count of skipped emails attr_accessor :skipped_count # Count of skipped emails, formatted attr_accessor :skipped_count_formatted # Count of emails classified as spam attr_accessor :spam_count # Count of emails classified as spam, formatted attr_accessor :spam_count_formatted # Campaign, Flow or None (for anything else) attr_accessor :stat_type # Status of campaign or flow attr_accessor :status # Status dts of campaign or flow attr_accessor :status_dts # Step UUID if the statistics are at the step/email level attr_accessor :step_uuid attr_accessor :steps # Storefront oid attr_accessor :storefront_oid # Count of emails classified as unsubscribe attr_accessor :unsubscribe_count # Count of emails classified as unsubscribe, formatted attr_accessor :unsubscribe_count_formatted # List/Segment uuid, or Flow/Campaign uuid depending on level of stat aggregation. attr_accessor :uuid # Count of views attr_accessor :view_count # Count of views, formatted attr_accessor :view_count_formatted # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'click_count' => :'click_count', :'click_count_formatted' => :'click_count_formatted', :'conversion_count' => :'conversion_count', :'conversion_count_formatted' => :'conversion_count_formatted', :'deleted' => :'deleted', :'delivered_count' => :'delivered_count', :'delivered_count_formatted' => :'delivered_count_formatted', :'kickbox_count' => :'kickbox_count', :'kickbox_count_formatted' => :'kickbox_count_formatted', :'merchant_id' => :'merchant_id', :'name' => :'name', :'open_count' => :'open_count', :'open_count_formatted' => :'open_count_formatted', :'order_count' => :'order_count', :'order_count_formatted' => :'order_count_formatted', :'permanent_bounce_count' => :'permanent_bounce_count', :'permanent_bounce_count_formatted' => :'permanent_bounce_count_formatted', :'profit' => :'profit', :'profit_formatted' => :'profit_formatted', :'revenue' => :'revenue', :'revenue_formatted' => :'revenue_formatted', :'send_count' => :'send_count', :'send_count_formatted' => :'send_count_formatted', :'skipped_count' => :'skipped_count', :'skipped_count_formatted' => :'skipped_count_formatted', :'spam_count' => :'spam_count', :'spam_count_formatted' => :'spam_count_formatted', :'stat_type' => :'stat_type', :'status' => :'status', :'status_dts' => :'status_dts', :'step_uuid' => :'step_uuid', :'steps' => :'steps', :'storefront_oid' => :'storefront_oid', :'unsubscribe_count' => :'unsubscribe_count', :'unsubscribe_count_formatted' => :'unsubscribe_count_formatted', :'uuid' => :'uuid', :'view_count' => :'view_count', :'view_count_formatted' => :'view_count_formatted' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'click_count' => :'Integer', :'click_count_formatted' => :'String', :'conversion_count' => :'Integer', :'conversion_count_formatted' => :'String', :'deleted' => :'Boolean', :'delivered_count' => :'Integer', :'delivered_count_formatted' => :'String', :'kickbox_count' => :'Integer', :'kickbox_count_formatted' => :'String', :'merchant_id' => :'String', :'name' => :'String', :'open_count' => :'Integer', :'open_count_formatted' => :'String', :'order_count' => :'Integer', :'order_count_formatted' => :'String', :'permanent_bounce_count' => :'Integer', :'permanent_bounce_count_formatted' => :'String', :'profit' => :'Float', :'profit_formatted' => :'String', :'revenue' => :'Float', :'revenue_formatted' => :'String', :'send_count' => :'Integer', :'send_count_formatted' => :'String', :'skipped_count' => :'Integer', :'skipped_count_formatted' => :'String', :'spam_count' => :'Integer', :'spam_count_formatted' => :'String', :'stat_type' => :'String', :'status' => :'String', :'status_dts' => :'String', :'step_uuid' => :'String', :'steps' => :'Array', :'storefront_oid' => :'Integer', :'unsubscribe_count' => :'Integer', :'unsubscribe_count_formatted' => :'String', :'uuid' => :'String', :'view_count' => :'Integer', :'view_count_formatted' => :'String' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::EmailStat` 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)) fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::EmailStat`. 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?(:'click_count') self.click_count = attributes[:'click_count'] end if attributes.key?(:'click_count_formatted') self.click_count_formatted = attributes[:'click_count_formatted'] end if attributes.key?(:'conversion_count') self.conversion_count = attributes[:'conversion_count'] end if attributes.key?(:'conversion_count_formatted') self.conversion_count_formatted = attributes[:'conversion_count_formatted'] end if attributes.key?(:'deleted') self.deleted = attributes[:'deleted'] end if attributes.key?(:'delivered_count') self.delivered_count = attributes[:'delivered_count'] end if attributes.key?(:'delivered_count_formatted') self.delivered_count_formatted = attributes[:'delivered_count_formatted'] end if attributes.key?(:'kickbox_count') self.kickbox_count = attributes[:'kickbox_count'] end if attributes.key?(:'kickbox_count_formatted') self.kickbox_count_formatted = attributes[:'kickbox_count_formatted'] end if attributes.key?(:'merchant_id') self.merchant_id = attributes[:'merchant_id'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'open_count') self.open_count = attributes[:'open_count'] end if attributes.key?(:'open_count_formatted') self.open_count_formatted = attributes[:'open_count_formatted'] end if attributes.key?(:'order_count') self.order_count = attributes[:'order_count'] end if attributes.key?(:'order_count_formatted') self.order_count_formatted = attributes[:'order_count_formatted'] end if attributes.key?(:'permanent_bounce_count') self.permanent_bounce_count = attributes[:'permanent_bounce_count'] end if attributes.key?(:'permanent_bounce_count_formatted') self.permanent_bounce_count_formatted = attributes[:'permanent_bounce_count_formatted'] end if attributes.key?(:'profit') self.profit = attributes[:'profit'] end if attributes.key?(:'profit_formatted') self.profit_formatted = attributes[:'profit_formatted'] end if attributes.key?(:'revenue') self.revenue = attributes[:'revenue'] end if attributes.key?(:'revenue_formatted') self.revenue_formatted = attributes[:'revenue_formatted'] end if attributes.key?(:'send_count') self.send_count = attributes[:'send_count'] end if attributes.key?(:'send_count_formatted') self.send_count_formatted = attributes[:'send_count_formatted'] end if attributes.key?(:'skipped_count') self.skipped_count = attributes[:'skipped_count'] end if attributes.key?(:'skipped_count_formatted') self.skipped_count_formatted = attributes[:'skipped_count_formatted'] end if attributes.key?(:'spam_count') self.spam_count = attributes[:'spam_count'] end if attributes.key?(:'spam_count_formatted') self.spam_count_formatted = attributes[:'spam_count_formatted'] end if attributes.key?(:'stat_type') self.stat_type = attributes[:'stat_type'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'status_dts') self.status_dts = attributes[:'status_dts'] end if attributes.key?(:'step_uuid') self.step_uuid = attributes[:'step_uuid'] end if attributes.key?(:'steps') if (value = attributes[:'steps']).is_a?(Array) self.steps = value end end if attributes.key?(:'storefront_oid') self.storefront_oid = attributes[:'storefront_oid'] end if attributes.key?(:'unsubscribe_count') self.unsubscribe_count = attributes[:'unsubscribe_count'] end if attributes.key?(:'unsubscribe_count_formatted') self.unsubscribe_count_formatted = attributes[:'unsubscribe_count_formatted'] end if attributes.key?(:'uuid') self.uuid = attributes[:'uuid'] end if attributes.key?(:'view_count') self.view_count = attributes[:'view_count'] end if attributes.key?(:'view_count_formatted') self.view_count_formatted = attributes[:'view_count_formatted'] end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? true end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && click_count == o.click_count && click_count_formatted == o.click_count_formatted && conversion_count == o.conversion_count && conversion_count_formatted == o.conversion_count_formatted && deleted == o.deleted && delivered_count == o.delivered_count && delivered_count_formatted == o.delivered_count_formatted && kickbox_count == o.kickbox_count && kickbox_count_formatted == o.kickbox_count_formatted && merchant_id == o.merchant_id && name == o.name && open_count == o.open_count && open_count_formatted == o.open_count_formatted && order_count == o.order_count && order_count_formatted == o.order_count_formatted && permanent_bounce_count == o.permanent_bounce_count && permanent_bounce_count_formatted == o.permanent_bounce_count_formatted && profit == o.profit && profit_formatted == o.profit_formatted && revenue == o.revenue && revenue_formatted == o.revenue_formatted && send_count == o.send_count && send_count_formatted == o.send_count_formatted && skipped_count == o.skipped_count && skipped_count_formatted == o.skipped_count_formatted && spam_count == o.spam_count && spam_count_formatted == o.spam_count_formatted && stat_type == o.stat_type && status == o.status && status_dts == o.status_dts && step_uuid == o.step_uuid && steps == o.steps && storefront_oid == o.storefront_oid && unsubscribe_count == o.unsubscribe_count && unsubscribe_count_formatted == o.unsubscribe_count_formatted && uuid == o.uuid && view_count == o.view_count && view_count_formatted == o.view_count_formatted end # @see the `==` method # @param [Object] Object to be compared def eql?(o) self == o end # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash [click_count, click_count_formatted, conversion_count, conversion_count_formatted, deleted, delivered_count, delivered_count_formatted, kickbox_count, kickbox_count_formatted, merchant_id, name, open_count, open_count_formatted, order_count, order_count_formatted, permanent_bounce_count, permanent_bounce_count_formatted, profit, profit_formatted, revenue, revenue_formatted, send_count, send_count_formatted, skipped_count, skipped_count_formatted, spam_count, spam_count_formatted, stat_type, status, status_dts, step_uuid, steps, storefront_oid, unsubscribe_count, unsubscribe_count_formatted, uuid, view_count, view_count_formatted].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def self.build_from_hash(attributes) new.build_from_hash(attributes) end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?.+?), (?.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = UltracartClient.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # to_body is an alias to to_hash (backward compatibility) # @return [Hash] Returns the object in the form of hash def to_body to_hash end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end # Outputs non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value # @param [Object] value Any valid value # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end